PHPstan updates (#1047)

* Not found property rule

* Make these “better”

* Day 1

* Day 2

* Day 3

* Dat 4

* Remove disabled check

* Day 4 continued

* Run pint

* Final changes hopefully

* Pint fixes

* Fix again

* Reset these

* Update app/Filament/Admin/Pages/Health.php

Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com>

* Update app/Traits/CheckMigrationsTrait.php

Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com>

---------

Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com>
This commit is contained in:
Lance Pioch 2025-03-03 14:41:19 -05:00 committed by GitHub
parent 82409f2fba
commit da195fd2fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
207 changed files with 1046 additions and 275 deletions

View File

@ -16,28 +16,33 @@ class CheckEggUpdatesCommand extends Command
$eggs = Egg::all(); $eggs = Egg::all();
foreach ($eggs as $egg) { foreach ($eggs as $egg) {
try { try {
if (is_null($egg->update_url)) { $this->check($egg, $exporterService);
$this->comment("{$egg->name}: Skipping (no update url set)");
continue;
}
$currentJson = json_decode($exporterService->handle($egg->id));
unset($currentJson->exported_at);
$updatedJson = json_decode(file_get_contents($egg->update_url));
unset($updatedJson->exported_at);
if (md5(json_encode($currentJson)) === md5(json_encode($updatedJson))) {
$this->info("{$egg->name}: Up-to-date");
cache()->put("eggs.{$egg->uuid}.update", false, now()->addHour());
} else {
$this->warn("{$egg->name}: Found update");
cache()->put("eggs.{$egg->uuid}.update", true, now()->addHour());
}
} catch (Exception $exception) { } catch (Exception $exception) {
$this->error("{$egg->name}: Error ({$exception->getMessage()})"); $this->error("{$egg->name}: Error ({$exception->getMessage()})");
} }
} }
} }
private function check(Egg $egg, EggExporterService $exporterService): void
{
if (is_null($egg->update_url)) {
$this->comment("$egg->name: Skipping (no update url set)");
return;
}
$currentJson = json_decode($exporterService->handle($egg->id));
unset($currentJson->exported_at);
$updatedJson = json_decode(file_get_contents($egg->update_url));
unset($updatedJson->exported_at);
if (md5(json_encode($currentJson)) === md5(json_encode($updatedJson))) {
$this->info("$egg->name: Up-to-date");
cache()->put("eggs.$egg->uuid.update", false, now()->addHour());
} else {
$this->warn("$egg->name: Found update");
cache()->put("eggs.$egg->uuid.update", true, now()->addHour());
}
}
} }

View File

@ -27,8 +27,6 @@ class CacheSettingsCommand extends Command
{--redis-pass= : Password used to connect to redis.} {--redis-pass= : Password used to connect to redis.}
{--redis-port= : Port to connect to redis over.}'; {--redis-port= : Port to connect to redis over.}';
protected array $variables = [];
/** /**
* CacheSettingsCommand constructor. * CacheSettingsCommand constructor.
*/ */

View File

@ -27,6 +27,7 @@ class DatabaseSettingsCommand extends Command
{--username= : Username to use when connecting to the MySQL/ MariaDB server.} {--username= : Username to use when connecting to the MySQL/ MariaDB server.}
{--password= : Password to use for the MySQL/ MariaDB database.}'; {--password= : Password to use for the MySQL/ MariaDB database.}';
/** @var array<array-key, mixed> */
protected array $variables = []; protected array $variables = [];
/** /**
@ -179,7 +180,7 @@ class DatabaseSettingsCommand extends Command
} elseif ($this->variables['DB_CONNECTION'] === 'sqlite') { } elseif ($this->variables['DB_CONNECTION'] === 'sqlite') {
$this->variables['DB_DATABASE'] = $this->option('database') ?? $this->ask( $this->variables['DB_DATABASE'] = $this->option('database') ?? $this->ask(
'Database Path', 'Database Path',
env('DB_DATABASE', 'database.sqlite') (string) env('DB_DATABASE', 'database.sqlite')
); );
} }

View File

@ -22,6 +22,7 @@ class EmailSettingsCommand extends Command
{--username=} {--username=}
{--password=}'; {--password=}';
/** @var array<array-key, mixed> */
protected array $variables = []; protected array $variables = [];
/** /**

View File

@ -27,8 +27,6 @@ class QueueSettingsCommand extends Command
{--redis-pass= : Password used to connect to redis.} {--redis-pass= : Password used to connect to redis.}
{--redis-port= : Port to connect to redis over.}'; {--redis-port= : Port to connect to redis over.}';
protected array $variables = [];
/** /**
* QueueSettingsCommand constructor. * QueueSettingsCommand constructor.
*/ */

View File

@ -20,8 +20,6 @@ class RedisSetupCommand extends Command
{--redis-pass= : Password used to connect to redis.} {--redis-pass= : Password used to connect to redis.}
{--redis-port= : Port to connect to redis over.}'; {--redis-port= : Port to connect to redis over.}';
protected array $variables = [];
/** /**
* RedisSetupCommand constructor. * RedisSetupCommand constructor.
*/ */

View File

@ -28,8 +28,6 @@ class SessionSettingsCommand extends Command
{--redis-pass= : Password used to connect to redis.} {--redis-pass= : Password used to connect to redis.}
{--redis-port= : Port to connect to redis over.}'; {--redis-port= : Port to connect to redis over.}';
protected array $variables = [];
/** /**
* SessionSettingsCommand constructor. * SessionSettingsCommand constructor.
*/ */

View File

@ -81,6 +81,9 @@ class BulkPowerActionCommand extends Command
/** /**
* Returns the query builder instance that will return the servers that should be affected. * Returns the query builder instance that will return the servers that should be affected.
*
* @param string[]|int[] $servers
* @param string[]|int[] $nodes
*/ */
protected function getQueryBuilder(array $servers, array $nodes): Builder protected function getQueryBuilder(array $servers, array $nodes): Builder
{ {

View File

@ -8,8 +8,14 @@ interface Validatable
{ {
public function getValidator(): Validator; public function getValidator(): Validator;
/**
* @return array<string, mixed>
*/
public static function getRules(): array; public static function getRules(): array;
/**
* @return array<string, array<string, mixed>>
*/
public static function getRulesForField(string $field): array; public static function getRulesForField(string $field): array;
public function validate(): void; public function validate(): void;

View File

@ -12,6 +12,9 @@ use Illuminate\Http\Response;
use Illuminate\Container\Container; use Illuminate\Container\Container;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
/**
* @deprecated
*/
class DisplayException extends PanelException implements HttpExceptionInterface class DisplayException extends PanelException implements HttpExceptionInterface
{ {
public const LEVEL_DEBUG = 'debug'; public const LEVEL_DEBUG = 'debug';
@ -40,6 +43,9 @@ class DisplayException extends PanelException implements HttpExceptionInterface
return Response::HTTP_BAD_REQUEST; return Response::HTTP_BAD_REQUEST;
} }
/**
* @return array<string, string>
*/
public function getHeaders(): array public function getHeaders(): array
{ {
return []; return [];

View File

@ -46,6 +46,8 @@ class Handler extends ExceptionHandler
/** /**
* Maps exceptions to a specific response code. This handles special exception * Maps exceptions to a specific response code. This handles special exception
* types that don't have a defined response code. * types that don't have a defined response code.
*
* @var array<class-string, int>
*/ */
protected static array $exceptionResponseCodes = [ protected static array $exceptionResponseCodes = [
AuthenticationException::class => 401, AuthenticationException::class => 401,
@ -180,6 +182,16 @@ class Handler extends ExceptionHandler
return response()->json(['errors' => $errors], $exception->status); return response()->json(['errors' => $errors], $exception->status);
} }
/**
* @param array<string, mixed> $override
* @return array{errors: array{
* code: string,
* status: string,
* detail: string,
* source?: array{line: int, file: string},
* meta?: array{trace: string[], previous: string[]}
* }}|array{errors: array{non-empty-array<string, mixed>}}
*/
public static function exceptionToArray(Throwable $e, array $override = []): array public static function exceptionToArray(Throwable $e, array $override = []): array
{ {
$match = self::$exceptionResponseCodes[get_class($e)] ?? null; $match = self::$exceptionResponseCodes[get_class($e)] ?? null;
@ -225,6 +237,9 @@ class Handler extends ExceptionHandler
/** /**
* Return the exception as a JSONAPI representation for use on API requests. * Return the exception as a JSONAPI representation for use on API requests.
*
* @param array{detail?: mixed, source?: mixed, meta?: mixed} $override
* @return array{errors?: array<mixed>}
*/ */
protected function convertExceptionToArray(Throwable $e, array $override = []): array protected function convertExceptionToArray(Throwable $e, array $override = []): array
{ {
@ -273,6 +288,8 @@ class Handler extends ExceptionHandler
/** /**
* Helper method to allow reaching into the handler to convert an exception * Helper method to allow reaching into the handler to convert an exception
* into the expected array response type. * into the expected array response type.
*
* @return array<mixed>
*/ */
public static function toArray(\Throwable $e): array public static function toArray(\Throwable $e): array
{ {

View File

@ -42,6 +42,9 @@ class DataValidationException extends PanelException implements HttpExceptionInt
return 500; return 500;
} }
/**
* @return array<string, string>
*/
public function getHeaders(): array public function getHeaders(): array
{ {
return []; return [];

View File

@ -16,17 +16,18 @@ class BackupManager
{ {
/** /**
* The array of resolved backup drivers. * The array of resolved backup drivers.
*
* @var array<string, FilesystemAdapter>
*/ */
protected array $adapters = []; protected array $adapters = [];
/** /**
* The registered custom driver creators. * The registered custom driver creators.
*
* @var array<string, callable>
*/ */
protected array $customCreators; protected array $customCreators;
/**
* BackupManager constructor.
*/
public function __construct(protected Application $app) {} public function __construct(protected Application $app) {}
/** /**
@ -86,6 +87,8 @@ class BackupManager
/** /**
* Calls a custom creator for a given adapter type. * Calls a custom creator for a given adapter type.
*
* @param array{adapter: string} $config
*/ */
protected function callCustomCreator(array $config): mixed protected function callCustomCreator(array $config): mixed
{ {
@ -94,6 +97,8 @@ class BackupManager
/** /**
* Creates a new daemon adapter. * Creates a new daemon adapter.
*
* @param array<string, string> $config
*/ */
public function createWingsAdapter(array $config): FilesystemAdapter public function createWingsAdapter(array $config): FilesystemAdapter
{ {
@ -102,6 +107,8 @@ class BackupManager
/** /**
* Creates a new S3 adapter. * Creates a new S3 adapter.
*
* @param array<string, string> $config
*/ */
public function createS3Adapter(array $config): FilesystemAdapter public function createS3Adapter(array $config): FilesystemAdapter
{ {
@ -118,6 +125,8 @@ class BackupManager
/** /**
* Returns the configuration associated with a given backup type. * Returns the configuration associated with a given backup type.
*
* @return array<mixed>
*/ */
protected function getConfig(string $name): array protected function getConfig(string $name): array
{ {

View File

@ -7,6 +7,9 @@ use League\Flysystem\AwsS3V3\AwsS3V3Adapter;
class S3Filesystem extends AwsS3V3Adapter class S3Filesystem extends AwsS3V3Adapter
{ {
/**
* @param array<mixed> $options
*/
public function __construct( public function __construct(
private S3ClientInterface $client, private S3ClientInterface $client,
private string $bucket, private string $bucket,

View File

@ -8,6 +8,9 @@ class PanelSerializer extends ArraySerializer
{ {
/** /**
* Serialize an item. * Serialize an item.
*
* @param array<mixed> $data
* @return array{object: ?string, attributes: array<mixed>}
*/ */
public function item(?string $resourceKey, array $data): array public function item(?string $resourceKey, array $data): array
{ {
@ -19,6 +22,9 @@ class PanelSerializer extends ArraySerializer
/** /**
* Serialize a collection. * Serialize a collection.
*
* @param array<mixed> $data
* @return array{object: 'list', data: array<mixed>}
*/ */
public function collection(?string $resourceKey, array $data): array public function collection(?string $resourceKey, array $data): array
{ {
@ -35,6 +41,8 @@ class PanelSerializer extends ArraySerializer
/** /**
* Serialize a null resource. * Serialize a null resource.
*
* @return ?array{object: ?string, attributes: null}
*/ */
public function null(): ?array public function null(): ?array
{ {
@ -46,6 +54,10 @@ class PanelSerializer extends ArraySerializer
/** /**
* Merge the included resources with the parent resource being serialized. * Merge the included resources with the parent resource being serialized.
*
* @param array{relationships: array{string, mixed}} $transformedData
* @param array{string, mixed} $includedData
* @return array{relationships: array{string, mixed}}
*/ */
public function mergeIncludes(array $transformedData, array $includedData): array public function mergeIncludes(array $transformedData, array $includedData): array
{ {

View File

@ -2,6 +2,7 @@
namespace App\Extensions\OAuth\Providers; namespace App\Extensions\OAuth\Providers;
use Filament\Forms\Components\Component;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Wizard\Step; use Filament\Forms\Components\Wizard\Step;
use Illuminate\Foundation\Application; use Illuminate\Foundation\Application;
@ -11,8 +12,14 @@ use SocialiteProviders\Manager\SocialiteWasCalled;
abstract class OAuthProvider abstract class OAuthProvider
{ {
/**
* @var array<string, static>
*/
protected static array $providers = []; protected static array $providers = [];
/**
* @return self|static[]
*/
public static function get(?string $id = null): array|self public static function get(?string $id = null): array|self
{ {
return $id ? static::$providers[$id] : static::$providers; return $id ? static::$providers[$id] : static::$providers;
@ -46,6 +53,9 @@ abstract class OAuthProvider
return null; return null;
} }
/**
* @return array<string, string|string[]|bool|null>
*/
public function getServiceConfig(): array public function getServiceConfig(): array
{ {
$id = Str::upper($this->getId()); $id = Str::upper($this->getId());
@ -56,6 +66,9 @@ abstract class OAuthProvider
]; ];
} }
/**
* @return Component[]
*/
public function getSettingsForm(): array public function getSettingsForm(): array
{ {
$id = Str::upper($this->getId()); $id = Str::upper($this->getId());
@ -82,6 +95,9 @@ abstract class OAuthProvider
]; ];
} }
/**
* @return Step[]
*/
public function getSetupSteps(): array public function getSetupSteps(): array
{ {
return [ return [

View File

@ -17,7 +17,7 @@ class Health extends Page
protected static string $view = 'filament.pages.health'; protected static string $view = 'filament.pages.health';
// @phpstan-ignore-next-line /** @var array<string, string> */
protected $listeners = [ protected $listeners = [
'refresh-component' => '$refresh', 'refresh-component' => '$refresh',
]; ];
@ -54,7 +54,7 @@ class Health extends Page
protected function getViewData(): array protected function getViewData(): array
{ {
// @phpstan-ignore-next-line // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
$checkResults = app(ResultStore::class)->latestResults(); $checkResults = app(ResultStore::class)->latestResults();
if ($checkResults === null) { if ($checkResults === null) {
@ -83,7 +83,7 @@ class Health extends Page
public static function getNavigationBadge(): ?string public static function getNavigationBadge(): ?string
{ {
// @phpstan-ignore-next-line // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
$results = app(ResultStore::class)->latestResults(); $results = app(ResultStore::class)->latestResults();
if ($results === null) { if ($results === null) {
@ -106,7 +106,7 @@ class Health extends Page
public static function getNavigationBadgeTooltip(): ?string public static function getNavigationBadgeTooltip(): ?string
{ {
// @phpstan-ignore-next-line // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
$results = app(ResultStore::class)->latestResults(); $results = app(ResultStore::class)->latestResults();
if ($results === null) { if ($results === null) {
@ -128,7 +128,7 @@ class Health extends Page
public static function getNavigationIcon(): string public static function getNavigationIcon(): string
{ {
// @phpstan-ignore-next-line // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
$results = app(ResultStore::class)->latestResults(); $results = app(ResultStore::class)->latestResults();
if ($results === null) { if ($results === null) {

View File

@ -10,6 +10,7 @@ use Exception;
use Filament\Actions\Action; use Filament\Actions\Action;
use Filament\Forms\Components\Actions; use Filament\Forms\Components\Actions;
use Filament\Forms\Components\Actions\Action as FormAction; use Filament\Forms\Components\Actions\Action as FormAction;
use Filament\Forms\Components\Component;
use Filament\Forms\Components\Group; use Filament\Forms\Components\Group;
use Filament\Forms\Components\Hidden; use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\Placeholder; use Filament\Forms\Components\Placeholder;
@ -49,6 +50,7 @@ class Settings extends Page implements HasForms
protected static string $view = 'filament.pages.settings'; protected static string $view = 'filament.pages.settings';
/** @var array<mixed>|null */
public ?array $data = []; public ?array $data = [];
public function mount(): void public function mount(): void
@ -108,6 +110,7 @@ class Settings extends Page implements HasForms
]; ];
} }
/** @return Component[] */
private function generalSettings(): array private function generalSettings(): array
{ {
return [ return [
@ -211,6 +214,9 @@ class Settings extends Page implements HasForms
]; ];
} }
/**
* @return Component[]
*/
private function captchaSettings(): array private function captchaSettings(): array
{ {
return [ return [
@ -256,6 +262,9 @@ class Settings extends Page implements HasForms
]; ];
} }
/**
* @return Component[]
*/
private function mailSettings(): array private function mailSettings(): array
{ {
return [ return [
@ -405,6 +414,9 @@ class Settings extends Page implements HasForms
]; ];
} }
/**
* @return Component[]
*/
private function backupSettings(): array private function backupSettings(): array
{ {
return [ return [
@ -475,6 +487,9 @@ class Settings extends Page implements HasForms
]; ];
} }
/**
* @return Component[]
*/
private function oauthSettings(): array private function oauthSettings(): array
{ {
$formFields = []; $formFields = [];
@ -529,6 +544,9 @@ class Settings extends Page implements HasForms
return $formFields; return $formFields;
} }
/**
* @return Component[]
*/
private function miscSettings(): array private function miscSettings(): array
{ {
return [ return [

View File

@ -38,11 +38,11 @@ class NodeStorageChart extends ChartWidget
protected function getData(): array protected function getData(): array
{ {
$total = config('panel.use_binary_prefix') $total = config('panel.use_binary_prefix')
? ($this->node->statistics()['disk_total'] ?? 0) / 1024 / 1024 / 1024 ? ($this->node->statistics()['disk_total']) / 1024 / 1024 / 1024
: ($this->node->statistics()['disk_total'] ?? 0) / 1000 / 1000 / 1000; : ($this->node->statistics()['disk_total']) / 1000 / 1000 / 1000;
$used = config('panel.use_binary_prefix') $used = config('panel.use_binary_prefix')
? ($this->node->statistics()['disk_used'] ?? 0) / 1024 / 1024 / 1024 ? ($this->node->statistics()['disk_used']) / 1024 / 1024 / 1024
: ($this->node->statistics()['disk_used'] ?? 0) / 1000 / 1000 / 1000; : ($this->node->statistics()['disk_used']) / 1000 / 1000 / 1000;
$unused = $total - $used; $unused = $total - $used;
@ -72,8 +72,8 @@ class NodeStorageChart extends ChartWidget
public function getHeading(): string public function getHeading(): string
{ {
$used = convert_bytes_to_readable($this->node->statistics()['disk_used'] ?? 0); $used = convert_bytes_to_readable($this->node->statistics()['disk_used']);
$total = convert_bytes_to_readable($this->node->statistics()['disk_total'] ?? 0); $total = convert_bytes_to_readable($this->node->statistics()['disk_total']);
return trans('admin/node.disk_chart', ['used' => $used, 'total' => $total]); return trans('admin/node.disk_chart', ['used' => $used, 'total' => $total]);
} }

View File

@ -23,6 +23,7 @@ use Filament\Tables\Actions\ViewAction;
use Filament\Tables\Columns\TextColumn; use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Spatie\Permission\Contracts\Permission;
class RoleResource extends Resource class RoleResource extends Resource
{ {
@ -145,6 +146,9 @@ class RoleResource extends Resource
]); ]);
} }
/**
* @param string[]|int[]|Permission[]|\BackedEnum[] $options
*/
private static function makeSection(string $model, array $options): Section private static function makeSection(string $model, array $options): Section
{ {
$icon = null; $icon = null;

View File

@ -138,7 +138,7 @@ class CreateServer extends CreateRecord
]) ])
->relationship('user', 'username') ->relationship('user', 'username')
->searchable(['username', 'email']) ->searchable(['username', 'email'])
->getOptionLabelFromRecordUsing(fn (User $user) => "$user->email | $user->username " . (blank($user->roles) ? '' : '(' . $user->roles->first()->name . ')')) ->getOptionLabelFromRecordUsing(fn (User $user) => "$user->username ($user->email)")
->createOptionForm([ ->createOptionForm([
TextInput::make('username') TextInput::make('username')
->label(trans('admin/user.username')) ->label(trans('admin/user.username'))
@ -864,6 +864,9 @@ class CreateServer extends CreateRecord
throw new Exception('Component type not supported: ' . $component::class); throw new Exception('Component type not supported: ' . $component::class);
} }
/**
* @return array<array-key, string>
*/
private function getSelectOptionsFromRules(Get $get): array private function getSelectOptionsFromRules(Get $get): array
{ {
$inRule = collect($get('rules'))->reduce( $inRule = collect($get('rules'))->reduce(
@ -878,6 +881,10 @@ class CreateServer extends CreateRecord
->all(); ->all();
} }
/**
* @param string[] $portEntries
* @return array<int>
*/
public static function retrieveValidPorts(Node $node, array $portEntries, string $ip): array public static function retrieveValidPorts(Node $node, array $portEntries, string $ip): array
{ {
$portRangeLimit = AssignmentService::PORT_RANGE_LIMIT; $portRangeLimit = AssignmentService::PORT_RANGE_LIMIT;

View File

@ -119,7 +119,7 @@ class EditServer extends EditRecord
]) ])
->relationship('user', 'username') ->relationship('user', 'username')
->searchable(['username', 'email']) ->searchable(['username', 'email'])
->getOptionLabelFromRecordUsing(fn (User $user) => "$user->email | $user->username " . (blank($user->roles) ? '' : '(' . $user->roles->first()->name . ')')) ->getOptionLabelFromRecordUsing(fn (User $user) => "$user->username ($user->email)")
->preload() ->preload()
->required(), ->required(),
@ -855,7 +855,7 @@ class EditServer extends EditRecord
Forms\Components\Actions::make([ Forms\Components\Actions::make([
Action::make('transfer') Action::make('transfer')
->label(trans('admin/server.transfer')) ->label(trans('admin/server.transfer'))
->action(fn (TransferServerService $transfer, Server $server) => $transfer->handle($server, [])) // ->action(fn (TransferServerService $transfer, Server $server) => $transfer->handle($server, []))
->disabled() //TODO! ->disabled() //TODO!
->form([ //TODO! ->form([ //TODO!
Select::make('newNode') Select::make('newNode')
@ -1014,6 +1014,9 @@ class EditServer extends EditRecord
throw new Exception('Component type not supported: ' . $component::class); throw new Exception('Component type not supported: ' . $component::class);
} }
/**
* @return array<string, string>
*/
private function getSelectOptionsFromRules(ServerVariable $serverVariable): array private function getSelectOptionsFromRules(ServerVariable $serverVariable): array
{ {
$inRule = array_first($serverVariable->variable->rules, fn ($value) => str($value)->startsWith('in:')); $inRule = array_first($serverVariable->variable->rules, fn ($value) => str($value)->startsWith('in:'));

View File

@ -16,6 +16,8 @@ use Filament\Actions\Action;
use Filament\Facades\Filament; use Filament\Facades\Filament;
use Filament\Pages\Page; use Filament\Pages\Page;
use Filament\Support\Enums\ActionSize; use Filament\Support\Enums\ActionSize;
use Filament\Widgets\Widget;
use Filament\Widgets\WidgetConfiguration;
use Livewire\Attributes\On; use Livewire\Attributes\On;
class Console extends Page class Console extends Page
@ -52,6 +54,9 @@ class Console extends Page
]; ];
} }
/**
* @return class-string<Widget>[]
*/
public function getWidgets(): array public function getWidgets(): array
{ {
return [ return [
@ -63,12 +68,15 @@ class Console extends Page
]; ];
} }
/**
* @return array<class-string<Widget> | WidgetConfiguration>
*/
public function getVisibleWidgets(): array public function getVisibleWidgets(): array
{ {
return $this->filterVisibleWidgets($this->getWidgets()); return $this->filterVisibleWidgets($this->getWidgets());
} }
public function getColumns(): int|string|array public function getColumns(): int
{ {
return 3; return 3;
} }

View File

@ -19,6 +19,7 @@ abstract class ServerFormPage extends Page
protected static string $view = 'filament.server.pages.server-form-page'; protected static string $view = 'filament.server.pages.server-form-page';
/** @var ?array<mixed> */
public ?array $data = []; public ?array $data = [];
public function mount(): void public function mount(): void

View File

@ -176,6 +176,9 @@ class Startup extends ServerFormPage
throw new \Exception('Component type not supported: ' . $component::class); throw new \Exception('Component type not supported: ' . $component::class);
} }
/**
* @return string[]
*/
private function getSelectOptionsFromRules(ServerVariable $serverVariable): array private function getSelectOptionsFromRules(ServerVariable $serverVariable): array
{ {
$inRule = array_first($serverVariable->variable->rules, fn ($value) => str($value)->startsWith('in:')); $inRule = array_first($serverVariable->variable->rules, fn ($value) => str($value)->startsWith('in:'));

View File

@ -6,6 +6,7 @@ use App\Filament\Components\Forms\Actions\RotateDatabasePasswordAction;
use App\Filament\Components\Tables\Columns\DateTimeColumn; use App\Filament\Components\Tables\Columns\DateTimeColumn;
use App\Filament\Server\Resources\DatabaseResource; use App\Filament\Server\Resources\DatabaseResource;
use App\Models\Database; use App\Models\Database;
use App\Models\DatabaseHost;
use App\Models\Permission; use App\Models\Permission;
use App\Models\Server; use App\Models\Server;
use App\Services\Databases\DatabaseManagementService; use App\Services\Databases\DatabaseManagementService;
@ -98,7 +99,7 @@ class ListDatabases extends ListRecords
->columnSpan(2) ->columnSpan(2)
->required() ->required()
->placeholder('Select Database Host') ->placeholder('Select Database Host')
->options(fn () => $server->node->databaseHosts->mapWithKeys(fn ($databaseHost) => [$databaseHost->id => $databaseHost->name])), ->options(fn () => $server->node->databaseHosts->mapWithKeys(fn (DatabaseHost $databaseHost) => [$databaseHost->id => $databaseHost->name])),
TextInput::make('database') TextInput::make('database')
->columnSpan(1) ->columnSpan(1)
->label('Database Name') ->label('Database Name')

View File

@ -45,6 +45,7 @@ class EditFiles extends Page
#[Locked] #[Locked]
public string $path; public string $path;
/** @var array<mixed> */
public ?array $data = []; public ?array $data = [];
public function form(Form $form): Form public function form(Form $form): Form

View File

@ -542,6 +542,9 @@ class ListFiles extends ListRecords
); );
} }
/**
* @return string[]
*/
private function getPermissionsFromModeBit(int $mode): array private function getPermissionsFromModeBit(int $mode): array
{ {
if ($mode === 1) { if ($mode === 1) {

View File

@ -5,6 +5,7 @@ namespace App\Filament\Server\Resources\ScheduleResource\RelationManagers;
use App\Facades\Activity; use App\Facades\Activity;
use App\Models\Schedule; use App\Models\Schedule;
use App\Models\Task; use App\Models\Task;
use Filament\Forms\Components\Field;
use Filament\Tables\Actions\DeleteAction; use Filament\Tables\Actions\DeleteAction;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea; use Filament\Forms\Components\Textarea;
@ -22,6 +23,9 @@ class TasksRelationManager extends RelationManager
{ {
protected static string $relationship = 'tasks'; protected static string $relationship = 'tasks';
/**
* @return array<array-key, string>
*/
private function getActionOptions(bool $full = true): array private function getActionOptions(bool $full = true): array
{ {
return [ return [
@ -32,6 +36,9 @@ class TasksRelationManager extends RelationManager
]; ];
} }
/**
* @return array<Field>
*/
private function getTaskForm(Schedule $schedule): array private function getTaskForm(Schedule $schedule): array
{ {
return [ return [

View File

@ -25,6 +25,7 @@ class ServerConsole extends Widget
public ?User $user = null; public ?User $user = null;
/** @var string[] */
public array $history = []; public array $history = [];
public int $historyIndex = 0; public int $historyIndex = 0;

View File

@ -31,6 +31,8 @@ class DatabaseHostController extends ApplicationApiController
* List database hosts * List database hosts
* *
* Return all the database hosts currently registered on the Panel. * Return all the database hosts currently registered on the Panel.
*
* @return array<mixed>
*/ */
public function index(GetDatabaseHostRequest $request): array public function index(GetDatabaseHostRequest $request): array
{ {
@ -48,6 +50,8 @@ class DatabaseHostController extends ApplicationApiController
* View database host * View database host
* *
* Return a single database host. * Return a single database host.
*
* @return array<mixed>
*/ */
public function view(GetDatabaseHostRequest $request, DatabaseHost $databaseHost): array public function view(GetDatabaseHostRequest $request, DatabaseHost $databaseHost): array
{ {
@ -83,6 +87,8 @@ class DatabaseHostController extends ApplicationApiController
* *
* Update a database host on the Panel and return the updated record to the user. * Update a database host on the Panel and return the updated record to the user.
* *
* @return array<mixed>
*
* @throws \Throwable * @throws \Throwable
*/ */
public function update(UpdateDatabaseHostRequest $request, DatabaseHost $databaseHost): array public function update(UpdateDatabaseHostRequest $request, DatabaseHost $databaseHost): array

View File

@ -14,6 +14,8 @@ class EggController extends ApplicationApiController
* List eggs * List eggs
* *
* Return all eggs * Return all eggs
*
* @return array<mixed>
*/ */
public function index(GetEggsRequest $request): array public function index(GetEggsRequest $request): array
{ {
@ -26,6 +28,8 @@ class EggController extends ApplicationApiController
* View egg * View egg
* *
* Return a single egg that exists * Return a single egg that exists
*
* @return array<mixed>
*/ */
public function view(GetEggRequest $request, Egg $egg): array public function view(GetEggRequest $request, Egg $egg): array
{ {

View File

@ -21,6 +21,8 @@ class MountController extends ApplicationApiController
* List mounts * List mounts
* *
* Return all the mounts currently available on the Panel. * Return all the mounts currently available on the Panel.
*
* @return array<array-key, mixed>
*/ */
public function index(GetMountRequest $request): array public function index(GetMountRequest $request): array
{ {
@ -38,6 +40,8 @@ class MountController extends ApplicationApiController
* View mount * View mount
* *
* Return data for a single instance of a mount. * Return data for a single instance of a mount.
*
* @return array<array-key, mixed>
*/ */
public function view(GetMountRequest $request, Mount $mount): array public function view(GetMountRequest $request, Mount $mount): array
{ {
@ -77,6 +81,8 @@ class MountController extends ApplicationApiController
* *
* Update an existing mount on the Panel. * Update an existing mount on the Panel.
* *
* @return array<array-key, mixed>
*
* @throws \Throwable * @throws \Throwable
*/ */
public function update(UpdateMountRequest $request, Mount $mount): array public function update(UpdateMountRequest $request, Mount $mount): array
@ -111,6 +117,8 @@ class MountController extends ApplicationApiController
* Assign eggs to mount * Assign eggs to mount
* *
* Adds eggs to the mount's many-to-many relation. * Adds eggs to the mount's many-to-many relation.
*
* @return array<array-key, mixed>
*/ */
public function addEggs(Request $request, Mount $mount): array public function addEggs(Request $request, Mount $mount): array
{ {
@ -132,6 +140,8 @@ class MountController extends ApplicationApiController
* Assign mounts to mount * Assign mounts to mount
* *
* Adds nodes to the mount's many-to-many relation. * Adds nodes to the mount's many-to-many relation.
*
* @return array<array-key, mixed>
*/ */
public function addNodes(Request $request, Mount $mount): array public function addNodes(Request $request, Mount $mount): array
{ {

View File

@ -32,6 +32,8 @@ class AllocationController extends ApplicationApiController
* List allocations * List allocations
* *
* Return all the allocations that exist for a given node. * Return all the allocations that exist for a given node.
*
* @return array<mixed>
*/ */
public function index(GetAllocationsRequest $request, Node $node): array public function index(GetAllocationsRequest $request, Node $node): array
{ {

View File

@ -35,6 +35,8 @@ class NodeController extends ApplicationApiController
* List nodes * List nodes
* *
* Return all the nodes currently available on the Panel. * Return all the nodes currently available on the Panel.
*
* @return array<mixed>
*/ */
public function index(GetNodesRequest $request): array public function index(GetNodesRequest $request): array
{ {
@ -52,6 +54,8 @@ class NodeController extends ApplicationApiController
* View node * View node
* *
* Return data for a single instance of a node. * Return data for a single instance of a node.
*
* @return array<mixed>
*/ */
public function view(GetNodeRequest $request, Node $node): array public function view(GetNodeRequest $request, Node $node): array
{ {
@ -87,6 +91,8 @@ class NodeController extends ApplicationApiController
* *
* Update an existing node on the Panel. * Update an existing node on the Panel.
* *
* @return array<mixed>
*
* @throws \Throwable * @throws \Throwable
*/ */
public function update(UpdateNodeRequest $request, Node $node): array public function update(UpdateNodeRequest $request, Node $node): array

View File

@ -22,6 +22,8 @@ class NodeDeploymentController extends ApplicationApiController
* Finds any nodes that are available using the given deployment criteria. This works * Finds any nodes that are available using the given deployment criteria. This works
* similarly to the server creation process, but allows you to pass the deployment object * similarly to the server creation process, but allows you to pass the deployment object
* to this endpoint and get back a list of all Nodes satisfying the requirements. * to this endpoint and get back a list of all Nodes satisfying the requirements.
*
* @return array<mixed>
*/ */
public function __invoke(GetDeployableNodesRequest $request): array public function __invoke(GetDeployableNodesRequest $request): array
{ {

View File

@ -20,6 +20,8 @@ class RoleController extends ApplicationApiController
* List roles * List roles
* *
* Return all the roles currently registered on the Panel. * Return all the roles currently registered on the Panel.
*
* @return array<array-key, mixed>
*/ */
public function index(GetRoleRequest $request): array public function index(GetRoleRequest $request): array
{ {
@ -37,6 +39,8 @@ class RoleController extends ApplicationApiController
* View role * View role
* *
* Return a single role. * Return a single role.
*
* @return array<array-key, mixed>
*/ */
public function view(GetRoleRequest $request, Role $role): array public function view(GetRoleRequest $request, Role $role): array
{ {
@ -72,6 +76,8 @@ class RoleController extends ApplicationApiController
* *
* Update a role on the Panel and return the updated record to the user. * Update a role on the Panel and return the updated record to the user.
* *
* @return array<array-key, mixed>
*
* @throws \Throwable * @throws \Throwable
*/ */
public function update(UpdateRoleRequest $request, Role $role): array public function update(UpdateRoleRequest $request, Role $role): array

View File

@ -32,8 +32,9 @@ class DatabaseController extends ApplicationApiController
/** /**
* List databases * List databases
* *
* Return a listing of all databases currently available to a single * Return a listing of all databases currently available to a single server.
* server. *
* @return array<array-key, mixed>
*/ */
public function index(GetServerDatabasesRequest $request, Server $server): array public function index(GetServerDatabasesRequest $request, Server $server): array
{ {
@ -46,6 +47,8 @@ class DatabaseController extends ApplicationApiController
* View database * View database
* *
* Return a single server database. * Return a single server database.
*
* @return array<array-key, mixed>
*/ */
public function view(GetServerDatabaseRequest $request, Server $server, Database $database): array public function view(GetServerDatabaseRequest $request, Server $server, Database $database): array
{ {

View File

@ -15,6 +15,8 @@ class ExternalServerController extends ApplicationApiController
* View server (external id) * View server (external id)
* *
* Retrieve a specific server from the database using its external ID. * Retrieve a specific server from the database using its external ID.
*
* @return array<array-key, mixed>
*/ */
public function index(GetExternalServerRequest $request, string $external_id): array public function index(GetExternalServerRequest $request, string $external_id): array
{ {

View File

@ -33,6 +33,8 @@ class ServerController extends ApplicationApiController
* List servers * List servers
* *
* Return all the servers that currently exist on the Panel. * Return all the servers that currently exist on the Panel.
*
* @return array<array-key, mixed>
*/ */
public function index(GetServersRequest $request): array public function index(GetServersRequest $request): array
{ {
@ -70,6 +72,8 @@ class ServerController extends ApplicationApiController
* View server * View server
* *
* Show a single server transformed for the application API. * Show a single server transformed for the application API.
*
* @return array<array-key, mixed>
*/ */
public function view(GetServerRequest $request, Server $server): array public function view(GetServerRequest $request, Server $server): array
{ {

View File

@ -29,14 +29,19 @@ class ServerDetailsController extends ApplicationApiController
* *
* Update the details for a specific server. * Update the details for a specific server.
* *
* @return array<array-key, mixed>
*
* @throws \App\Exceptions\DisplayException * @throws \App\Exceptions\DisplayException
* @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Model\DataValidationException
*/ */
public function details(UpdateServerDetailsRequest $request, Server $server): array public function details(UpdateServerDetailsRequest $request, Server $server): array
{ {
/** @var array<array-key, mixed> $validated */
$validated = $request->validated();
$updated = $this->detailsModificationService->returnUpdatedModel()->handle( $updated = $this->detailsModificationService->returnUpdatedModel()->handle(
$server, $server,
$request->validated() $validated,
); );
return $this->fractal->item($updated) return $this->fractal->item($updated)
@ -49,6 +54,8 @@ class ServerDetailsController extends ApplicationApiController
* *
* Update the build details for a specific server. * Update the build details for a specific server.
* *
* @return array<array-key, mixed>
*
* @throws \App\Exceptions\DisplayException * @throws \App\Exceptions\DisplayException
* @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Model\DataValidationException
*/ */

View File

@ -29,6 +29,8 @@ class StartupController extends ApplicationApiController
* *
* Update the startup and environment settings for a specific server. * Update the startup and environment settings for a specific server.
* *
* @return array<array-key, mixed>
*
* @throws ValidationException * @throws ValidationException
* @throws ConnectionException * @throws ConnectionException
* @throws DataValidationException * @throws DataValidationException

View File

@ -15,10 +15,12 @@ class ExternalUserController extends ApplicationApiController
* View user (external id) * View user (external id)
* *
* Retrieve a specific user from the database using their external ID. * Retrieve a specific user from the database using their external ID.
*
* @return array<mixed>
*/ */
public function index(GetExternalUserRequest $request, string $external_id): array public function index(GetExternalUserRequest $request, string $externalId): array
{ {
$user = User::query()->where('external_id', $external_id)->firstOrFail(); $user = User::query()->where('external_id', $externalId)->firstOrFail();
return $this->fractal->item($user) return $this->fractal->item($user)
->transformWith($this->getTransformer(UserTransformer::class)) ->transformWith($this->getTransformer(UserTransformer::class))

View File

@ -36,6 +36,8 @@ class UserController extends ApplicationApiController
* Handle request to list all users on the panel. Returns a JSON-API representation * Handle request to list all users on the panel. Returns a JSON-API representation
* of a collection of users including any defined relations passed in * of a collection of users including any defined relations passed in
* the request. * the request.
*
* @return array<array-key, mixed>
*/ */
public function index(GetUsersRequest $request): array public function index(GetUsersRequest $request): array
{ {
@ -54,6 +56,8 @@ class UserController extends ApplicationApiController
* *
* Handle a request to view a single user. Includes any relations that * Handle a request to view a single user. Includes any relations that
* were defined in the request. * were defined in the request.
*
* @return array<array-key, mixed>
*/ */
public function view(GetUsersRequest $request, User $user): array public function view(GetUsersRequest $request, User $user): array
{ {
@ -72,6 +76,8 @@ class UserController extends ApplicationApiController
* Revocation errors are returned under the 'revocation_errors' key in the response * Revocation errors are returned under the 'revocation_errors' key in the response
* meta. If there are no errors this is an empty array. * meta. If there are no errors this is an empty array.
* *
* @return array<array-key, mixed>
*
* @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Model\DataValidationException
*/ */
public function update(UpdateUserRequest $request, User $user): array public function update(UpdateUserRequest $request, User $user): array
@ -89,6 +95,8 @@ class UserController extends ApplicationApiController
* Assign role to user * Assign role to user
* *
* Assign roles to a user. * Assign roles to a user.
*
* @return array<array-key, mixed>
*/ */
public function assignRoles(AssignUserRolesRequest $request, User $user): array public function assignRoles(AssignUserRolesRequest $request, User $user): array
{ {
@ -110,6 +118,8 @@ class UserController extends ApplicationApiController
* Unassign role from user * Unassign role from user
* *
* Removes roles from a user. * Removes roles from a user.
*
* @return array<array-key, mixed>
*/ */
public function removeRoles(AssignUserRolesRequest $request, User $user): array public function removeRoles(AssignUserRolesRequest $request, User $user): array
{ {

View File

@ -25,6 +25,8 @@ class AccountController extends ClientApiController
/** /**
* View account * View account
*
* @return array<array-key, mixed>
*/ */
public function index(Request $request): array public function index(Request $request): array
{ {

View File

@ -14,6 +14,8 @@ class ActivityLogController extends ClientApiController
* List activity logs * List activity logs
* *
* Returns a paginated set of the user's activity logs. * Returns a paginated set of the user's activity logs.
*
* @return array<array-key, mixed>
*/ */
public function __invoke(ClientApiRequest $request): array public function __invoke(ClientApiRequest $request): array
{ {

View File

@ -16,6 +16,8 @@ class ApiKeyController extends ClientApiController
* List api keys * List api keys
* *
* Returns all the API keys that exist for the given client. * Returns all the API keys that exist for the given client.
*
* @return array<array-key, mixed>
*/ */
public function index(ClientApiRequest $request): array public function index(ClientApiRequest $request): array
{ {
@ -29,6 +31,8 @@ class ApiKeyController extends ClientApiController
* *
* Store a new API key for a user's account. * Store a new API key for a user's account.
* *
* @return array<array-key, mixed>
*
* @throws \App\Exceptions\DisplayException * @throws \App\Exceptions\DisplayException
*/ */
public function store(StoreApiKeyRequest $request): array public function store(StoreApiKeyRequest $request): array

View File

@ -10,6 +10,9 @@ abstract class ClientApiController extends ApplicationApiController
{ {
/** /**
* Returns only the includes which are valid for the given transformer. * Returns only the includes which are valid for the given transformer.
*
* @param array<mixed> $merge
* @return array<array-key, mixed>
*/ */
protected function getIncludesForTransformer(BaseClientTransformer $transformer, array $merge = []): array protected function getIncludesForTransformer(BaseClientTransformer $transformer, array $merge = []): array
{ {
@ -22,6 +25,8 @@ abstract class ClientApiController extends ApplicationApiController
/** /**
* Returns the parsed includes for this request. * Returns the parsed includes for this request.
*
* @return array<array-key, mixed>
*/ */
protected function parseIncludes(): array protected function parseIncludes(): array
{ {

View File

@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api\Client;
use App\Models\Server; use App\Models\Server;
use App\Models\Permission; use App\Models\Permission;
use Illuminate\Support\Collection;
use Spatie\QueryBuilder\QueryBuilder; use Spatie\QueryBuilder\QueryBuilder;
use Spatie\QueryBuilder\AllowedFilter; use Spatie\QueryBuilder\AllowedFilter;
use App\Models\Filters\MultiFieldServerFilter; use App\Models\Filters\MultiFieldServerFilter;
@ -27,6 +28,8 @@ class ClientController extends ClientApiController
* *
* Return all the servers available to the client making the API * Return all the servers available to the client making the API
* request, including servers the user has access to as a subuser. * request, including servers the user has access to as a subuser.
*
* @return array<array-key, mixed>
*/ */
public function index(GetServersRequest $request): array public function index(GetServersRequest $request): array
{ {
@ -74,6 +77,8 @@ class ClientController extends ClientApiController
* List subuser permissions * List subuser permissions
* *
* Returns all the subuser permissions available on the system. * Returns all the subuser permissions available on the system.
*
* @return array{object: string, attributes: array{permissions: Collection}}
*/ */
public function permissions(): array public function permissions(): array
{ {

View File

@ -2,6 +2,7 @@
namespace App\Http\Controllers\Api\Client; namespace App\Http\Controllers\Api\Client;
use App\Models\UserSSHKey;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use App\Facades\Activity; use App\Facades\Activity;
use App\Http\Requests\Api\Client\ClientApiRequest; use App\Http\Requests\Api\Client\ClientApiRequest;
@ -13,8 +14,9 @@ class SSHKeyController extends ClientApiController
/** /**
* List ssh keys * List ssh keys
* *
* Returns all the SSH keys that have been configured for the logged-in * Returns all the SSH keys that have been configured for the logged-in user account.
* user account. *
* @return array<array-key, mixed>
*/ */
public function index(ClientApiRequest $request): array public function index(ClientApiRequest $request): array
{ {
@ -27,6 +29,8 @@ class SSHKeyController extends ClientApiController
* Create ssh keys * Create ssh keys
* *
* Stores a new SSH key for the authenticated user's account. * Stores a new SSH key for the authenticated user's account.
*
* @return array<array-key, mixed>
*/ */
public function store(StoreSSHKeyRequest $request): array public function store(StoreSSHKeyRequest $request): array
{ {
@ -55,6 +59,7 @@ class SSHKeyController extends ClientApiController
{ {
$request->validate(['fingerprint' => ['required', 'string']]); $request->validate(['fingerprint' => ['required', 'string']]);
/** @var ?UserSSHKey $key */
$key = $request->user()->sshKeys() $key = $request->user()->sshKeys()
->where('fingerprint', $request->input('fingerprint')) ->where('fingerprint', $request->input('fingerprint'))
->first(); ->first();

View File

@ -24,6 +24,8 @@ class ActivityLogController extends ClientApiController
* List activity logs * List activity logs
* *
* Returns the activity logs for a server. * Returns the activity logs for a server.
*
* @return array<array-key, mixed>
*/ */
public function __invoke(ClientApiRequest $request, Server $server): array public function __invoke(ClientApiRequest $request, Server $server): array
{ {

View File

@ -36,8 +36,9 @@ class BackupController extends ClientApiController
/** /**
* List backups * List backups
* *
* Returns all the backups for a given server instance in a paginated * Returns all the backups for a given server instance in a paginated result set.
* result set. *
* @return array<array-key, mixed>
* *
* @throws AuthorizationException * @throws AuthorizationException
*/ */
@ -62,6 +63,8 @@ class BackupController extends ClientApiController
* *
* Starts the backup process for a server. * Starts the backup process for a server.
* *
* @return array<array-key, mixed>
*
* @throws \Spatie\Fractalistic\Exceptions\InvalidTransformation * @throws \Spatie\Fractalistic\Exceptions\InvalidTransformation
* @throws \Spatie\Fractalistic\Exceptions\NoTransformerSpecified * @throws \Spatie\Fractalistic\Exceptions\NoTransformerSpecified
* @throws \Throwable * @throws \Throwable
@ -96,6 +99,8 @@ class BackupController extends ClientApiController
* *
* Toggles the lock status of a given backup for a server. * Toggles the lock status of a given backup for a server.
* *
* @return array<array-key, mixed>
*
* @throws \Throwable * @throws \Throwable
* @throws \Illuminate\Auth\Access\AuthorizationException * @throws \Illuminate\Auth\Access\AuthorizationException
*/ */
@ -121,6 +126,8 @@ class BackupController extends ClientApiController
* *
* Returns information about a single backup. * Returns information about a single backup.
* *
* @return array<array-key, mixed>
*
* @throws \Illuminate\Auth\Access\AuthorizationException * @throws \Illuminate\Auth\Access\AuthorizationException
*/ */
public function view(Request $request, Server $server, Backup $backup): array public function view(Request $request, Server $server, Backup $backup): array

View File

@ -35,6 +35,8 @@ class DatabaseController extends ClientApiController
* List databases * List databases
* *
* Return all the databases that belong to the given server. * Return all the databases that belong to the given server.
*
* @return array<string, mixed>
*/ */
public function index(GetDatabasesRequest $request, Server $server): array public function index(GetDatabasesRequest $request, Server $server): array
{ {
@ -48,6 +50,8 @@ class DatabaseController extends ClientApiController
* *
* Create a new database for the given server and return it. * Create a new database for the given server and return it.
* *
* @return array<string, mixed>
*
* @throws \Throwable * @throws \Throwable
* @throws \App\Exceptions\Service\Database\TooManyDatabasesException * @throws \App\Exceptions\Service\Database\TooManyDatabasesException
* @throws \App\Exceptions\Service\Database\DatabaseClientFeatureNotEnabledException * @throws \App\Exceptions\Service\Database\DatabaseClientFeatureNotEnabledException
@ -73,6 +77,8 @@ class DatabaseController extends ClientApiController
* Rotates the password for the given server model and returns a fresh instance to * Rotates the password for the given server model and returns a fresh instance to
* the caller. * the caller.
* *
* @return array<array-key, mixed>
*
* @throws \Throwable * @throws \Throwable
*/ */
public function rotatePassword(RotatePasswordRequest $request, Server $server, Database $database): array public function rotatePassword(RotatePasswordRequest $request, Server $server, Database $database): array

View File

@ -43,6 +43,8 @@ class FileController extends ClientApiController
* *
* Returns a listing of files in a given directory. * Returns a listing of files in a given directory.
* *
* @return array<array-key, mixed>
*
* @throws ConnectionException * @throws ConnectionException
*/ */
public function directory(ListFilesRequest $request, Server $server): array public function directory(ListFilesRequest $request, Server $server): array
@ -80,8 +82,9 @@ class FileController extends ClientApiController
/** /**
* Download file * Download file
* *
* Generates a one-time token with a link that the user can use to * Generates a one-time token with a link that the user can use to download a given file.
* download a given file. *
* @return array<array-key, mixed>
* *
* @throws \Throwable * @throws \Throwable
*/ */
@ -199,6 +202,8 @@ class FileController extends ClientApiController
/** /**
* Compress files * Compress files
* *
* @return array<array-key, mixed>
*
* @throws ConnectionException * @throws ConnectionException
*/ */
public function compress(CompressFilesRequest $request, Server $server): array public function compress(CompressFilesRequest $request, Server $server): array

View File

@ -34,6 +34,8 @@ class NetworkAllocationController extends ClientApiController
* *
* Lists all the allocations available to a server and whether * Lists all the allocations available to a server and whether
* they are currently assigned as the primary for this server. * they are currently assigned as the primary for this server.
*
* @return array<array-key, mixed>
*/ */
public function index(GetNetworkRequest $request, Server $server): array public function index(GetNetworkRequest $request, Server $server): array
{ {
@ -47,6 +49,8 @@ class NetworkAllocationController extends ClientApiController
* *
* Set the primary allocation for a server. * Set the primary allocation for a server.
* *
* @return array<array-key, mixed>
*
* @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Model\DataValidationException
*/ */
public function update(UpdateAllocationRequest $request, Server $server, Allocation $allocation): array public function update(UpdateAllocationRequest $request, Server $server, Allocation $allocation): array
@ -68,10 +72,12 @@ class NetworkAllocationController extends ClientApiController
} }
/** /**
* Set primar< * Set primary allocation
* *
* Set the primary allocation for a server. * Set the primary allocation for a server.
* *
* @return array<array-key, mixed>
*
* @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Model\DataValidationException
*/ */
public function setPrimary(SetPrimaryAllocationRequest $request, Server $server, Allocation $allocation): array public function setPrimary(SetPrimaryAllocationRequest $request, Server $server, Allocation $allocation): array
@ -94,6 +100,8 @@ class NetworkAllocationController extends ClientApiController
* *
* Set the notes for the allocation for a server. * Set the notes for the allocation for a server.
* *
* @return array<array-key, mixed>
*
* @throws \App\Exceptions\DisplayException * @throws \App\Exceptions\DisplayException
*/ */
public function store(NewAllocationRequest $request, Server $server): array public function store(NewAllocationRequest $request, Server $server): array

View File

@ -30,6 +30,8 @@ class ResourceUtilizationController extends ClientApiController
* 20 seconds at a time to ensure that repeated requests to this endpoint do not cause * 20 seconds at a time to ensure that repeated requests to this endpoint do not cause
* a flood of unnecessary API calls. * a flood of unnecessary API calls.
* *
* @return array<array-key, mixed>
*
* @throws ConnectionException * @throws ConnectionException
*/ */
public function __invoke(GetServerRequest $request, Server $server): array public function __invoke(GetServerRequest $request, Server $server): array

View File

@ -38,6 +38,8 @@ class ScheduleController extends ClientApiController
* List schedules * List schedules
* *
* Returns all the schedules belonging to a given server. * Returns all the schedules belonging to a given server.
*
* @return array<array-key, mixed>
*/ */
public function index(ViewScheduleRequest $request, Server $server): array public function index(ViewScheduleRequest $request, Server $server): array
{ {
@ -53,6 +55,8 @@ class ScheduleController extends ClientApiController
* *
* Store a new schedule for a server. * Store a new schedule for a server.
* *
* @return array<array-key, mixed>
*
* @throws \App\Exceptions\DisplayException * @throws \App\Exceptions\DisplayException
* @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Model\DataValidationException
*/ */
@ -86,6 +90,8 @@ class ScheduleController extends ClientApiController
* View schedule * View schedule
* *
* Returns a specific schedule for the server. * Returns a specific schedule for the server.
*
* @return array<array-key, mixed>
*/ */
public function view(ViewScheduleRequest $request, Server $server, Schedule $schedule): array public function view(ViewScheduleRequest $request, Server $server, Schedule $schedule): array
{ {
@ -105,6 +111,8 @@ class ScheduleController extends ClientApiController
* *
* Updates a given schedule with the new data provided. * Updates a given schedule with the new data provided.
* *
* @return array<array-key, mixed>
*
* @throws \App\Exceptions\DisplayException * @throws \App\Exceptions\DisplayException
* @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Model\DataValidationException
*/ */

View File

@ -36,6 +36,8 @@ class ScheduleTaskController extends ClientApiController
* *
* Create a new task for a given schedule and store it in the database. * Create a new task for a given schedule and store it in the database.
* *
* @return array<array-key, mixed>
*
* @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Model\DataValidationException
* @throws \App\Exceptions\Service\ServiceLimitExceededException * @throws \App\Exceptions\Service\ServiceLimitExceededException
*/ */
@ -99,6 +101,8 @@ class ScheduleTaskController extends ClientApiController
* *
* Updates a given task for a server. * Updates a given task for a server.
* *
* @return array<array-key, mixed>
*
* @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Model\DataValidationException
*/ */
public function update(StoreTaskRequest $request, Server $server, Schedule $schedule, Task $task): array public function update(StoreTaskRequest $request, Server $server, Schedule $schedule, Task $task): array

View File

@ -12,9 +12,6 @@ use Dedoc\Scramble\Attributes\Group;
#[Group('Server', weight: 0)] #[Group('Server', weight: 0)]
class ServerController extends ClientApiController class ServerController extends ClientApiController
{ {
/**
* ServerController constructor.
*/
public function __construct(private GetUserPermissionsService $permissionsService) public function __construct(private GetUserPermissionsService $permissionsService)
{ {
parent::__construct(); parent::__construct();
@ -23,8 +20,9 @@ class ServerController extends ClientApiController
/** /**
* View server * View server
* *
* Transform an individual server into a response that can be consumed by a * Transform an individual server into a response that can be consumed by a client using the API.
* client using the API. *
* @return array<array-key, mixed>
*/ */
public function index(GetServerRequest $request, Server $server): array public function index(GetServerRequest $request, Server $server): array
{ {

View File

@ -29,6 +29,8 @@ class StartupController extends ClientApiController
* List startup variables * List startup variables
* *
* Returns the startup information for the server including all the variables. * Returns the startup information for the server including all the variables.
*
* @return array<array-key, mixed>
*/ */
public function index(GetStartupRequest $request, Server $server): array public function index(GetStartupRequest $request, Server $server): array
{ {
@ -51,6 +53,8 @@ class StartupController extends ClientApiController
* *
* Updates a single variable for a server. * Updates a single variable for a server.
* *
* @return array<array-key, mixed>
*
* @throws \Illuminate\Validation\ValidationException * @throws \Illuminate\Validation\ValidationException
* @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Model\DataValidationException
*/ */

View File

@ -37,6 +37,8 @@ class SubuserController extends ClientApiController
* List subusers * List subusers
* *
* Return the users associated with this server instance. * Return the users associated with this server instance.
*
* @return array<array-key, mixed>
*/ */
public function index(GetSubuserRequest $request, Server $server): array public function index(GetSubuserRequest $request, Server $server): array
{ {
@ -49,6 +51,8 @@ class SubuserController extends ClientApiController
* View subusers * View subusers
* *
* Returns a single subuser associated with this server instance. * Returns a single subuser associated with this server instance.
*
* @return array<array-key, mixed>
*/ */
public function view(GetSubuserRequest $request, Server $server, User $user): array public function view(GetSubuserRequest $request, Server $server, User $user): array
{ {
@ -64,6 +68,8 @@ class SubuserController extends ClientApiController
* *
* Create a new subuser for the given server. * Create a new subuser for the given server.
* *
* @return array<array-key, mixed>
*
* @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Model\DataValidationException
* @throws \App\Exceptions\Service\Subuser\ServerSubuserExistsException * @throws \App\Exceptions\Service\Subuser\ServerSubuserExistsException
* @throws \App\Exceptions\Service\Subuser\UserIsServerOwnerException * @throws \App\Exceptions\Service\Subuser\UserIsServerOwnerException
@ -92,6 +98,8 @@ class SubuserController extends ClientApiController
* *
* Update a given subuser in the system for the server. * Update a given subuser in the system for the server.
* *
* @return array<array-key, mixed>
*
* @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Model\DataValidationException
*/ */
public function update(UpdateSubuserRequest $request, Server $server, User $user): array public function update(UpdateSubuserRequest $request, Server $server, User $user): array
@ -125,6 +133,8 @@ class SubuserController extends ClientApiController
* Returns the default permissions for subusers and parses out any permissions * Returns the default permissions for subusers and parses out any permissions
* that were passed that do not also exist in the internally tracked list of * that were passed that do not also exist in the internally tracked list of
* permissions. * permissions.
*
* @return array<array-key, mixed>
*/ */
protected function getDefaultPermissions(Request $request): array protected function getDefaultPermissions(Request $request): array
{ {

View File

@ -104,8 +104,9 @@ class BackupStatusController extends Controller
} }
/** /**
* Marks a multipart upload in a given S3-compatible instance as failed or successful for * Marks a multipart upload in a given S3-compatible instance as failed or successful for the given backup.
* the given backup. *
* @param ?array<array{int, etag: string, part_number: string}> $parts
* *
* @throws \Exception * @throws \Exception
* @throws \App\Exceptions\DisplayException * @throws \App\Exceptions\DisplayException

View File

@ -11,6 +11,8 @@ class AuthenticateServerAccess
{ {
/** /**
* Routes that this middleware should not apply to if the user is an admin. * Routes that this middleware should not apply to if the user is an admin.
*
* @var string[]
*/ */
protected array $except = [ protected array $except = [
'api:client:server.ws', 'api:client:server.ws',

View File

@ -37,7 +37,7 @@ class ResourceBelongsToServer
$server = $request->route()->parameter('server'); $server = $request->route()->parameter('server');
$exception = new NotFoundHttpException('The requested resource was not found for this server.'); $exception = new NotFoundHttpException('The requested resource was not found for this server.');
foreach ($params as $key => $model) { foreach ($params as $key => $model) {
// Specifically skip the server, we're just trying to see if all of the // Specifically skip the server, we're just trying to see if all the
// other resources are assigned to this server. Also skip anything that // other resources are assigned to this server. Also skip anything that
// is not currently a Model instance since those will just end up being // is not currently a Model instance since those will just end up being
// a 404 down the road. // a 404 down the road.
@ -46,7 +46,7 @@ class ResourceBelongsToServer
} }
switch (get_class($model)) { switch (get_class($model)) {
// All of these models use "server_id" as the field key for the server // all these models use "server_id" as the field key for the server
// they are assigned to, so the logic is identical for them all. // they are assigned to, so the logic is identical for them all.
case Allocation::class: case Allocation::class:
case Backup::class: case Backup::class:

View File

@ -12,6 +12,8 @@ class DaemonAuthenticate
{ {
/** /**
* Daemon routes that this middleware should be skipped on. * Daemon routes that this middleware should be skipped on.
*
* @var string[]
*/ */
protected array $except = [ protected array $except = [
'daemon.configuration', 'daemon.configuration',

View File

@ -12,6 +12,7 @@ class StoreAllocationRequest extends ApplicationApiRequest
protected int $permission = AdminAcl::WRITE; protected int $permission = AdminAcl::WRITE;
/** @return array<string, string|string[]> */
public function rules(): array public function rules(): array
{ {
return [ return [
@ -22,6 +23,9 @@ class StoreAllocationRequest extends ApplicationApiRequest
]; ];
} }
/**
* @return array<string, mixed>
*/
public function validated($key = null, $default = null): array public function validated($key = null, $default = null): array
{ {
$data = parent::validated(); $data = parent::validated();

View File

@ -51,9 +51,7 @@ abstract class ApplicationApiRequest extends FormRequest
return AdminAcl::check($token, $this->resource, $this->permission); return AdminAcl::check($token, $this->resource, $this->permission);
} }
/** /** @return array<string, string|string[]> */
* Default set of rules to apply to API requests.
*/
public function rules(): array public function rules(): array
{ {
return []; return [];

View File

@ -12,6 +12,10 @@ class StoreDatabaseHostRequest extends ApplicationApiRequest
protected int $permission = AdminAcl::WRITE; protected int $permission = AdminAcl::WRITE;
/**
* @param array<string, string|string[]>|null $rules
* @return array<string, string|string[]>
*/
public function rules(?array $rules = null): array public function rules(?array $rules = null): array
{ {
return $rules ?? DatabaseHost::getRules(); return $rules ?? DatabaseHost::getRules();

View File

@ -6,6 +6,7 @@ use App\Models\DatabaseHost;
class UpdateDatabaseHostRequest extends StoreDatabaseHostRequest class UpdateDatabaseHostRequest extends StoreDatabaseHostRequest
{ {
/** @return array<array-key, string|string[]> */
public function rules(?array $rules = null): array public function rules(?array $rules = null): array
{ {
/** @var DatabaseHost $databaseHost */ /** @var DatabaseHost $databaseHost */

View File

@ -7,7 +7,8 @@ use App\Models\Mount;
class UpdateMountRequest extends StoreMountRequest class UpdateMountRequest extends StoreMountRequest
{ {
/** /**
* Apply validation rules to this request. * @param array<string, string|string[]>|null $rules
* @return array<string, string|string[]>
*/ */
public function rules(?array $rules = null): array public function rules(?array $rules = null): array
{ {

View File

@ -13,7 +13,8 @@ class StoreNodeRequest extends ApplicationApiRequest
protected int $permission = AdminAcl::WRITE; protected int $permission = AdminAcl::WRITE;
/** /**
* Validation rules to apply to this request. * @param array<string, string|string[]>|null $rules
* @return array<string, string|string[]>
*/ */
public function rules(?array $rules = null): array public function rules(?array $rules = null): array
{ {
@ -43,6 +44,8 @@ class StoreNodeRequest extends ApplicationApiRequest
/** /**
* Fields to rename for clarity in the API response. * Fields to rename for clarity in the API response.
*
* @return array<string, string>
*/ */
public function attributes(): array public function attributes(): array
{ {
@ -56,6 +59,8 @@ class StoreNodeRequest extends ApplicationApiRequest
/** /**
* Change the formatting of some data keys in the validated response data * Change the formatting of some data keys in the validated response data
* to match what the application expects in the services. * to match what the application expects in the services.
*
* @return array<string, mixed>
*/ */
public function validated($key = null, $default = null): array public function validated($key = null, $default = null): array
{ {

View File

@ -7,8 +7,8 @@ use App\Models\Node;
class UpdateNodeRequest extends StoreNodeRequest class UpdateNodeRequest extends StoreNodeRequest
{ {
/** /**
* Apply validation rules to this request. Uses the parent class rules() * @param array<string, string|string[]>|null $rules
* function but passes in the rules for updating rather than creating. * @return array<string, string|string[]>
*/ */
public function rules(?array $rules = null): array public function rules(?array $rules = null): array
{ {

View File

@ -12,6 +12,10 @@ class StoreRoleRequest extends ApplicationApiRequest
protected int $permission = AdminAcl::WRITE; protected int $permission = AdminAcl::WRITE;
/**
* @param array<array-key, string|string[]>|null $rules
* @return array<array-key, string|string[]>
*/
public function rules(?array $rules = null): array public function rules(?array $rules = null): array
{ {
return [ return [

View File

@ -42,6 +42,12 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest
/** /**
* Return data formatted in the correct format for the service to consume. * Return data formatted in the correct format for the service to consume.
*
* @return array{
* database: string,
* remote: string,
* database_host_id: int,
* }
*/ */
public function validated($key = null, $default = null): array public function validated($key = null, $default = null): array
{ {
@ -54,6 +60,8 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest
/** /**
* Format error messages in a more understandable format for API output. * Format error messages in a more understandable format for API output.
*
* @return array<array-key, string>
*/ */
public function attributes(): array public function attributes(): array
{ {

View File

@ -68,6 +68,31 @@ class StoreServerRequest extends ApplicationApiRequest
/** /**
* Normalize the data into a format that can be consumed by the service. * Normalize the data into a format that can be consumed by the service.
*
* @return array{
* external_id: int,
* name: string,
* description: string,
* owner_id: int,
* egg_id: int,
* image: string,
* startup: string,
* environment: string,
* memory: int,
* swap: int,
* disk: int,
* io: int,
* cpu: int,
* threads: int,
* skip_scripts: bool,
* allocation_id: int,
* allocation_additional: int[],
* start_on_completion: bool,
* database_limit: int,
* allocation_limit: int,
* backup_limit: int,
* oom_killer: bool,
* }
*/ */
public function validated($key = null, $default = null): array public function validated($key = null, $default = null): array
{ {

View File

@ -49,6 +49,8 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest
/** /**
* Convert the allocation field into the expected format for the service handler. * Convert the allocation field into the expected format for the service handler.
*
* @return array<array-key, string>
*/ */
public function validated($key = null, $default = null): array public function validated($key = null, $default = null): array
{ {
@ -74,6 +76,8 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest
/** /**
* Custom attributes to use in error message responses. * Custom attributes to use in error message responses.
*
* @return array<array-key, string>
*/ */
public function attributes(): array public function attributes(): array
{ {
@ -92,6 +96,9 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest
* Converts existing rules for certain limits into a format that maintains backwards * Converts existing rules for certain limits into a format that maintains backwards
* compatability with the old API endpoint while also supporting a more correct API * compatability with the old API endpoint while also supporting a more correct API
* call. * call.
*
* @param array<array-key, mixed> $rules
* @return array<array-key, string>
*/ */
protected function requiredToOptional(string $field, array $rules, bool $limits = false): array protected function requiredToOptional(string $field, array $rules, bool $limits = false): array
{ {

View File

@ -22,8 +22,9 @@ class UpdateServerDetailsRequest extends ServerWriteRequest
} }
/** /**
* Convert the posted data into the correct format that is expected * Convert the posted data into the correct format that is expected by the application.
* by the application. *
* @return array<array-key, string>
*/ */
public function validated($key = null, $default = null): array public function validated($key = null, $default = null): array
{ {
@ -38,6 +39,8 @@ class UpdateServerDetailsRequest extends ServerWriteRequest
/** /**
* Rename some attributes in error messages to clarify the field * Rename some attributes in error messages to clarify the field
* being discussed. * being discussed.
*
* @return array<array-key, string>
*/ */
public function attributes(): array public function attributes(): array
{ {

View File

@ -30,6 +30,8 @@ class UpdateServerStartupRequest extends ApplicationApiRequest
/** /**
* Return the validated data in a format that is expected by the service. * Return the validated data in a format that is expected by the service.
*
* @return array<string, mixed>
*/ */
public function validated($key = null, $default = null): array public function validated($key = null, $default = null): array
{ {

View File

@ -4,9 +4,7 @@ namespace App\Http\Requests\Api\Application\Users;
class AssignUserRolesRequest extends StoreUserRequest class AssignUserRolesRequest extends StoreUserRequest
{ {
/** /** @return array<array-key, string|string[]> */
* Return the validation rules for this request.
*/
public function rules(?array $rules = null): array public function rules(?array $rules = null): array
{ {
return [ return [

View File

@ -13,7 +13,8 @@ class StoreUserRequest extends ApplicationApiRequest
protected int $permission = AdminAcl::WRITE; protected int $permission = AdminAcl::WRITE;
/** /**
* Return the validation rules for this request. * @param array<array-key, string|string[]> |null $rules
* @return array<array-key, string|string[]>
*/ */
public function rules(?array $rules = null): array public function rules(?array $rules = null): array
{ {
@ -30,7 +31,9 @@ class StoreUserRequest extends ApplicationApiRequest
} }
/** /**
* Rename some fields to be more user friendly. * Rename some fields to be more user-friendly.
*
* @return array<array-key, string>
*/ */
public function attributes(): array public function attributes(): array
{ {

View File

@ -7,7 +7,8 @@ use App\Models\User;
class UpdateUserRequest extends StoreUserRequest class UpdateUserRequest extends StoreUserRequest
{ {
/** /**
* Return the validation rules for this request. * @param array<array-key, string|string[]> |null $rules
* @return array<array-key, string|string[]>
*/ */
public function rules(?array $rules = null): array public function rules(?array $rules = null): array
{ {

View File

@ -9,6 +9,7 @@ use App\Http\Requests\Api\Client\ClientApiRequest;
class StoreApiKeyRequest extends ClientApiRequest class StoreApiKeyRequest extends ClientApiRequest
{ {
/** @return array<array-key, string|string[]> */
public function rules(): array public function rules(): array
{ {
$rules = ApiKey::getRules(); $rules = ApiKey::getRules();

View File

@ -15,9 +15,7 @@ class StoreSSHKeyRequest extends ClientApiRequest
{ {
protected ?PublicKey $key; protected ?PublicKey $key;
/** /** @return array<string, string|string[]> */
* Returns the rules for this request.
*/
public function rules(): array public function rules(): array
{ {
return [ return [

View File

@ -43,6 +43,9 @@ class StoreDatabaseRequest extends ClientApiRequest implements ClientPermissions
]; ];
} }
/**
* @return array<array-key, string>
*/
public function messages(): array public function messages(): array
{ {
return [ return [

View File

@ -13,6 +13,9 @@ class DeleteFileRequest extends ClientApiRequest implements ClientPermissionsReq
return Permission::ACTION_FILE_DELETE; return Permission::ACTION_FILE_DELETE;
} }
/**
* @return string[]
*/
public function rules(): array public function rules(): array
{ {
return [ return [

View File

@ -47,6 +47,8 @@ abstract class SubuserRequest extends ClientApiRequest
* Validates that the permissions we are trying to assign can actually be assigned * Validates that the permissions we are trying to assign can actually be assigned
* by the user making the request. * by the user making the request.
* *
* @param string[] $permissions
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException * @throws \Illuminate\Contracts\Container\BindingResolutionException
*/ */
protected function validatePermissionsCanBeAssigned(array $permissions): void protected function validatePermissionsCanBeAssigned(array $permissions): void

View File

@ -12,6 +12,9 @@ class ActivityEventRequest extends FormRequest
return true; return true;
} }
/**
* @return array<array-key, string|string[]>
*/
public function rules(): array public function rules(): array
{ {
return [ return [
@ -28,6 +31,8 @@ class ActivityEventRequest extends FormRequest
/** /**
* Returns all the unique server UUIDs that were received in this request. * Returns all the unique server UUIDs that were received in this request.
*
* @return string[]
*/ */
public function servers(): array public function servers(): array
{ {
@ -36,6 +41,8 @@ class ActivityEventRequest extends FormRequest
/** /**
* Returns all the unique user UUIDs that were submitted in this request. * Returns all the unique user UUIDs that were submitted in this request.
*
* @return string[]
*/ */
public function users(): array public function users(): array
{ {

View File

@ -11,6 +11,9 @@ class InstallationDataRequest extends FormRequest
return true; return true;
} }
/**
* @return array<string, string|string[]>
*/
public function rules(): array public function rules(): array
{ {
return [ return [

View File

@ -6,6 +6,7 @@ use Illuminate\Foundation\Http\FormRequest;
class ReportBackupCompleteRequest extends FormRequest class ReportBackupCompleteRequest extends FormRequest
{ {
/** @return array<array-key, string|string[]> */
public function rules(): array public function rules(): array
{ {
return [ return [

View File

@ -16,6 +16,8 @@ class SftpAuthenticationFormRequest extends FormRequest
/** /**
* Rules to apply to the request. * Rules to apply to the request.
*
* @return array<string, string[]>
*/ */
public function rules(): array public function rules(): array
{ {
@ -29,6 +31,8 @@ class SftpAuthenticationFormRequest extends FormRequest
/** /**
* Return only the fields that we are interested in from the request. * Return only the fields that we are interested in from the request.
* This will include empty fields as a null value. * This will include empty fields as a null value.
*
* @return array<string, mixed>
*/ */
public function normalize(): array public function normalize(): array
{ {

View File

@ -17,6 +17,8 @@ class LoginCheckpointRequest extends FormRequest
/** /**
* Rules to apply to the request. * Rules to apply to the request.
*
* @return array<string, string|string[]>
*/ */
public function rules(): array public function rules(): array
{ {

View File

@ -11,6 +11,9 @@ class ResetPasswordRequest extends FormRequest
return true; return true;
} }
/**
* @return array<array-key, string>
*/
public function rules(): array public function rules(): array
{ {
return [ return [

View File

@ -15,10 +15,15 @@ class ServerConfigurationCollection extends ResourceCollection
* that can be understood by daemon. Make sure you've properly loaded the required * that can be understood by daemon. Make sure you've properly loaded the required
* relationships on the Server models before calling this function, otherwise you'll * relationships on the Server models before calling this function, otherwise you'll
* have some serious performance issues from all the N+1 queries. * have some serious performance issues from all the N+1 queries.
*
* @return array<array{uuid: string, }>
*/ */
public function toArray($request): array public function toArray($request): array
{ {
/** @var EggConfigurationService $egg */
$egg = Container::getInstance()->make(EggConfigurationService::class); $egg = Container::getInstance()->make(EggConfigurationService::class);
/** @var ServerConfigurationStructureService $configuration */
$configuration = Container::getInstance()->make(ServerConfigurationStructureService::class); $configuration = Container::getInstance()->make(ServerConfigurationStructureService::class);
return $this->collection->map(function (Server $server) use ($configuration, $egg) { return $this->collection->map(function (Server $server) use ($configuration, $egg) {

View File

@ -14,6 +14,9 @@ class ProcessWebhook implements ShouldQueue
{ {
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* @param array<mixed> $data
*/
public function __construct( public function __construct(
private WebhookConfiguration $webhookConfiguration, private WebhookConfiguration $webhookConfiguration,
private string $eventName, private string $eventName,

View File

@ -7,6 +7,9 @@ use App\Models\WebhookConfiguration;
class DispatchWebhooks class DispatchWebhooks
{ {
/**
* @param array<mixed> $data
*/
public function handle(string $eventName, array $data): void public function handle(string $eventName, array $data): void
{ {
if (!$this->eventIsWatched($eventName)) { if (!$this->eventIsWatched($eventName)) {

View File

@ -27,6 +27,9 @@ final class AlertBanner implements Wireable
return $static; return $static;
} }
/**
* @return array{id: string, title: ?string, body: ?string, status: ?string, icon: ?string, closeable: bool}
*/
public function toLivewire(): array public function toLivewire(): array
{ {
return [ return [

View File

@ -7,6 +7,7 @@ use Livewire\Component;
class AlertBannerContainer extends Component class AlertBannerContainer extends Component
{ {
/** @var array<AlertBanner> */
public array $alertBanners; public array $alertBanners;
public function mount(): void public function mount(): void

View File

@ -36,6 +36,7 @@ class PanelInstaller extends SimplePage implements HasForms
use EnvironmentWriterTrait; use EnvironmentWriterTrait;
use InteractsWithForms; use InteractsWithForms;
/** @var array<mixed> */
public array $data = []; public array $data = [];
protected static string $view = 'filament.pages.installer'; protected static string $view = 'filament.pages.installer';

View File

@ -72,6 +72,7 @@ class ActivityLog extends Model implements HasIcon, HasLabel
protected $with = ['subjects']; protected $with = ['subjects'];
/** @var array<array-key, string|string[]> */
public static array $validationRules = [ public static array $validationRules = [
'event' => ['required', 'string'], 'event' => ['required', 'string'],
'batch' => ['nullable', 'uuid'], 'batch' => ['nullable', 'uuid'],
@ -93,6 +94,9 @@ class ActivityLog extends Model implements HasIcon, HasLabel
return $this->morphTo()->withTrashed(); return $this->morphTo()->withTrashed();
} }
/**
* @return HasMany<ActivityLogSubject, $this>
*/
public function subjects(): HasMany public function subjects(): HasMany
{ {
return $this->hasMany(ActivityLogSubject::class); return $this->hasMany(ActivityLogSubject::class);
@ -190,6 +194,9 @@ class ActivityLog extends Model implements HasIcon, HasLabel
"; ";
} }
/**
* @return array<string, string>
*/
public function wrapProperties(): array public function wrapProperties(): array
{ {
if (!$this->properties || $this->properties->isEmpty()) { if (!$this->properties || $this->properties->isEmpty()) {

View File

@ -57,13 +57,14 @@ class Allocation extends Model
*/ */
protected $guarded = ['id', 'created_at', 'updated_at']; protected $guarded = ['id', 'created_at', 'updated_at'];
/** @var array<array-key, string|string[]> */
public static array $validationRules = [ public static array $validationRules = [
'node_id' => 'required|exists:nodes,id', 'node_id' => ['required', 'exists:nodes,id'],
'ip' => 'required|ip', 'ip' => ['required', 'ip'],
'port' => 'required|numeric|between:1024,65535', 'port' => ['required', 'numeric', 'between:1024,65535'],
'ip_alias' => 'nullable|string', 'ip_alias' => ['nullable', 'string'],
'server_id' => 'nullable|exists:servers,id', 'server_id' => ['nullable', 'exists:servers,id'],
'notes' => 'nullable|string|max:256', 'notes' => ['nullable', 'string', 'max:256'],
]; ];
protected static function booted(): void protected static function booted(): void

Some files were not shown because too many files have changed in this diff Show More