Skip to content

Commit 0dd0f09

Browse files
committed
Formatting cleanup for backups
1 parent 0a2c89e commit 0dd0f09

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
- name: install dependencies
5252
run: composer install --prefer-dist --no-interaction --no-progress
5353
- name: run cs-fixer
54-
run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --rules=psr_autoloading
54+
run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --config .php_cs.dist
5555
continue-on-error: true
5656
- name: execute unit tests
5757
run: vendor/bin/phpunit --bootstrap bootstrap/app.php tests/Unit

app/Http/Controllers/Api/Client/Servers/BackupController.php

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ public function __construct(
6161
* Returns all of the backups for a given server instance in a paginated
6262
* result set.
6363
*
64-
* @return array
64+
* @throws \Spatie\Fractalistic\Exceptions\InvalidTransformation
65+
* @throws \Spatie\Fractalistic\Exceptions\NoTransformerSpecified
6566
*/
66-
public function index(Request $request, Server $server)
67+
public function index(Request $request, Server $server): array
6768
{
6869
if (!$request->user()->can(Permission::ACTION_BACKUP_READ, $server)) {
6970
throw new UnauthorizedException();
@@ -79,11 +80,11 @@ public function index(Request $request, Server $server)
7980
/**
8081
* Starts the backup process for a server.
8182
*
82-
* @return array
83-
*
84-
* @throws \Exception|\Throwable
83+
* @throws \Spatie\Fractalistic\Exceptions\InvalidTransformation
84+
* @throws \Spatie\Fractalistic\Exceptions\NoTransformerSpecified
85+
* @throws \Throwable
8586
*/
86-
public function store(StoreBackupRequest $request, Server $server)
87+
public function store(StoreBackupRequest $request, Server $server): array
8788
{
8889
/** @var \Pterodactyl\Models\Backup $backup */
8990
$backup = $server->audit(AuditLog::SERVER__BACKUP_STARTED, function (AuditLog $model, Server $server) use ($request) {
@@ -106,9 +107,10 @@ public function store(StoreBackupRequest $request, Server $server)
106107
/**
107108
* Returns information about a single backup.
108109
*
109-
* @return array
110+
* @throws \Spatie\Fractalistic\Exceptions\InvalidTransformation
111+
* @throws \Spatie\Fractalistic\Exceptions\NoTransformerSpecified
110112
*/
111-
public function view(Request $request, Server $server, Backup $backup)
113+
public function view(Request $request, Server $server, Backup $backup): array
112114
{
113115
if (!$request->user()->can(Permission::ACTION_BACKUP_READ, $server)) {
114116
throw new UnauthorizedException();
@@ -123,11 +125,9 @@ public function view(Request $request, Server $server, Backup $backup)
123125
* Deletes a backup from the panel as well as the remote source where it is currently
124126
* being stored.
125127
*
126-
* @return \Illuminate\Http\JsonResponse
127-
*
128128
* @throws \Throwable
129129
*/
130-
public function delete(Request $request, Server $server, Backup $backup)
130+
public function delete(Request $request, Server $server, Backup $backup): JsonResponse
131131
{
132132
if (!$request->user()->can(Permission::ACTION_BACKUP_DELETE, $server)) {
133133
throw new UnauthorizedException();
@@ -146,10 +146,8 @@ public function delete(Request $request, Server $server, Backup $backup)
146146
* Download the backup for a given server instance. For daemon local files, the file
147147
* will be streamed back through the Panel. For AWS S3 files, a signed URL will be generated
148148
* which the user is redirected to.
149-
*
150-
* @return \Illuminate\Http\JsonResponse
151149
*/
152-
public function download(Request $request, Server $server, Backup $backup)
150+
public function download(Request $request, Server $server, Backup $backup): JsonResponse
153151
{
154152
if (!$request->user()->can(Permission::ACTION_BACKUP_DOWNLOAD, $server)) {
155153
throw new UnauthorizedException();
@@ -176,11 +174,9 @@ public function download(Request $request, Server $server, Backup $backup)
176174
* files that currently exist on the server will be deleted before restoring.
177175
* Otherwise the archive will simply be unpacked over the existing files.
178176
*
179-
* @return \Illuminate\Http\JsonResponse
180-
*
181177
* @throws \Throwable
182178
*/
183-
public function restore(Request $request, Server $server, Backup $backup)
179+
public function restore(Request $request, Server $server, Backup $backup): JsonResponse
184180
{
185181
if (!$request->user()->can(Permission::ACTION_BACKUP_RESTORE, $server)) {
186182
throw new UnauthorizedException();

0 commit comments

Comments
 (0)