Files
pterodactyl-panel/app/Http/Requests/Api/Admin/Extensions/InstallExtensionRequest.php
T
DarkZmaj fcec806acb Apply Pint formatting to two extension files (#7250)
## Problem

`vendor/bin/pint --test` fails on the current 2.0 development branch,
which fails the Tests workflow for every pull request.

## Reproduction

Run `vendor/bin/pint --test --parallel --cache-file=.pint.cache app
bootstrap/app.php bootstrap/tests.php config database routes tests` on a
clean checkout. It reports two files:
`app/Http/Requests/Api/Admin/Extensions/InstallExtensionRequest.php` and
`app/Services/Extensions/ExtensionPackageLocator.php`.

## Root cause

Two recent changes were merged without running Pint. One docblock uses
`@inheritdoc` where the project style wants `{@inheritdoc}`, and one
blank line contains trailing whitespace.

## Fix

Run Pint on exactly those two files. The change is one docblock line and
one whitespace only line.

## Testing

`vendor/bin/pint --test` on the same paths passes afterwards. No
behaviour changes.

## Compatibility considerations

None. Formatting only.
2026-10-06 15:17:00 +01:00

66 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace Pterodactyl\Http\Requests\Api\Admin\Extensions;
use Illuminate\Http\UploadedFile;
use Pterodactyl\Enum\Permissions;
use Pterodactyl\Http\Requests\Api\Admin\AdminApiRequest;
use UnexpectedValueException;
class InstallExtensionRequest extends AdminApiRequest
{
public function permissions(): array
{
return [Permissions::AdminExtensionsInstall];
}
/**
* @return ValidationRules
*/
public function rules(): array
{
return [
'package' => ['required', 'file', 'max:51200'],
'enable' => ['sometimes', 'boolean'],
];
}
public function attributes(): array
{
return [
'package' => 'extension package',
];
}
/**
* @return array{package: UploadedFile, enable: bool}
*/
public function payload(): array
{
$package = $this->file('package');
throw_unless($package instanceof UploadedFile, UnexpectedValueException::class, 'Expected an uploaded extension package.');
return [
'package' => $package,
'enable' => $this->boolean('enable', false),
];
}
/**
* {@inheritdoc}
*/
protected function prepareForValidation(): void
{
if (! $this->has('enable')) {
return;
}
$enable = filter_var($this->input('enable'), FILTER_VALIDATE_BOOL, FILTER_NULL_ON_FAILURE);
if ($enable !== null) {
$this->merge(['enable' => $enable]);
}
}
}