diff --git a/app/Console/Commands/Egg/CheckEggUpdatesCommand.php b/app/Console/Commands/Egg/CheckEggUpdatesCommand.php index fa7c83ac0..7005054cf 100644 --- a/app/Console/Commands/Egg/CheckEggUpdatesCommand.php +++ b/app/Console/Commands/Egg/CheckEggUpdatesCommand.php @@ -16,28 +16,33 @@ class CheckEggUpdatesCommand extends Command $eggs = Egg::all(); foreach ($eggs as $egg) { try { - if (is_null($egg->update_url)) { - $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()); - } + $this->check($egg, $exporterService); } catch (Exception $exception) { $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()); + } + } } diff --git a/app/Console/Commands/Environment/CacheSettingsCommand.php b/app/Console/Commands/Environment/CacheSettingsCommand.php index 7837bea1d..2d6905112 100644 --- a/app/Console/Commands/Environment/CacheSettingsCommand.php +++ b/app/Console/Commands/Environment/CacheSettingsCommand.php @@ -27,8 +27,6 @@ class CacheSettingsCommand extends Command {--redis-pass= : Password used to connect to redis.} {--redis-port= : Port to connect to redis over.}'; - protected array $variables = []; - /** * CacheSettingsCommand constructor. */ diff --git a/app/Console/Commands/Environment/DatabaseSettingsCommand.php b/app/Console/Commands/Environment/DatabaseSettingsCommand.php index 3e3284c74..6603efde5 100644 --- a/app/Console/Commands/Environment/DatabaseSettingsCommand.php +++ b/app/Console/Commands/Environment/DatabaseSettingsCommand.php @@ -27,6 +27,7 @@ class DatabaseSettingsCommand extends Command {--username= : Username to use when connecting to the MySQL/ MariaDB server.} {--password= : Password to use for the MySQL/ MariaDB database.}'; + /** @var array */ protected array $variables = []; /** @@ -179,7 +180,7 @@ class DatabaseSettingsCommand extends Command } elseif ($this->variables['DB_CONNECTION'] === 'sqlite') { $this->variables['DB_DATABASE'] = $this->option('database') ?? $this->ask( 'Database Path', - env('DB_DATABASE', 'database.sqlite') + (string) env('DB_DATABASE', 'database.sqlite') ); } diff --git a/app/Console/Commands/Environment/EmailSettingsCommand.php b/app/Console/Commands/Environment/EmailSettingsCommand.php index 096d86f2d..861a7ba44 100644 --- a/app/Console/Commands/Environment/EmailSettingsCommand.php +++ b/app/Console/Commands/Environment/EmailSettingsCommand.php @@ -22,6 +22,7 @@ class EmailSettingsCommand extends Command {--username=} {--password=}'; + /** @var array */ protected array $variables = []; /** diff --git a/app/Console/Commands/Environment/QueueSettingsCommand.php b/app/Console/Commands/Environment/QueueSettingsCommand.php index f8b667402..59fbe76ea 100644 --- a/app/Console/Commands/Environment/QueueSettingsCommand.php +++ b/app/Console/Commands/Environment/QueueSettingsCommand.php @@ -27,8 +27,6 @@ class QueueSettingsCommand extends Command {--redis-pass= : Password used to connect to redis.} {--redis-port= : Port to connect to redis over.}'; - protected array $variables = []; - /** * QueueSettingsCommand constructor. */ diff --git a/app/Console/Commands/Environment/RedisSetupCommand.php b/app/Console/Commands/Environment/RedisSetupCommand.php index 281a97bac..f3acd50ef 100644 --- a/app/Console/Commands/Environment/RedisSetupCommand.php +++ b/app/Console/Commands/Environment/RedisSetupCommand.php @@ -20,8 +20,6 @@ class RedisSetupCommand extends Command {--redis-pass= : Password used to connect to redis.} {--redis-port= : Port to connect to redis over.}'; - protected array $variables = []; - /** * RedisSetupCommand constructor. */ diff --git a/app/Console/Commands/Environment/SessionSettingsCommand.php b/app/Console/Commands/Environment/SessionSettingsCommand.php index be99686f4..61e0a5829 100644 --- a/app/Console/Commands/Environment/SessionSettingsCommand.php +++ b/app/Console/Commands/Environment/SessionSettingsCommand.php @@ -28,8 +28,6 @@ class SessionSettingsCommand extends Command {--redis-pass= : Password used to connect to redis.} {--redis-port= : Port to connect to redis over.}'; - protected array $variables = []; - /** * SessionSettingsCommand constructor. */ diff --git a/app/Console/Commands/Server/BulkPowerActionCommand.php b/app/Console/Commands/Server/BulkPowerActionCommand.php index 1aae62685..2132f0ee1 100644 --- a/app/Console/Commands/Server/BulkPowerActionCommand.php +++ b/app/Console/Commands/Server/BulkPowerActionCommand.php @@ -81,6 +81,9 @@ class BulkPowerActionCommand extends Command /** * 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 { diff --git a/app/Contracts/Validatable.php b/app/Contracts/Validatable.php index dedf3cbc6..bea7e8da9 100644 --- a/app/Contracts/Validatable.php +++ b/app/Contracts/Validatable.php @@ -8,8 +8,14 @@ interface Validatable { public function getValidator(): Validator; + /** + * @return array + */ public static function getRules(): array; + /** + * @return array> + */ public static function getRulesForField(string $field): array; public function validate(): void; diff --git a/app/Exceptions/DisplayException.php b/app/Exceptions/DisplayException.php index 96fbf6620..651abeb69 100644 --- a/app/Exceptions/DisplayException.php +++ b/app/Exceptions/DisplayException.php @@ -12,6 +12,9 @@ use Illuminate\Http\Response; use Illuminate\Container\Container; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; +/** + * @deprecated + */ class DisplayException extends PanelException implements HttpExceptionInterface { public const LEVEL_DEBUG = 'debug'; @@ -40,6 +43,9 @@ class DisplayException extends PanelException implements HttpExceptionInterface return Response::HTTP_BAD_REQUEST; } + /** + * @return array + */ public function getHeaders(): array { return []; diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 685aa0a55..e3317a883 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -46,6 +46,8 @@ class Handler extends ExceptionHandler /** * Maps exceptions to a specific response code. This handles special exception * types that don't have a defined response code. + * + * @var array */ protected static array $exceptionResponseCodes = [ AuthenticationException::class => 401, @@ -180,6 +182,16 @@ class Handler extends ExceptionHandler return response()->json(['errors' => $errors], $exception->status); } + /** + * @param array $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}} + */ public static function exceptionToArray(Throwable $e, array $override = []): array { $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. + * + * @param array{detail?: mixed, source?: mixed, meta?: mixed} $override + * @return array{errors?: 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 * into the expected array response type. + * + * @return array */ public static function toArray(\Throwable $e): array { diff --git a/app/Exceptions/Model/DataValidationException.php b/app/Exceptions/Model/DataValidationException.php index 52eb8bf05..f40d1a501 100644 --- a/app/Exceptions/Model/DataValidationException.php +++ b/app/Exceptions/Model/DataValidationException.php @@ -42,6 +42,9 @@ class DataValidationException extends PanelException implements HttpExceptionInt return 500; } + /** + * @return array + */ public function getHeaders(): array { return []; diff --git a/app/Extensions/Backups/BackupManager.php b/app/Extensions/Backups/BackupManager.php index 5b2395c44..3ad5d8a5f 100644 --- a/app/Extensions/Backups/BackupManager.php +++ b/app/Extensions/Backups/BackupManager.php @@ -16,17 +16,18 @@ class BackupManager { /** * The array of resolved backup drivers. + * + * @var array */ protected array $adapters = []; /** * The registered custom driver creators. + * + * @var array */ protected array $customCreators; - /** - * BackupManager constructor. - */ public function __construct(protected Application $app) {} /** @@ -86,6 +87,8 @@ class BackupManager /** * Calls a custom creator for a given adapter type. + * + * @param array{adapter: string} $config */ protected function callCustomCreator(array $config): mixed { @@ -94,6 +97,8 @@ class BackupManager /** * Creates a new daemon adapter. + * + * @param array $config */ public function createWingsAdapter(array $config): FilesystemAdapter { @@ -102,6 +107,8 @@ class BackupManager /** * Creates a new S3 adapter. + * + * @param array $config */ public function createS3Adapter(array $config): FilesystemAdapter { @@ -118,6 +125,8 @@ class BackupManager /** * Returns the configuration associated with a given backup type. + * + * @return array */ protected function getConfig(string $name): array { diff --git a/app/Extensions/Filesystem/S3Filesystem.php b/app/Extensions/Filesystem/S3Filesystem.php index 6535dc6f3..64aa95bb4 100644 --- a/app/Extensions/Filesystem/S3Filesystem.php +++ b/app/Extensions/Filesystem/S3Filesystem.php @@ -7,6 +7,9 @@ use League\Flysystem\AwsS3V3\AwsS3V3Adapter; class S3Filesystem extends AwsS3V3Adapter { + /** + * @param array $options + */ public function __construct( private S3ClientInterface $client, private string $bucket, diff --git a/app/Extensions/League/Fractal/Serializers/PanelSerializer.php b/app/Extensions/League/Fractal/Serializers/PanelSerializer.php index 29148c081..161fc2cbe 100644 --- a/app/Extensions/League/Fractal/Serializers/PanelSerializer.php +++ b/app/Extensions/League/Fractal/Serializers/PanelSerializer.php @@ -8,6 +8,9 @@ class PanelSerializer extends ArraySerializer { /** * Serialize an item. + * + * @param array $data + * @return array{object: ?string, attributes: array} */ public function item(?string $resourceKey, array $data): array { @@ -19,6 +22,9 @@ class PanelSerializer extends ArraySerializer /** * Serialize a collection. + * + * @param array $data + * @return array{object: 'list', data: array} */ public function collection(?string $resourceKey, array $data): array { @@ -35,6 +41,8 @@ class PanelSerializer extends ArraySerializer /** * Serialize a null resource. + * + * @return ?array{object: ?string, attributes: null} */ public function null(): ?array { @@ -46,6 +54,10 @@ class PanelSerializer extends ArraySerializer /** * 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 { diff --git a/app/Extensions/OAuth/Providers/OAuthProvider.php b/app/Extensions/OAuth/Providers/OAuthProvider.php index 477851a71..ebaa418b3 100644 --- a/app/Extensions/OAuth/Providers/OAuthProvider.php +++ b/app/Extensions/OAuth/Providers/OAuthProvider.php @@ -2,6 +2,7 @@ namespace App\Extensions\OAuth\Providers; +use Filament\Forms\Components\Component; use Filament\Forms\Components\TextInput; use Filament\Forms\Components\Wizard\Step; use Illuminate\Foundation\Application; @@ -11,8 +12,14 @@ use SocialiteProviders\Manager\SocialiteWasCalled; abstract class OAuthProvider { + /** + * @var array + */ protected static array $providers = []; + /** + * @return self|static[] + */ public static function get(?string $id = null): array|self { return $id ? static::$providers[$id] : static::$providers; @@ -46,6 +53,9 @@ abstract class OAuthProvider return null; } + /** + * @return array + */ public function getServiceConfig(): array { $id = Str::upper($this->getId()); @@ -56,6 +66,9 @@ abstract class OAuthProvider ]; } + /** + * @return Component[] + */ public function getSettingsForm(): array { $id = Str::upper($this->getId()); @@ -82,6 +95,9 @@ abstract class OAuthProvider ]; } + /** + * @return Step[] + */ public function getSetupSteps(): array { return [ diff --git a/app/Filament/Admin/Pages/Health.php b/app/Filament/Admin/Pages/Health.php index 8f9e77091..8fe2e895a 100644 --- a/app/Filament/Admin/Pages/Health.php +++ b/app/Filament/Admin/Pages/Health.php @@ -17,7 +17,7 @@ class Health extends Page protected static string $view = 'filament.pages.health'; - // @phpstan-ignore-next-line + /** @var array */ protected $listeners = [ 'refresh-component' => '$refresh', ]; @@ -54,7 +54,7 @@ class Health extends Page protected function getViewData(): array { - // @phpstan-ignore-next-line + // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions $checkResults = app(ResultStore::class)->latestResults(); if ($checkResults === null) { @@ -83,7 +83,7 @@ class Health extends Page public static function getNavigationBadge(): ?string { - // @phpstan-ignore-next-line + // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions $results = app(ResultStore::class)->latestResults(); if ($results === null) { @@ -106,7 +106,7 @@ class Health extends Page public static function getNavigationBadgeTooltip(): ?string { - // @phpstan-ignore-next-line + // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions $results = app(ResultStore::class)->latestResults(); if ($results === null) { @@ -128,7 +128,7 @@ class Health extends Page public static function getNavigationIcon(): string { - // @phpstan-ignore-next-line + // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions $results = app(ResultStore::class)->latestResults(); if ($results === null) { diff --git a/app/Filament/Admin/Pages/Settings.php b/app/Filament/Admin/Pages/Settings.php index 487385b96..72e182b03 100644 --- a/app/Filament/Admin/Pages/Settings.php +++ b/app/Filament/Admin/Pages/Settings.php @@ -10,6 +10,7 @@ use Exception; use Filament\Actions\Action; use Filament\Forms\Components\Actions; use Filament\Forms\Components\Actions\Action as FormAction; +use Filament\Forms\Components\Component; use Filament\Forms\Components\Group; use Filament\Forms\Components\Hidden; use Filament\Forms\Components\Placeholder; @@ -49,6 +50,7 @@ class Settings extends Page implements HasForms protected static string $view = 'filament.pages.settings'; + /** @var array|null */ public ?array $data = []; public function mount(): void @@ -108,6 +110,7 @@ class Settings extends Page implements HasForms ]; } + /** @return Component[] */ private function generalSettings(): array { return [ @@ -211,6 +214,9 @@ class Settings extends Page implements HasForms ]; } + /** + * @return Component[] + */ private function captchaSettings(): array { return [ @@ -256,6 +262,9 @@ class Settings extends Page implements HasForms ]; } + /** + * @return Component[] + */ private function mailSettings(): array { return [ @@ -405,6 +414,9 @@ class Settings extends Page implements HasForms ]; } + /** + * @return Component[] + */ private function backupSettings(): array { return [ @@ -475,6 +487,9 @@ class Settings extends Page implements HasForms ]; } + /** + * @return Component[] + */ private function oauthSettings(): array { $formFields = []; @@ -529,6 +544,9 @@ class Settings extends Page implements HasForms return $formFields; } + /** + * @return Component[] + */ private function miscSettings(): array { return [ diff --git a/app/Filament/Admin/Resources/NodeResource/Widgets/NodeStorageChart.php b/app/Filament/Admin/Resources/NodeResource/Widgets/NodeStorageChart.php index 2142b101f..7f9be2d6f 100644 --- a/app/Filament/Admin/Resources/NodeResource/Widgets/NodeStorageChart.php +++ b/app/Filament/Admin/Resources/NodeResource/Widgets/NodeStorageChart.php @@ -38,11 +38,11 @@ class NodeStorageChart extends ChartWidget protected function getData(): array { $total = config('panel.use_binary_prefix') - ? ($this->node->statistics()['disk_total'] ?? 0) / 1024 / 1024 / 1024 - : ($this->node->statistics()['disk_total'] ?? 0) / 1000 / 1000 / 1000; + ? ($this->node->statistics()['disk_total']) / 1024 / 1024 / 1024 + : ($this->node->statistics()['disk_total']) / 1000 / 1000 / 1000; $used = config('panel.use_binary_prefix') - ? ($this->node->statistics()['disk_used'] ?? 0) / 1024 / 1024 / 1024 - : ($this->node->statistics()['disk_used'] ?? 0) / 1000 / 1000 / 1000; + ? ($this->node->statistics()['disk_used']) / 1024 / 1024 / 1024 + : ($this->node->statistics()['disk_used']) / 1000 / 1000 / 1000; $unused = $total - $used; @@ -72,8 +72,8 @@ class NodeStorageChart extends ChartWidget public function getHeading(): string { - $used = convert_bytes_to_readable($this->node->statistics()['disk_used'] ?? 0); - $total = convert_bytes_to_readable($this->node->statistics()['disk_total'] ?? 0); + $used = convert_bytes_to_readable($this->node->statistics()['disk_used']); + $total = convert_bytes_to_readable($this->node->statistics()['disk_total']); return trans('admin/node.disk_chart', ['used' => $used, 'total' => $total]); } diff --git a/app/Filament/Admin/Resources/RoleResource.php b/app/Filament/Admin/Resources/RoleResource.php index d3b039804..b823171e6 100644 --- a/app/Filament/Admin/Resources/RoleResource.php +++ b/app/Filament/Admin/Resources/RoleResource.php @@ -23,6 +23,7 @@ use Filament\Tables\Actions\ViewAction; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; use Illuminate\Support\Str; +use Spatie\Permission\Contracts\Permission; 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 { $icon = null; diff --git a/app/Filament/Admin/Resources/ServerResource/Pages/CreateServer.php b/app/Filament/Admin/Resources/ServerResource/Pages/CreateServer.php index f93cb8c42..b529b576a 100644 --- a/app/Filament/Admin/Resources/ServerResource/Pages/CreateServer.php +++ b/app/Filament/Admin/Resources/ServerResource/Pages/CreateServer.php @@ -138,7 +138,7 @@ class CreateServer extends CreateRecord ]) ->relationship('user', 'username') ->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([ TextInput::make('username') ->label(trans('admin/user.username')) @@ -864,6 +864,9 @@ class CreateServer extends CreateRecord throw new Exception('Component type not supported: ' . $component::class); } + /** + * @return array + */ private function getSelectOptionsFromRules(Get $get): array { $inRule = collect($get('rules'))->reduce( @@ -878,6 +881,10 @@ class CreateServer extends CreateRecord ->all(); } + /** + * @param string[] $portEntries + * @return array + */ public static function retrieveValidPorts(Node $node, array $portEntries, string $ip): array { $portRangeLimit = AssignmentService::PORT_RANGE_LIMIT; diff --git a/app/Filament/Admin/Resources/ServerResource/Pages/EditServer.php b/app/Filament/Admin/Resources/ServerResource/Pages/EditServer.php index 78b45b5c5..5f996c1d2 100644 --- a/app/Filament/Admin/Resources/ServerResource/Pages/EditServer.php +++ b/app/Filament/Admin/Resources/ServerResource/Pages/EditServer.php @@ -119,7 +119,7 @@ class EditServer extends EditRecord ]) ->relationship('user', 'username') ->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() ->required(), @@ -855,7 +855,7 @@ class EditServer extends EditRecord Forms\Components\Actions::make([ Action::make('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! ->form([ //TODO! Select::make('newNode') @@ -1014,6 +1014,9 @@ class EditServer extends EditRecord throw new Exception('Component type not supported: ' . $component::class); } + /** + * @return array + */ private function getSelectOptionsFromRules(ServerVariable $serverVariable): array { $inRule = array_first($serverVariable->variable->rules, fn ($value) => str($value)->startsWith('in:')); diff --git a/app/Filament/Server/Pages/Console.php b/app/Filament/Server/Pages/Console.php index 3efffed00..855da8585 100644 --- a/app/Filament/Server/Pages/Console.php +++ b/app/Filament/Server/Pages/Console.php @@ -16,6 +16,8 @@ use Filament\Actions\Action; use Filament\Facades\Filament; use Filament\Pages\Page; use Filament\Support\Enums\ActionSize; +use Filament\Widgets\Widget; +use Filament\Widgets\WidgetConfiguration; use Livewire\Attributes\On; class Console extends Page @@ -52,6 +54,9 @@ class Console extends Page ]; } + /** + * @return class-string[] + */ public function getWidgets(): array { return [ @@ -63,12 +68,15 @@ class Console extends Page ]; } + /** + * @return array | WidgetConfiguration> + */ public function getVisibleWidgets(): array { return $this->filterVisibleWidgets($this->getWidgets()); } - public function getColumns(): int|string|array + public function getColumns(): int { return 3; } diff --git a/app/Filament/Server/Pages/ServerFormPage.php b/app/Filament/Server/Pages/ServerFormPage.php index da9866615..5ae5acd12 100644 --- a/app/Filament/Server/Pages/ServerFormPage.php +++ b/app/Filament/Server/Pages/ServerFormPage.php @@ -19,6 +19,7 @@ abstract class ServerFormPage extends Page protected static string $view = 'filament.server.pages.server-form-page'; + /** @var ?array */ public ?array $data = []; public function mount(): void diff --git a/app/Filament/Server/Pages/Startup.php b/app/Filament/Server/Pages/Startup.php index 13b14284c..6275e0437 100644 --- a/app/Filament/Server/Pages/Startup.php +++ b/app/Filament/Server/Pages/Startup.php @@ -176,6 +176,9 @@ class Startup extends ServerFormPage throw new \Exception('Component type not supported: ' . $component::class); } + /** + * @return string[] + */ private function getSelectOptionsFromRules(ServerVariable $serverVariable): array { $inRule = array_first($serverVariable->variable->rules, fn ($value) => str($value)->startsWith('in:')); diff --git a/app/Filament/Server/Resources/DatabaseResource/Pages/ListDatabases.php b/app/Filament/Server/Resources/DatabaseResource/Pages/ListDatabases.php index 44f4597d9..10e52596c 100644 --- a/app/Filament/Server/Resources/DatabaseResource/Pages/ListDatabases.php +++ b/app/Filament/Server/Resources/DatabaseResource/Pages/ListDatabases.php @@ -6,6 +6,7 @@ use App\Filament\Components\Forms\Actions\RotateDatabasePasswordAction; use App\Filament\Components\Tables\Columns\DateTimeColumn; use App\Filament\Server\Resources\DatabaseResource; use App\Models\Database; +use App\Models\DatabaseHost; use App\Models\Permission; use App\Models\Server; use App\Services\Databases\DatabaseManagementService; @@ -98,7 +99,7 @@ class ListDatabases extends ListRecords ->columnSpan(2) ->required() ->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') ->columnSpan(1) ->label('Database Name') diff --git a/app/Filament/Server/Resources/FileResource/Pages/EditFiles.php b/app/Filament/Server/Resources/FileResource/Pages/EditFiles.php index 8fb29f775..662fa0b0e 100644 --- a/app/Filament/Server/Resources/FileResource/Pages/EditFiles.php +++ b/app/Filament/Server/Resources/FileResource/Pages/EditFiles.php @@ -45,6 +45,7 @@ class EditFiles extends Page #[Locked] public string $path; + /** @var array */ public ?array $data = []; public function form(Form $form): Form diff --git a/app/Filament/Server/Resources/FileResource/Pages/ListFiles.php b/app/Filament/Server/Resources/FileResource/Pages/ListFiles.php index cfd2c0177..3de864cc7 100644 --- a/app/Filament/Server/Resources/FileResource/Pages/ListFiles.php +++ b/app/Filament/Server/Resources/FileResource/Pages/ListFiles.php @@ -542,6 +542,9 @@ class ListFiles extends ListRecords ); } + /** + * @return string[] + */ private function getPermissionsFromModeBit(int $mode): array { if ($mode === 1) { diff --git a/app/Filament/Server/Resources/ScheduleResource/RelationManagers/TasksRelationManager.php b/app/Filament/Server/Resources/ScheduleResource/RelationManagers/TasksRelationManager.php index 80bc72102..1508725ae 100644 --- a/app/Filament/Server/Resources/ScheduleResource/RelationManagers/TasksRelationManager.php +++ b/app/Filament/Server/Resources/ScheduleResource/RelationManagers/TasksRelationManager.php @@ -5,6 +5,7 @@ namespace App\Filament\Server\Resources\ScheduleResource\RelationManagers; use App\Facades\Activity; use App\Models\Schedule; use App\Models\Task; +use Filament\Forms\Components\Field; use Filament\Tables\Actions\DeleteAction; use Filament\Forms\Components\Select; use Filament\Forms\Components\Textarea; @@ -22,6 +23,9 @@ class TasksRelationManager extends RelationManager { protected static string $relationship = 'tasks'; + /** + * @return array + */ private function getActionOptions(bool $full = true): array { return [ @@ -32,6 +36,9 @@ class TasksRelationManager extends RelationManager ]; } + /** + * @return array + */ private function getTaskForm(Schedule $schedule): array { return [ diff --git a/app/Filament/Server/Widgets/ServerConsole.php b/app/Filament/Server/Widgets/ServerConsole.php index a9c72591e..0f45b11cd 100644 --- a/app/Filament/Server/Widgets/ServerConsole.php +++ b/app/Filament/Server/Widgets/ServerConsole.php @@ -25,6 +25,7 @@ class ServerConsole extends Widget public ?User $user = null; + /** @var string[] */ public array $history = []; public int $historyIndex = 0; diff --git a/app/Http/Controllers/Api/Application/DatabaseHosts/DatabaseHostController.php b/app/Http/Controllers/Api/Application/DatabaseHosts/DatabaseHostController.php index 1b723abb5..fe1b2860b 100644 --- a/app/Http/Controllers/Api/Application/DatabaseHosts/DatabaseHostController.php +++ b/app/Http/Controllers/Api/Application/DatabaseHosts/DatabaseHostController.php @@ -31,6 +31,8 @@ class DatabaseHostController extends ApplicationApiController * List database hosts * * Return all the database hosts currently registered on the Panel. + * + * @return array */ public function index(GetDatabaseHostRequest $request): array { @@ -48,6 +50,8 @@ class DatabaseHostController extends ApplicationApiController * View database host * * Return a single database host. + * + * @return 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. * + * @return array + * * @throws \Throwable */ public function update(UpdateDatabaseHostRequest $request, DatabaseHost $databaseHost): array diff --git a/app/Http/Controllers/Api/Application/Eggs/EggController.php b/app/Http/Controllers/Api/Application/Eggs/EggController.php index 8e6c22139..62b1c213b 100644 --- a/app/Http/Controllers/Api/Application/Eggs/EggController.php +++ b/app/Http/Controllers/Api/Application/Eggs/EggController.php @@ -14,6 +14,8 @@ class EggController extends ApplicationApiController * List eggs * * Return all eggs + * + * @return array */ public function index(GetEggsRequest $request): array { @@ -26,6 +28,8 @@ class EggController extends ApplicationApiController * View egg * * Return a single egg that exists + * + * @return array */ public function view(GetEggRequest $request, Egg $egg): array { diff --git a/app/Http/Controllers/Api/Application/Mounts/MountController.php b/app/Http/Controllers/Api/Application/Mounts/MountController.php index 3ed1a7c68..1536b8397 100644 --- a/app/Http/Controllers/Api/Application/Mounts/MountController.php +++ b/app/Http/Controllers/Api/Application/Mounts/MountController.php @@ -21,6 +21,8 @@ class MountController extends ApplicationApiController * List mounts * * Return all the mounts currently available on the Panel. + * + * @return array */ public function index(GetMountRequest $request): array { @@ -38,6 +40,8 @@ class MountController extends ApplicationApiController * View mount * * Return data for a single instance of a mount. + * + * @return array */ public function view(GetMountRequest $request, Mount $mount): array { @@ -77,6 +81,8 @@ class MountController extends ApplicationApiController * * Update an existing mount on the Panel. * + * @return array + * * @throws \Throwable */ public function update(UpdateMountRequest $request, Mount $mount): array @@ -111,6 +117,8 @@ class MountController extends ApplicationApiController * Assign eggs to mount * * Adds eggs to the mount's many-to-many relation. + * + * @return array */ public function addEggs(Request $request, Mount $mount): array { @@ -132,6 +140,8 @@ class MountController extends ApplicationApiController * Assign mounts to mount * * Adds nodes to the mount's many-to-many relation. + * + * @return array */ public function addNodes(Request $request, Mount $mount): array { diff --git a/app/Http/Controllers/Api/Application/Nodes/AllocationController.php b/app/Http/Controllers/Api/Application/Nodes/AllocationController.php index d4af8b266..55122df50 100644 --- a/app/Http/Controllers/Api/Application/Nodes/AllocationController.php +++ b/app/Http/Controllers/Api/Application/Nodes/AllocationController.php @@ -32,6 +32,8 @@ class AllocationController extends ApplicationApiController * List allocations * * Return all the allocations that exist for a given node. + * + * @return array */ public function index(GetAllocationsRequest $request, Node $node): array { diff --git a/app/Http/Controllers/Api/Application/Nodes/NodeController.php b/app/Http/Controllers/Api/Application/Nodes/NodeController.php index a13159ff8..5c69b14bb 100644 --- a/app/Http/Controllers/Api/Application/Nodes/NodeController.php +++ b/app/Http/Controllers/Api/Application/Nodes/NodeController.php @@ -35,6 +35,8 @@ class NodeController extends ApplicationApiController * List nodes * * Return all the nodes currently available on the Panel. + * + * @return array */ public function index(GetNodesRequest $request): array { @@ -52,6 +54,8 @@ class NodeController extends ApplicationApiController * View node * * Return data for a single instance of a node. + * + * @return array */ public function view(GetNodeRequest $request, Node $node): array { @@ -87,6 +91,8 @@ class NodeController extends ApplicationApiController * * Update an existing node on the Panel. * + * @return array + * * @throws \Throwable */ public function update(UpdateNodeRequest $request, Node $node): array diff --git a/app/Http/Controllers/Api/Application/Nodes/NodeDeploymentController.php b/app/Http/Controllers/Api/Application/Nodes/NodeDeploymentController.php index 28b136d80..a30e503ee 100644 --- a/app/Http/Controllers/Api/Application/Nodes/NodeDeploymentController.php +++ b/app/Http/Controllers/Api/Application/Nodes/NodeDeploymentController.php @@ -22,6 +22,8 @@ class NodeDeploymentController extends ApplicationApiController * 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 * to this endpoint and get back a list of all Nodes satisfying the requirements. + * + * @return array */ public function __invoke(GetDeployableNodesRequest $request): array { diff --git a/app/Http/Controllers/Api/Application/Roles/RoleController.php b/app/Http/Controllers/Api/Application/Roles/RoleController.php index a91e6c0e4..3ecf035f9 100644 --- a/app/Http/Controllers/Api/Application/Roles/RoleController.php +++ b/app/Http/Controllers/Api/Application/Roles/RoleController.php @@ -20,6 +20,8 @@ class RoleController extends ApplicationApiController * List roles * * Return all the roles currently registered on the Panel. + * + * @return array */ public function index(GetRoleRequest $request): array { @@ -37,6 +39,8 @@ class RoleController extends ApplicationApiController * View role * * Return a single role. + * + * @return 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. * + * @return array + * * @throws \Throwable */ public function update(UpdateRoleRequest $request, Role $role): array diff --git a/app/Http/Controllers/Api/Application/Servers/DatabaseController.php b/app/Http/Controllers/Api/Application/Servers/DatabaseController.php index dccb2bddb..0851c6961 100644 --- a/app/Http/Controllers/Api/Application/Servers/DatabaseController.php +++ b/app/Http/Controllers/Api/Application/Servers/DatabaseController.php @@ -32,8 +32,9 @@ class DatabaseController extends ApplicationApiController /** * List databases * - * Return a listing of all databases currently available to a single - * server. + * Return a listing of all databases currently available to a single server. + * + * @return array */ public function index(GetServerDatabasesRequest $request, Server $server): array { @@ -46,6 +47,8 @@ class DatabaseController extends ApplicationApiController * View database * * Return a single server database. + * + * @return array */ public function view(GetServerDatabaseRequest $request, Server $server, Database $database): array { diff --git a/app/Http/Controllers/Api/Application/Servers/ExternalServerController.php b/app/Http/Controllers/Api/Application/Servers/ExternalServerController.php index cc987625d..de9a70f13 100644 --- a/app/Http/Controllers/Api/Application/Servers/ExternalServerController.php +++ b/app/Http/Controllers/Api/Application/Servers/ExternalServerController.php @@ -15,6 +15,8 @@ class ExternalServerController extends ApplicationApiController * View server (external id) * * Retrieve a specific server from the database using its external ID. + * + * @return array */ public function index(GetExternalServerRequest $request, string $external_id): array { diff --git a/app/Http/Controllers/Api/Application/Servers/ServerController.php b/app/Http/Controllers/Api/Application/Servers/ServerController.php index 4ec9fbd09..6d40af75d 100644 --- a/app/Http/Controllers/Api/Application/Servers/ServerController.php +++ b/app/Http/Controllers/Api/Application/Servers/ServerController.php @@ -33,6 +33,8 @@ class ServerController extends ApplicationApiController * List servers * * Return all the servers that currently exist on the Panel. + * + * @return array */ public function index(GetServersRequest $request): array { @@ -70,6 +72,8 @@ class ServerController extends ApplicationApiController * View server * * Show a single server transformed for the application API. + * + * @return array */ public function view(GetServerRequest $request, Server $server): array { diff --git a/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php b/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php index daa06c4d8..6f73b9d31 100644 --- a/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php +++ b/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php @@ -29,14 +29,19 @@ class ServerDetailsController extends ApplicationApiController * * Update the details for a specific server. * + * @return array + * * @throws \App\Exceptions\DisplayException * @throws \App\Exceptions\Model\DataValidationException */ public function details(UpdateServerDetailsRequest $request, Server $server): array { + /** @var array $validated */ + $validated = $request->validated(); + $updated = $this->detailsModificationService->returnUpdatedModel()->handle( $server, - $request->validated() + $validated, ); return $this->fractal->item($updated) @@ -49,6 +54,8 @@ class ServerDetailsController extends ApplicationApiController * * Update the build details for a specific server. * + * @return array + * * @throws \App\Exceptions\DisplayException * @throws \App\Exceptions\Model\DataValidationException */ diff --git a/app/Http/Controllers/Api/Application/Servers/StartupController.php b/app/Http/Controllers/Api/Application/Servers/StartupController.php index c6468e638..9006677b1 100644 --- a/app/Http/Controllers/Api/Application/Servers/StartupController.php +++ b/app/Http/Controllers/Api/Application/Servers/StartupController.php @@ -29,6 +29,8 @@ class StartupController extends ApplicationApiController * * Update the startup and environment settings for a specific server. * + * @return array + * * @throws ValidationException * @throws ConnectionException * @throws DataValidationException diff --git a/app/Http/Controllers/Api/Application/Users/ExternalUserController.php b/app/Http/Controllers/Api/Application/Users/ExternalUserController.php index 4407e5fa7..e5aca532b 100644 --- a/app/Http/Controllers/Api/Application/Users/ExternalUserController.php +++ b/app/Http/Controllers/Api/Application/Users/ExternalUserController.php @@ -15,10 +15,12 @@ class ExternalUserController extends ApplicationApiController * View user (external id) * * Retrieve a specific user from the database using their external ID. + * + * @return array */ - 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) ->transformWith($this->getTransformer(UserTransformer::class)) diff --git a/app/Http/Controllers/Api/Application/Users/UserController.php b/app/Http/Controllers/Api/Application/Users/UserController.php index e2bb49b5f..30c495506 100644 --- a/app/Http/Controllers/Api/Application/Users/UserController.php +++ b/app/Http/Controllers/Api/Application/Users/UserController.php @@ -36,6 +36,8 @@ class UserController extends ApplicationApiController * 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 * the request. + * + * @return 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 * were defined in the request. + * + * @return 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 * meta. If there are no errors this is an empty array. * + * @return array + * * @throws \App\Exceptions\Model\DataValidationException */ public function update(UpdateUserRequest $request, User $user): array @@ -89,6 +95,8 @@ class UserController extends ApplicationApiController * Assign role to user * * Assign roles to a user. + * + * @return array */ public function assignRoles(AssignUserRolesRequest $request, User $user): array { @@ -110,6 +118,8 @@ class UserController extends ApplicationApiController * Unassign role from user * * Removes roles from a user. + * + * @return array */ public function removeRoles(AssignUserRolesRequest $request, User $user): array { diff --git a/app/Http/Controllers/Api/Client/AccountController.php b/app/Http/Controllers/Api/Client/AccountController.php index bf5accf87..0c9142f6f 100644 --- a/app/Http/Controllers/Api/Client/AccountController.php +++ b/app/Http/Controllers/Api/Client/AccountController.php @@ -25,6 +25,8 @@ class AccountController extends ClientApiController /** * View account + * + * @return array */ public function index(Request $request): array { diff --git a/app/Http/Controllers/Api/Client/ActivityLogController.php b/app/Http/Controllers/Api/Client/ActivityLogController.php index 772c4f98e..550b123a9 100644 --- a/app/Http/Controllers/Api/Client/ActivityLogController.php +++ b/app/Http/Controllers/Api/Client/ActivityLogController.php @@ -14,6 +14,8 @@ class ActivityLogController extends ClientApiController * List activity logs * * Returns a paginated set of the user's activity logs. + * + * @return array */ public function __invoke(ClientApiRequest $request): array { diff --git a/app/Http/Controllers/Api/Client/ApiKeyController.php b/app/Http/Controllers/Api/Client/ApiKeyController.php index c1ebe128f..29b2c3ab6 100644 --- a/app/Http/Controllers/Api/Client/ApiKeyController.php +++ b/app/Http/Controllers/Api/Client/ApiKeyController.php @@ -16,6 +16,8 @@ class ApiKeyController extends ClientApiController * List api keys * * Returns all the API keys that exist for the given client. + * + * @return 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. * + * @return array + * * @throws \App\Exceptions\DisplayException */ public function store(StoreApiKeyRequest $request): array diff --git a/app/Http/Controllers/Api/Client/ClientApiController.php b/app/Http/Controllers/Api/Client/ClientApiController.php index 8d409a754..fb21e025c 100644 --- a/app/Http/Controllers/Api/Client/ClientApiController.php +++ b/app/Http/Controllers/Api/Client/ClientApiController.php @@ -10,6 +10,9 @@ abstract class ClientApiController extends ApplicationApiController { /** * Returns only the includes which are valid for the given transformer. + * + * @param array $merge + * @return 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. + * + * @return array */ protected function parseIncludes(): array { diff --git a/app/Http/Controllers/Api/Client/ClientController.php b/app/Http/Controllers/Api/Client/ClientController.php index 0c839478a..e307de220 100644 --- a/app/Http/Controllers/Api/Client/ClientController.php +++ b/app/Http/Controllers/Api/Client/ClientController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api\Client; use App\Models\Server; use App\Models\Permission; +use Illuminate\Support\Collection; use Spatie\QueryBuilder\QueryBuilder; use Spatie\QueryBuilder\AllowedFilter; use App\Models\Filters\MultiFieldServerFilter; @@ -27,6 +28,8 @@ class ClientController extends ClientApiController * * Return all the servers available to the client making the API * request, including servers the user has access to as a subuser. + * + * @return array */ public function index(GetServersRequest $request): array { @@ -74,6 +77,8 @@ class ClientController extends ClientApiController * List subuser permissions * * Returns all the subuser permissions available on the system. + * + * @return array{object: string, attributes: array{permissions: Collection}} */ public function permissions(): array { diff --git a/app/Http/Controllers/Api/Client/SSHKeyController.php b/app/Http/Controllers/Api/Client/SSHKeyController.php index 2507c9308..438cfdac5 100644 --- a/app/Http/Controllers/Api/Client/SSHKeyController.php +++ b/app/Http/Controllers/Api/Client/SSHKeyController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Api\Client; +use App\Models\UserSSHKey; use Illuminate\Http\JsonResponse; use App\Facades\Activity; use App\Http\Requests\Api\Client\ClientApiRequest; @@ -13,8 +14,9 @@ class SSHKeyController extends ClientApiController /** * List ssh keys * - * Returns all the SSH keys that have been configured for the logged-in - * user account. + * Returns all the SSH keys that have been configured for the logged-in user account. + * + * @return array */ public function index(ClientApiRequest $request): array { @@ -27,6 +29,8 @@ class SSHKeyController extends ClientApiController * Create ssh keys * * Stores a new SSH key for the authenticated user's account. + * + * @return array */ public function store(StoreSSHKeyRequest $request): array { @@ -55,6 +59,7 @@ class SSHKeyController extends ClientApiController { $request->validate(['fingerprint' => ['required', 'string']]); + /** @var ?UserSSHKey $key */ $key = $request->user()->sshKeys() ->where('fingerprint', $request->input('fingerprint')) ->first(); diff --git a/app/Http/Controllers/Api/Client/Servers/ActivityLogController.php b/app/Http/Controllers/Api/Client/Servers/ActivityLogController.php index 4bc173845..59210456c 100644 --- a/app/Http/Controllers/Api/Client/Servers/ActivityLogController.php +++ b/app/Http/Controllers/Api/Client/Servers/ActivityLogController.php @@ -24,6 +24,8 @@ class ActivityLogController extends ClientApiController * List activity logs * * Returns the activity logs for a server. + * + * @return array */ public function __invoke(ClientApiRequest $request, Server $server): array { diff --git a/app/Http/Controllers/Api/Client/Servers/BackupController.php b/app/Http/Controllers/Api/Client/Servers/BackupController.php index 7ba1f5b94..df908c74f 100644 --- a/app/Http/Controllers/Api/Client/Servers/BackupController.php +++ b/app/Http/Controllers/Api/Client/Servers/BackupController.php @@ -36,8 +36,9 @@ class BackupController extends ClientApiController /** * List backups * - * Returns all the backups for a given server instance in a paginated - * result set. + * Returns all the backups for a given server instance in a paginated result set. + * + * @return array * * @throws AuthorizationException */ @@ -62,6 +63,8 @@ class BackupController extends ClientApiController * * Starts the backup process for a server. * + * @return array + * * @throws \Spatie\Fractalistic\Exceptions\InvalidTransformation * @throws \Spatie\Fractalistic\Exceptions\NoTransformerSpecified * @throws \Throwable @@ -96,6 +99,8 @@ class BackupController extends ClientApiController * * Toggles the lock status of a given backup for a server. * + * @return array + * * @throws \Throwable * @throws \Illuminate\Auth\Access\AuthorizationException */ @@ -121,6 +126,8 @@ class BackupController extends ClientApiController * * Returns information about a single backup. * + * @return array + * * @throws \Illuminate\Auth\Access\AuthorizationException */ public function view(Request $request, Server $server, Backup $backup): array diff --git a/app/Http/Controllers/Api/Client/Servers/DatabaseController.php b/app/Http/Controllers/Api/Client/Servers/DatabaseController.php index cc1540543..62be4125a 100644 --- a/app/Http/Controllers/Api/Client/Servers/DatabaseController.php +++ b/app/Http/Controllers/Api/Client/Servers/DatabaseController.php @@ -35,6 +35,8 @@ class DatabaseController extends ClientApiController * List databases * * Return all the databases that belong to the given server. + * + * @return 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. * + * @return array + * * @throws \Throwable * @throws \App\Exceptions\Service\Database\TooManyDatabasesException * @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 * the caller. * + * @return array + * * @throws \Throwable */ public function rotatePassword(RotatePasswordRequest $request, Server $server, Database $database): array diff --git a/app/Http/Controllers/Api/Client/Servers/FileController.php b/app/Http/Controllers/Api/Client/Servers/FileController.php index 5ab3e724e..88162a776 100644 --- a/app/Http/Controllers/Api/Client/Servers/FileController.php +++ b/app/Http/Controllers/Api/Client/Servers/FileController.php @@ -43,6 +43,8 @@ class FileController extends ClientApiController * * Returns a listing of files in a given directory. * + * @return array + * * @throws ConnectionException */ public function directory(ListFilesRequest $request, Server $server): array @@ -80,8 +82,9 @@ class FileController extends ClientApiController /** * Download file * - * Generates a one-time token with a link that the user can use to - * download a given file. + * Generates a one-time token with a link that the user can use to download a given file. + * + * @return array * * @throws \Throwable */ @@ -199,6 +202,8 @@ class FileController extends ClientApiController /** * Compress files * + * @return array + * * @throws ConnectionException */ public function compress(CompressFilesRequest $request, Server $server): array diff --git a/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php b/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php index b630ce282..55e8023ac 100644 --- a/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php +++ b/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php @@ -34,6 +34,8 @@ class NetworkAllocationController extends ClientApiController * * Lists all the allocations available to a server and whether * they are currently assigned as the primary for this server. + * + * @return array */ public function index(GetNetworkRequest $request, Server $server): array { @@ -47,6 +49,8 @@ class NetworkAllocationController extends ClientApiController * * Set the primary allocation for a server. * + * @return array + * * @throws \App\Exceptions\Model\DataValidationException */ 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. * + * @return array + * * @throws \App\Exceptions\Model\DataValidationException */ 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. * + * @return array + * * @throws \App\Exceptions\DisplayException */ public function store(NewAllocationRequest $request, Server $server): array diff --git a/app/Http/Controllers/Api/Client/Servers/ResourceUtilizationController.php b/app/Http/Controllers/Api/Client/Servers/ResourceUtilizationController.php index c7ee0db32..587a71850 100644 --- a/app/Http/Controllers/Api/Client/Servers/ResourceUtilizationController.php +++ b/app/Http/Controllers/Api/Client/Servers/ResourceUtilizationController.php @@ -30,6 +30,8 @@ class ResourceUtilizationController extends ClientApiController * 20 seconds at a time to ensure that repeated requests to this endpoint do not cause * a flood of unnecessary API calls. * + * @return array + * * @throws ConnectionException */ public function __invoke(GetServerRequest $request, Server $server): array diff --git a/app/Http/Controllers/Api/Client/Servers/ScheduleController.php b/app/Http/Controllers/Api/Client/Servers/ScheduleController.php index c7d382a2c..3081633bd 100644 --- a/app/Http/Controllers/Api/Client/Servers/ScheduleController.php +++ b/app/Http/Controllers/Api/Client/Servers/ScheduleController.php @@ -38,6 +38,8 @@ class ScheduleController extends ClientApiController * List schedules * * Returns all the schedules belonging to a given server. + * + * @return array */ public function index(ViewScheduleRequest $request, Server $server): array { @@ -53,6 +55,8 @@ class ScheduleController extends ClientApiController * * Store a new schedule for a server. * + * @return array + * * @throws \App\Exceptions\DisplayException * @throws \App\Exceptions\Model\DataValidationException */ @@ -86,6 +90,8 @@ class ScheduleController extends ClientApiController * View schedule * * Returns a specific schedule for the server. + * + * @return 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. * + * @return array + * * @throws \App\Exceptions\DisplayException * @throws \App\Exceptions\Model\DataValidationException */ diff --git a/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php b/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php index 304d192f4..398ac3ca0 100644 --- a/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php +++ b/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php @@ -36,6 +36,8 @@ class ScheduleTaskController extends ClientApiController * * Create a new task for a given schedule and store it in the database. * + * @return array + * * @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Service\ServiceLimitExceededException */ @@ -99,6 +101,8 @@ class ScheduleTaskController extends ClientApiController * * Updates a given task for a server. * + * @return array + * * @throws \App\Exceptions\Model\DataValidationException */ public function update(StoreTaskRequest $request, Server $server, Schedule $schedule, Task $task): array diff --git a/app/Http/Controllers/Api/Client/Servers/ServerController.php b/app/Http/Controllers/Api/Client/Servers/ServerController.php index 2697d9875..f2c7383b0 100644 --- a/app/Http/Controllers/Api/Client/Servers/ServerController.php +++ b/app/Http/Controllers/Api/Client/Servers/ServerController.php @@ -12,9 +12,6 @@ use Dedoc\Scramble\Attributes\Group; #[Group('Server', weight: 0)] class ServerController extends ClientApiController { - /** - * ServerController constructor. - */ public function __construct(private GetUserPermissionsService $permissionsService) { parent::__construct(); @@ -23,8 +20,9 @@ class ServerController extends ClientApiController /** * View server * - * Transform an individual server into a response that can be consumed by a - * client using the API. + * Transform an individual server into a response that can be consumed by a client using the API. + * + * @return array */ public function index(GetServerRequest $request, Server $server): array { diff --git a/app/Http/Controllers/Api/Client/Servers/StartupController.php b/app/Http/Controllers/Api/Client/Servers/StartupController.php index 22e9cf7e8..0e09ae202 100644 --- a/app/Http/Controllers/Api/Client/Servers/StartupController.php +++ b/app/Http/Controllers/Api/Client/Servers/StartupController.php @@ -29,6 +29,8 @@ class StartupController extends ClientApiController * List startup variables * * Returns the startup information for the server including all the variables. + * + * @return array */ public function index(GetStartupRequest $request, Server $server): array { @@ -51,6 +53,8 @@ class StartupController extends ClientApiController * * Updates a single variable for a server. * + * @return array + * * @throws \Illuminate\Validation\ValidationException * @throws \App\Exceptions\Model\DataValidationException */ diff --git a/app/Http/Controllers/Api/Client/Servers/SubuserController.php b/app/Http/Controllers/Api/Client/Servers/SubuserController.php index 168e30df7..5985689d4 100644 --- a/app/Http/Controllers/Api/Client/Servers/SubuserController.php +++ b/app/Http/Controllers/Api/Client/Servers/SubuserController.php @@ -37,6 +37,8 @@ class SubuserController extends ClientApiController * List subusers * * Return the users associated with this server instance. + * + * @return array */ public function index(GetSubuserRequest $request, Server $server): array { @@ -49,6 +51,8 @@ class SubuserController extends ClientApiController * View subusers * * Returns a single subuser associated with this server instance. + * + * @return 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. * + * @return array + * * @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Service\Subuser\ServerSubuserExistsException * @throws \App\Exceptions\Service\Subuser\UserIsServerOwnerException @@ -92,6 +98,8 @@ class SubuserController extends ClientApiController * * Update a given subuser in the system for the server. * + * @return array + * * @throws \App\Exceptions\Model\DataValidationException */ 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 * that were passed that do not also exist in the internally tracked list of * permissions. + * + * @return array */ protected function getDefaultPermissions(Request $request): array { diff --git a/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php b/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php index 8bc550f53..bb2290c49 100644 --- a/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php +++ b/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php @@ -104,8 +104,9 @@ class BackupStatusController extends Controller } /** - * Marks a multipart upload in a given S3-compatible instance as failed or successful for - * the given backup. + * Marks a multipart upload in a given S3-compatible instance as failed or successful for the given backup. + * + * @param ?array $parts * * @throws \Exception * @throws \App\Exceptions\DisplayException diff --git a/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php b/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php index 91ed098db..bd3bc166a 100644 --- a/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php +++ b/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php @@ -11,6 +11,8 @@ class AuthenticateServerAccess { /** * Routes that this middleware should not apply to if the user is an admin. + * + * @var string[] */ protected array $except = [ 'api:client:server.ws', diff --git a/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php b/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php index 0ead01f1d..46ddfdcfc 100644 --- a/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php +++ b/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php @@ -37,7 +37,7 @@ class ResourceBelongsToServer $server = $request->route()->parameter('server'); $exception = new NotFoundHttpException('The requested resource was not found for this server.'); 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 // is not currently a Model instance since those will just end up being // a 404 down the road. @@ -46,7 +46,7 @@ class ResourceBelongsToServer } 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. case Allocation::class: case Backup::class: diff --git a/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php b/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php index 5bacb25b6..ba29726fc 100644 --- a/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php +++ b/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php @@ -12,6 +12,8 @@ class DaemonAuthenticate { /** * Daemon routes that this middleware should be skipped on. + * + * @var string[] */ protected array $except = [ 'daemon.configuration', diff --git a/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php b/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php index 03b221e1f..db4a7bd8d 100644 --- a/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php +++ b/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php @@ -12,6 +12,7 @@ class StoreAllocationRequest extends ApplicationApiRequest protected int $permission = AdminAcl::WRITE; + /** @return array */ public function rules(): array { return [ @@ -22,6 +23,9 @@ class StoreAllocationRequest extends ApplicationApiRequest ]; } + /** + * @return array + */ public function validated($key = null, $default = null): array { $data = parent::validated(); diff --git a/app/Http/Requests/Api/Application/ApplicationApiRequest.php b/app/Http/Requests/Api/Application/ApplicationApiRequest.php index 7dac16d27..b22aeb7f8 100644 --- a/app/Http/Requests/Api/Application/ApplicationApiRequest.php +++ b/app/Http/Requests/Api/Application/ApplicationApiRequest.php @@ -51,9 +51,7 @@ abstract class ApplicationApiRequest extends FormRequest return AdminAcl::check($token, $this->resource, $this->permission); } - /** - * Default set of rules to apply to API requests. - */ + /** @return array */ public function rules(): array { return []; diff --git a/app/Http/Requests/Api/Application/DatabaseHosts/StoreDatabaseHostRequest.php b/app/Http/Requests/Api/Application/DatabaseHosts/StoreDatabaseHostRequest.php index b7c26f0e8..5530aebe3 100644 --- a/app/Http/Requests/Api/Application/DatabaseHosts/StoreDatabaseHostRequest.php +++ b/app/Http/Requests/Api/Application/DatabaseHosts/StoreDatabaseHostRequest.php @@ -12,6 +12,10 @@ class StoreDatabaseHostRequest extends ApplicationApiRequest protected int $permission = AdminAcl::WRITE; + /** + * @param array|null $rules + * @return array + */ public function rules(?array $rules = null): array { return $rules ?? DatabaseHost::getRules(); diff --git a/app/Http/Requests/Api/Application/DatabaseHosts/UpdateDatabaseHostRequest.php b/app/Http/Requests/Api/Application/DatabaseHosts/UpdateDatabaseHostRequest.php index f14b9b90f..128188ed9 100644 --- a/app/Http/Requests/Api/Application/DatabaseHosts/UpdateDatabaseHostRequest.php +++ b/app/Http/Requests/Api/Application/DatabaseHosts/UpdateDatabaseHostRequest.php @@ -6,6 +6,7 @@ use App\Models\DatabaseHost; class UpdateDatabaseHostRequest extends StoreDatabaseHostRequest { + /** @return array */ public function rules(?array $rules = null): array { /** @var DatabaseHost $databaseHost */ diff --git a/app/Http/Requests/Api/Application/Mounts/UpdateMountRequest.php b/app/Http/Requests/Api/Application/Mounts/UpdateMountRequest.php index 05e7d0a23..bfdb87a6f 100644 --- a/app/Http/Requests/Api/Application/Mounts/UpdateMountRequest.php +++ b/app/Http/Requests/Api/Application/Mounts/UpdateMountRequest.php @@ -7,7 +7,8 @@ use App\Models\Mount; class UpdateMountRequest extends StoreMountRequest { /** - * Apply validation rules to this request. + * @param array|null $rules + * @return array */ public function rules(?array $rules = null): array { diff --git a/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php index 7e8404b0d..c24d5518a 100644 --- a/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php @@ -13,7 +13,8 @@ class StoreNodeRequest extends ApplicationApiRequest protected int $permission = AdminAcl::WRITE; /** - * Validation rules to apply to this request. + * @param array|null $rules + * @return 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. + * + * @return 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 * to match what the application expects in the services. + * + * @return array */ public function validated($key = null, $default = null): array { diff --git a/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php index 5907860a2..24a7186e1 100644 --- a/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php @@ -7,8 +7,8 @@ use App\Models\Node; class UpdateNodeRequest extends StoreNodeRequest { /** - * Apply validation rules to this request. Uses the parent class rules() - * function but passes in the rules for updating rather than creating. + * @param array|null $rules + * @return array */ public function rules(?array $rules = null): array { diff --git a/app/Http/Requests/Api/Application/Roles/StoreRoleRequest.php b/app/Http/Requests/Api/Application/Roles/StoreRoleRequest.php index 0b2afedcb..63ce88d77 100644 --- a/app/Http/Requests/Api/Application/Roles/StoreRoleRequest.php +++ b/app/Http/Requests/Api/Application/Roles/StoreRoleRequest.php @@ -12,6 +12,10 @@ class StoreRoleRequest extends ApplicationApiRequest protected int $permission = AdminAcl::WRITE; + /** + * @param array|null $rules + * @return array + */ public function rules(?array $rules = null): array { return [ diff --git a/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php b/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php index 16ec4d716..bfa08af4a 100644 --- a/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php +++ b/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php @@ -42,6 +42,12 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest /** * 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 { @@ -54,6 +60,8 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest /** * Format error messages in a more understandable format for API output. + * + * @return array */ public function attributes(): array { diff --git a/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php b/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php index 07f4b2636..1c217dd68 100644 --- a/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php +++ b/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php @@ -68,6 +68,31 @@ class StoreServerRequest extends ApplicationApiRequest /** * 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 { diff --git a/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php b/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php index 7b0fcad10..8c8d9e0ec 100644 --- a/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php +++ b/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php @@ -49,6 +49,8 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest /** * Convert the allocation field into the expected format for the service handler. + * + * @return 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. + * + * @return 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 * compatability with the old API endpoint while also supporting a more correct API * call. + * + * @param array $rules + * @return array */ protected function requiredToOptional(string $field, array $rules, bool $limits = false): array { diff --git a/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php b/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php index 45a05c7e3..0d781a9bf 100644 --- a/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php +++ b/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php @@ -22,8 +22,9 @@ class UpdateServerDetailsRequest extends ServerWriteRequest } /** - * Convert the posted data into the correct format that is expected - * by the application. + * Convert the posted data into the correct format that is expected by the application. + * + * @return 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 * being discussed. + * + * @return array */ public function attributes(): array { diff --git a/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php b/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php index 255908b48..c03bb9bdb 100644 --- a/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php +++ b/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php @@ -30,6 +30,8 @@ class UpdateServerStartupRequest extends ApplicationApiRequest /** * Return the validated data in a format that is expected by the service. + * + * @return array */ public function validated($key = null, $default = null): array { diff --git a/app/Http/Requests/Api/Application/Users/AssignUserRolesRequest.php b/app/Http/Requests/Api/Application/Users/AssignUserRolesRequest.php index 61e191c20..9dbcfb127 100644 --- a/app/Http/Requests/Api/Application/Users/AssignUserRolesRequest.php +++ b/app/Http/Requests/Api/Application/Users/AssignUserRolesRequest.php @@ -4,9 +4,7 @@ namespace App\Http\Requests\Api\Application\Users; class AssignUserRolesRequest extends StoreUserRequest { - /** - * Return the validation rules for this request. - */ + /** @return array */ public function rules(?array $rules = null): array { return [ diff --git a/app/Http/Requests/Api/Application/Users/StoreUserRequest.php b/app/Http/Requests/Api/Application/Users/StoreUserRequest.php index a35af9219..24a589c88 100644 --- a/app/Http/Requests/Api/Application/Users/StoreUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/StoreUserRequest.php @@ -13,7 +13,8 @@ class StoreUserRequest extends ApplicationApiRequest protected int $permission = AdminAcl::WRITE; /** - * Return the validation rules for this request. + * @param array |null $rules + * @return 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 */ public function attributes(): array { diff --git a/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php b/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php index 9ec5067a5..6c2a8c2bb 100644 --- a/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php @@ -7,7 +7,8 @@ use App\Models\User; class UpdateUserRequest extends StoreUserRequest { /** - * Return the validation rules for this request. + * @param array |null $rules + * @return array */ public function rules(?array $rules = null): array { diff --git a/app/Http/Requests/Api/Client/Account/StoreApiKeyRequest.php b/app/Http/Requests/Api/Client/Account/StoreApiKeyRequest.php index e0034fcfe..429d1c595 100644 --- a/app/Http/Requests/Api/Client/Account/StoreApiKeyRequest.php +++ b/app/Http/Requests/Api/Client/Account/StoreApiKeyRequest.php @@ -9,6 +9,7 @@ use App\Http\Requests\Api\Client\ClientApiRequest; class StoreApiKeyRequest extends ClientApiRequest { + /** @return array */ public function rules(): array { $rules = ApiKey::getRules(); diff --git a/app/Http/Requests/Api/Client/Account/StoreSSHKeyRequest.php b/app/Http/Requests/Api/Client/Account/StoreSSHKeyRequest.php index 132555eb4..6da886651 100644 --- a/app/Http/Requests/Api/Client/Account/StoreSSHKeyRequest.php +++ b/app/Http/Requests/Api/Client/Account/StoreSSHKeyRequest.php @@ -15,9 +15,7 @@ class StoreSSHKeyRequest extends ClientApiRequest { protected ?PublicKey $key; - /** - * Returns the rules for this request. - */ + /** @return array */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php b/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php index 14eb3d970..202add5f0 100644 --- a/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php @@ -43,6 +43,9 @@ class StoreDatabaseRequest extends ClientApiRequest implements ClientPermissions ]; } + /** + * @return array + */ public function messages(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/DeleteFileRequest.php b/app/Http/Requests/Api/Client/Servers/Files/DeleteFileRequest.php index 880f61790..8ca0b7cde 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/DeleteFileRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/DeleteFileRequest.php @@ -13,6 +13,9 @@ class DeleteFileRequest extends ClientApiRequest implements ClientPermissionsReq return Permission::ACTION_FILE_DELETE; } + /** + * @return string[] + */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php index 87138f925..cb9933256 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php @@ -47,6 +47,8 @@ abstract class SubuserRequest extends ClientApiRequest * Validates that the permissions we are trying to assign can actually be assigned * by the user making the request. * + * @param string[] $permissions + * * @throws \Illuminate\Contracts\Container\BindingResolutionException */ protected function validatePermissionsCanBeAssigned(array $permissions): void diff --git a/app/Http/Requests/Api/Remote/ActivityEventRequest.php b/app/Http/Requests/Api/Remote/ActivityEventRequest.php index 8963a1a3d..6c687df31 100644 --- a/app/Http/Requests/Api/Remote/ActivityEventRequest.php +++ b/app/Http/Requests/Api/Remote/ActivityEventRequest.php @@ -12,6 +12,9 @@ class ActivityEventRequest extends FormRequest return true; } + /** + * @return array + */ public function rules(): array { return [ @@ -28,6 +31,8 @@ class ActivityEventRequest extends FormRequest /** * Returns all the unique server UUIDs that were received in this request. + * + * @return string[] */ public function servers(): array { @@ -36,6 +41,8 @@ class ActivityEventRequest extends FormRequest /** * Returns all the unique user UUIDs that were submitted in this request. + * + * @return string[] */ public function users(): array { diff --git a/app/Http/Requests/Api/Remote/InstallationDataRequest.php b/app/Http/Requests/Api/Remote/InstallationDataRequest.php index 5f3bff1a1..99adcef5f 100644 --- a/app/Http/Requests/Api/Remote/InstallationDataRequest.php +++ b/app/Http/Requests/Api/Remote/InstallationDataRequest.php @@ -11,6 +11,9 @@ class InstallationDataRequest extends FormRequest return true; } + /** + * @return array + */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Remote/ReportBackupCompleteRequest.php b/app/Http/Requests/Api/Remote/ReportBackupCompleteRequest.php index b1a96a2d6..246c07ff4 100644 --- a/app/Http/Requests/Api/Remote/ReportBackupCompleteRequest.php +++ b/app/Http/Requests/Api/Remote/ReportBackupCompleteRequest.php @@ -6,6 +6,7 @@ use Illuminate\Foundation\Http\FormRequest; class ReportBackupCompleteRequest extends FormRequest { + /** @return array */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Remote/SftpAuthenticationFormRequest.php b/app/Http/Requests/Api/Remote/SftpAuthenticationFormRequest.php index aacd145f1..d2fb47e48 100644 --- a/app/Http/Requests/Api/Remote/SftpAuthenticationFormRequest.php +++ b/app/Http/Requests/Api/Remote/SftpAuthenticationFormRequest.php @@ -16,6 +16,8 @@ class SftpAuthenticationFormRequest extends FormRequest /** * Rules to apply to the request. + * + * @return 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. * This will include empty fields as a null value. + * + * @return array */ public function normalize(): array { diff --git a/app/Http/Requests/Auth/LoginCheckpointRequest.php b/app/Http/Requests/Auth/LoginCheckpointRequest.php index ddd97ee24..0ede74087 100644 --- a/app/Http/Requests/Auth/LoginCheckpointRequest.php +++ b/app/Http/Requests/Auth/LoginCheckpointRequest.php @@ -17,6 +17,8 @@ class LoginCheckpointRequest extends FormRequest /** * Rules to apply to the request. + * + * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Auth/ResetPasswordRequest.php b/app/Http/Requests/Auth/ResetPasswordRequest.php index cf262afb9..042922e11 100644 --- a/app/Http/Requests/Auth/ResetPasswordRequest.php +++ b/app/Http/Requests/Auth/ResetPasswordRequest.php @@ -11,6 +11,9 @@ class ResetPasswordRequest extends FormRequest return true; } + /** + * @return array + */ public function rules(): array { return [ diff --git a/app/Http/Resources/Daemon/ServerConfigurationCollection.php b/app/Http/Resources/Daemon/ServerConfigurationCollection.php index 81ae5daf4..bd8ab4f69 100644 --- a/app/Http/Resources/Daemon/ServerConfigurationCollection.php +++ b/app/Http/Resources/Daemon/ServerConfigurationCollection.php @@ -15,10 +15,15 @@ class ServerConfigurationCollection extends ResourceCollection * 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 * have some serious performance issues from all the N+1 queries. + * + * @return array */ public function toArray($request): array { + /** @var EggConfigurationService $egg */ $egg = Container::getInstance()->make(EggConfigurationService::class); + + /** @var ServerConfigurationStructureService $configuration */ $configuration = Container::getInstance()->make(ServerConfigurationStructureService::class); return $this->collection->map(function (Server $server) use ($configuration, $egg) { diff --git a/app/Jobs/ProcessWebhook.php b/app/Jobs/ProcessWebhook.php index cf2485e84..724789ee6 100644 --- a/app/Jobs/ProcessWebhook.php +++ b/app/Jobs/ProcessWebhook.php @@ -14,6 +14,9 @@ class ProcessWebhook implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; + /** + * @param array $data + */ public function __construct( private WebhookConfiguration $webhookConfiguration, private string $eventName, diff --git a/app/Listeners/DispatchWebhooks.php b/app/Listeners/DispatchWebhooks.php index 05a2d7e22..1d0febaba 100644 --- a/app/Listeners/DispatchWebhooks.php +++ b/app/Listeners/DispatchWebhooks.php @@ -7,6 +7,9 @@ use App\Models\WebhookConfiguration; class DispatchWebhooks { + /** + * @param array $data + */ public function handle(string $eventName, array $data): void { if (!$this->eventIsWatched($eventName)) { diff --git a/app/Livewire/AlertBanner.php b/app/Livewire/AlertBanner.php index 5c99d4ee6..a35ebae8f 100644 --- a/app/Livewire/AlertBanner.php +++ b/app/Livewire/AlertBanner.php @@ -27,6 +27,9 @@ final class AlertBanner implements Wireable return $static; } + /** + * @return array{id: string, title: ?string, body: ?string, status: ?string, icon: ?string, closeable: bool} + */ public function toLivewire(): array { return [ diff --git a/app/Livewire/AlertBannerContainer.php b/app/Livewire/AlertBannerContainer.php index 5b1901c04..450cfc689 100644 --- a/app/Livewire/AlertBannerContainer.php +++ b/app/Livewire/AlertBannerContainer.php @@ -7,6 +7,7 @@ use Livewire\Component; class AlertBannerContainer extends Component { + /** @var array */ public array $alertBanners; public function mount(): void diff --git a/app/Livewire/Installer/PanelInstaller.php b/app/Livewire/Installer/PanelInstaller.php index 9a14685e8..370412c15 100644 --- a/app/Livewire/Installer/PanelInstaller.php +++ b/app/Livewire/Installer/PanelInstaller.php @@ -36,6 +36,7 @@ class PanelInstaller extends SimplePage implements HasForms use EnvironmentWriterTrait; use InteractsWithForms; + /** @var array */ public array $data = []; protected static string $view = 'filament.pages.installer'; diff --git a/app/Models/ActivityLog.php b/app/Models/ActivityLog.php index 1e666c9f9..84677e525 100644 --- a/app/Models/ActivityLog.php +++ b/app/Models/ActivityLog.php @@ -72,6 +72,7 @@ class ActivityLog extends Model implements HasIcon, HasLabel protected $with = ['subjects']; + /** @var array */ public static array $validationRules = [ 'event' => ['required', 'string'], 'batch' => ['nullable', 'uuid'], @@ -93,6 +94,9 @@ class ActivityLog extends Model implements HasIcon, HasLabel return $this->morphTo()->withTrashed(); } + /** + * @return HasMany + */ public function subjects(): HasMany { return $this->hasMany(ActivityLogSubject::class); @@ -190,6 +194,9 @@ class ActivityLog extends Model implements HasIcon, HasLabel "; } + /** + * @return array + */ public function wrapProperties(): array { if (!$this->properties || $this->properties->isEmpty()) { diff --git a/app/Models/Allocation.php b/app/Models/Allocation.php index 702e8b5b8..016fc54af 100644 --- a/app/Models/Allocation.php +++ b/app/Models/Allocation.php @@ -57,13 +57,14 @@ class Allocation extends Model */ protected $guarded = ['id', 'created_at', 'updated_at']; + /** @var array */ public static array $validationRules = [ - 'node_id' => 'required|exists:nodes,id', - 'ip' => 'required|ip', - 'port' => 'required|numeric|between:1024,65535', - 'ip_alias' => 'nullable|string', - 'server_id' => 'nullable|exists:servers,id', - 'notes' => 'nullable|string|max:256', + 'node_id' => ['required', 'exists:nodes,id'], + 'ip' => ['required', 'ip'], + 'port' => ['required', 'numeric', 'between:1024,65535'], + 'ip_alias' => ['nullable', 'string'], + 'server_id' => ['nullable', 'exists:servers,id'], + 'notes' => ['nullable', 'string', 'max:256'], ]; protected static function booted(): void diff --git a/app/Models/ApiKey.php b/app/Models/ApiKey.php index c270a61a2..d80e572c9 100644 --- a/app/Models/ApiKey.php +++ b/app/Models/ApiKey.php @@ -18,8 +18,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; * @property int $key_type * @property string $identifier * @property string $token - * @property array $permissions - * @property array $allowed_ips + * @property string[] $permissions + * @property string[] $allowed_ips * @property string|null $memo * @property \Illuminate\Support\Carbon|null $last_used_at * @property \Illuminate\Support\Carbon|null $expires_at @@ -110,9 +110,7 @@ class ApiKey extends PersonalAccessToken */ protected $hidden = ['token']; - /** - * Rules to protect against invalid data entry to DB. - */ + /** @var array */ public static array $validationRules = [ 'user_id' => 'required|exists:users,id', 'key_type' => 'present|integer|min:0|max:2', @@ -151,7 +149,7 @@ class ApiKey extends PersonalAccessToken public function tokenable() { - // @phpstan-ignore-next-line + // @phpstan-ignore return.type return $this->user(); } @@ -175,6 +173,7 @@ class ApiKey extends PersonalAccessToken Role::RESOURCE_NAME, ]; + /** @var string[] */ protected static array $customResourceNames = []; public static function registerCustomResourceName(string $resourceName): void @@ -184,6 +183,8 @@ class ApiKey extends PersonalAccessToken /** * Returns a list of all possible permission keys. + * + * @return string[] */ public static function getPermissionList(): array { diff --git a/app/Models/Backup.php b/app/Models/Backup.php index 5fb1094cf..500b4df3f 100644 --- a/app/Models/Backup.php +++ b/app/Models/Backup.php @@ -50,6 +50,7 @@ class Backup extends Model implements Validatable protected $guarded = ['id', 'created_at', 'updated_at', 'deleted_at']; + /** @var array */ public static array $validationRules = [ 'server_id' => 'bail|required|numeric|exists:servers,id', 'uuid' => 'required|uuid', diff --git a/app/Models/Database.php b/app/Models/Database.php index b7aaac0b7..635807b8d 100644 --- a/app/Models/Database.php +++ b/app/Models/Database.php @@ -50,6 +50,7 @@ class Database extends Model implements Validatable 'server_id', 'database_host_id', 'database', 'username', 'password', 'remote', 'max_connections', ]; + /** @var array */ public static array $validationRules = [ 'server_id' => 'required|numeric|exists:servers,id', 'database_host_id' => 'required|exists:database_hosts,id', diff --git a/app/Models/DatabaseHost.php b/app/Models/DatabaseHost.php index e76192cff..4e5497c16 100644 --- a/app/Models/DatabaseHost.php +++ b/app/Models/DatabaseHost.php @@ -48,9 +48,7 @@ class DatabaseHost extends Model implements Validatable 'name', 'host', 'port', 'username', 'password', 'max_databases', ]; - /** - * Validation rules to assign to this model. - */ + /** @var array */ public static array $validationRules = [ 'name' => 'required|string|max:255', 'host' => 'required|string', diff --git a/app/Models/Egg.php b/app/Models/Egg.php index 1862d8066..fa20ec494 100644 --- a/app/Models/Egg.php +++ b/app/Models/Egg.php @@ -18,12 +18,12 @@ use Illuminate\Support\Str; * @property string $author * @property string $name * @property string|null $description - * @property array|null $features + * @property string[]|null $features * @property string $docker_image -- deprecated, use $docker_images - * @property array $docker_images + * @property array $docker_images * @property string|null $update_url * @property bool $force_outgoing_ip - * @property array|null $file_denylist + * @property string[]|null $file_denylist * @property string|null $config_files * @property string|null $config_startup * @property string|null $config_logs @@ -45,7 +45,7 @@ use Illuminate\Support\Str; * @property string|null $inherit_config_logs * @property string|null $inherit_config_stop * @property string $inherit_file_denylist - * @property array|null $inherit_features + * @property string[]|null $inherit_features * @property \Illuminate\Database\Eloquent\Collection|\App\Models\Server[] $servers * @property int|null $servers_count * @property \Illuminate\Database\Eloquent\Collection|\App\Models\EggVariable[] $variables @@ -109,6 +109,7 @@ class Egg extends Model implements Validatable 'tags', ]; + /** @var array */ public static array $validationRules = [ 'uuid' => 'required|string|size:36', 'name' => 'required|string|max:255', @@ -259,6 +260,8 @@ class Egg extends Model implements Validatable /** * Returns the features available to this egg from the parent configuration if there are * no features defined for this egg specifically and there is a parent egg configured. + * + * @return ?string[] */ public function getInheritFeaturesAttribute(): ?array { @@ -272,6 +275,8 @@ class Egg extends Model implements Validatable /** * Returns the features available to this egg from the parent configuration if there are * no features defined for this egg specifically and there is a parent egg configured. + * + * @return ?string[] */ public function getInheritFileDenylistAttribute(): ?array { diff --git a/app/Models/EggVariable.php b/app/Models/EggVariable.php index 23cbab7a9..4beb5c5ba 100644 --- a/app/Models/EggVariable.php +++ b/app/Models/EggVariable.php @@ -19,7 +19,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; * @property string $default_value * @property bool $user_viewable * @property bool $user_editable - * @property array $rules + * @property string[] $rules * @property \Carbon\CarbonImmutable $created_at * @property \Carbon\CarbonImmutable $updated_at * @property bool $required @@ -51,6 +51,7 @@ class EggVariable extends Model implements Validatable */ protected $guarded = ['id', 'created_at', 'updated_at']; + /** @var array */ public static array $validationRules = [ 'egg_id' => 'exists:eggs,id', 'sort' => 'nullable', diff --git a/app/Models/File.php b/app/Models/File.php index e79812a1f..ddd5a1a2b 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -112,6 +112,9 @@ class File extends Model ]; } + /** + * @return string[] + */ public function getSchema(): array { return [ @@ -128,6 +131,20 @@ class File extends Model ]; } + /** + * @return array + */ public function getRows(): array { try { diff --git a/app/Models/Mount.php b/app/Models/Mount.php index 86d374bc7..94d6860d4 100644 --- a/app/Models/Mount.php +++ b/app/Models/Mount.php @@ -33,11 +33,15 @@ class Mount extends Model implements Validatable /** * Fields that are not mass assignable. + * + * @var string[] */ protected $guarded = ['id']; /** * Rules verifying that the data being stored matches the expectations of the database. + * + * @var array> */ public static array $validationRules = [ 'name' => 'required|string|min:2|max:64|unique:mounts,name', @@ -49,8 +53,9 @@ class Mount extends Model implements Validatable ]; /** - * Implement language verification by overriding Eloquence's gather - * rules function. + * Implement language verification by overriding Eloquence's gather rules function. + * + * @return array */ public static function getRules(): array { @@ -69,6 +74,8 @@ class Mount extends Model implements Validatable /** * Blacklisted source paths. + * + * @var string[] */ public static array $invalidSourcePaths = [ '/etc/pelican', @@ -78,6 +85,8 @@ class Mount extends Model implements Validatable /** * Blacklisted target paths. + * + * @var string[] */ public static array $invalidTargetPaths = [ '/home/container', diff --git a/app/Models/Node.php b/app/Models/Node.php index caf614354..ce74560c9 100644 --- a/app/Models/Node.php +++ b/app/Models/Node.php @@ -41,7 +41,7 @@ use Symfony\Component\Yaml\Yaml; * @property int $daemon_sftp * @property string|null $daemon_sftp_alias * @property string $daemon_base - * @property array $tags + * @property string[] $tags * @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $updated_at * @property \App\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts @@ -85,6 +85,7 @@ class Node extends Model implements Validatable 'description', 'maintenance_mode', 'tags', ]; + /** @var array */ public static array $validationRules = [ 'name' => 'required|string|min:1|max:100', 'description' => 'string|nullable', @@ -172,6 +173,22 @@ class Node extends Model implements Validatable /** * Returns the configuration as an array. + * + * @return array{ + * debug: bool, + * uuid: string, + * token_id: string, + * token: string, + * api: array{ + * host: string, + * port: int, + * ssl: array{enabled: bool, cert: string, key: string}, + * upload_limit: int + * }, + * system: array{data: string, sftp: array{bind_port: int}}, + * allowed_mounts: string[], + * remote: string, + * } */ public function getConfiguration(): array { @@ -243,6 +260,9 @@ class Node extends Model implements Validatable return $this->hasMany(Allocation::class); } + /** + * @return BelongsToMany + */ public function databaseHosts(): BelongsToMany { return $this->belongsToMany(DatabaseHost::class); @@ -299,6 +319,7 @@ class Node extends Model implements Validatable })->values(); } + /** @return array */ public function systemInformation(): array { return once(function () { @@ -322,6 +343,9 @@ class Node extends Model implements Validatable }); } + /** + * @return array + */ public function serverStatuses(): array { $statuses = []; @@ -339,6 +363,14 @@ class Node extends Model implements Validatable return $statuses; } + /** @return array{ + * memory_total: int, memory_used: int, + * swap_total: int, swap_used: int, + * load_average1: float, load_average5: float, load_average15: float, + * cpu_percent: float, + * disk_total: int, disk_used: int, + * } + */ public function statistics(): array { $default = [ @@ -365,6 +397,7 @@ class Node extends Model implements Validatable } } + /** @return string[] */ public function ipAddresses(): array { return cache()->remember("nodes.$this->id.ips", now()->addHour(), function () { diff --git a/app/Models/Objects/DeploymentObject.php b/app/Models/Objects/DeploymentObject.php index 692ca7487..105cbfd72 100644 --- a/app/Models/Objects/DeploymentObject.php +++ b/app/Models/Objects/DeploymentObject.php @@ -6,8 +6,10 @@ class DeploymentObject { private bool $dedicated = false; + /** @var string[] */ private array $tags = []; + /** @var array */ private array $ports = []; public function isDedicated(): bool @@ -22,11 +24,13 @@ class DeploymentObject return $this; } + /** @return array */ public function getPorts(): array { return $this->ports; } + /** @param array $ports */ public function setPorts(array $ports): self { $this->ports = $ports; @@ -34,11 +38,18 @@ class DeploymentObject return $this; } + /** + * @return string[] + */ public function getTags(): array { return $this->tags; } + /** + * @param string[] $tags + * @return $this + */ public function setTags(array $tags): self { $this->tags = $tags; diff --git a/app/Models/Permission.php b/app/Models/Permission.php index 59bb97913..271ab3c9f 100644 --- a/app/Models/Permission.php +++ b/app/Models/Permission.php @@ -107,6 +107,7 @@ class Permission extends Model implements Validatable */ protected $guarded = ['id', 'created_at', 'updated_at']; + /** @var array */ public static array $validationRules = [ 'subuser_id' => 'required|numeric|min:1', 'permission' => 'required|string', @@ -116,7 +117,12 @@ class Permission extends Model implements Validatable * All the permissions available on the system. You should use self::permissions() * to retrieve them, and not directly access this array as it is subject to change. * - * @see \App\Models\Permission::permissions() + * @see Permission::permissions() + * + * @var array, + * }> */ protected static array $permissions = [ 'websocket' => [ @@ -166,7 +172,7 @@ class Permission extends Model implements Validatable 'read' => 'Allows a user to view all backups that exist for this server.', 'delete' => 'Allows a user to remove backups from the system.', 'download' => 'Allows a user to download a backup for the server. Danger: this allows a user to access all files for the server in the backup.', - 'restore' => 'Allows a user to restore a backup for the server. Danger: this allows the user to delete all of the server files in the process.', + 'restore' => 'Allows a user to restore a backup for the server. Danger: this allows the user to delete all the server files in the process.', ], ], @@ -236,8 +242,7 @@ class Permission extends Model implements Validatable } /** - * Returns all the permissions available on the system for a user to - * have when controlling a server. + * Returns all the permissions available on the system for a user to have when controlling a server. */ public static function permissions(): Collection { diff --git a/app/Models/RecoveryToken.php b/app/Models/RecoveryToken.php index e7b832709..e8db49264 100644 --- a/app/Models/RecoveryToken.php +++ b/app/Models/RecoveryToken.php @@ -25,6 +25,7 @@ class RecoveryToken extends Model implements Validatable public $timestamps = true; + /** @var array */ public static array $validationRules = [ 'token' => 'required|string', ]; diff --git a/app/Models/Schedule.php b/app/Models/Schedule.php index ba85428b8..364213b80 100644 --- a/app/Models/Schedule.php +++ b/app/Models/Schedule.php @@ -75,6 +75,7 @@ class Schedule extends Model implements Validatable 'only_when_online' => false, ]; + /** @var array */ public static array $validationRules = [ 'server_id' => 'required|exists:servers,id', 'name' => 'required|string|max:255', diff --git a/app/Models/Server.php b/app/Models/Server.php index 53fe692b0..49e3231ac 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -112,7 +112,7 @@ use App\Services\Subusers\SubuserDeletionService; * @method static \Illuminate\Database\Eloquent\Builder|Server whereUuid($value) * @method static \Illuminate\Database\Eloquent\Builder|Server whereuuid_short($value) * - * @property array|null $docker_labels + * @property string[]|null $docker_labels * @property string|null $ports * @property-read mixed $condition * @property-read \Illuminate\Database\Eloquent\Collection $eggVariables @@ -157,6 +157,7 @@ class Server extends Model implements Validatable */ protected $guarded = ['id', self::CREATED_AT, self::UPDATED_AT, 'deleted_at', 'installed_at']; + /** @var array */ public static array $validationRules = [ 'external_id' => 'sometimes|nullable|string|between:1,255|unique:servers', 'owner_id' => 'required|integer|exists:users,id', @@ -212,7 +213,7 @@ class Server extends Model implements Validatable static::saved(function (self $server) { $subuser = $server->subusers()->where('user_id', $server->owner_id)->first(); if ($subuser) { - // @phpstan-ignore-next-line + // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions app(SubuserDeletionService::class)->handle($subuser, $server); } }); @@ -220,6 +221,8 @@ class Server extends Model implements Validatable /** * Returns the format for server allocations when communicating with the Daemon. + * + * @return array */ public function getAllocationMappings(): array { @@ -248,6 +251,8 @@ class Server extends Model implements Validatable /** * Gets the subusers associated with a server. + * + * @return HasMany */ public function subusers(): HasMany { @@ -285,6 +290,8 @@ class Server extends Model implements Validatable /** * Gets information for the egg variables associated with this server. + * + * @return HasMany */ public function variables(): HasMany { @@ -304,6 +311,7 @@ class Server extends Model implements Validatable return $this->hasMany(ServerVariable::class); } + /** @deprecated use serverVariables */ public function viewableServerVariables(): HasMany { return $this->serverVariables() @@ -419,6 +427,8 @@ class Server extends Model implements Validatable /** * Sends a command or multiple commands to a running server instance. * + * @param string[]|string $command + * * @throws ConnectionException */ public function send(array|string $command): ResponseInterface @@ -441,10 +451,13 @@ class Server extends Model implements Validatable return cache()->get("servers.$this->uuid.container.status") ?? 'missing'; } + /** + * @return array + */ public function resources(): array { return cache()->remember("resources:$this->uuid", now()->addSeconds(15), function () { - // @phpstan-ignore-next-line + // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions return Arr::get(app(DaemonServerRepository::class)->setServer($this)->getDetails(), 'utilization', []); }); } diff --git a/app/Models/ServerTransfer.php b/app/Models/ServerTransfer.php index ce8b29f2f..2dae90786 100644 --- a/app/Models/ServerTransfer.php +++ b/app/Models/ServerTransfer.php @@ -15,8 +15,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; * @property int $new_node * @property int $old_allocation * @property int $new_allocation - * @property array|null $old_additional_allocations - * @property array|null $new_additional_allocations + * @property array|null $old_additional_allocations array of allocation.id's + * @property array|null $new_additional_allocations array of allocation.id's * @property bool|null $successful * @property bool $archived * @property \Carbon\Carbon $created_at @@ -40,6 +40,7 @@ class ServerTransfer extends Model implements Validatable */ protected $guarded = ['id', 'created_at', 'updated_at']; + /** @var array */ public static array $validationRules = [ 'server_id' => 'required|numeric|exists:servers,id', 'old_node' => 'required|numeric', diff --git a/app/Models/ServerVariable.php b/app/Models/ServerVariable.php index 6721b87ed..2b19c5490 100644 --- a/app/Models/ServerVariable.php +++ b/app/Models/ServerVariable.php @@ -29,6 +29,7 @@ class ServerVariable extends Model implements Validatable protected $guarded = ['id', 'created_at', 'updated_at']; + /** @var array */ public static array $validationRules = [ 'server_id' => 'required|int', 'variable_id' => 'required|int', diff --git a/app/Models/Subuser.php b/app/Models/Subuser.php index 0276b8bc9..30b82935f 100644 --- a/app/Models/Subuser.php +++ b/app/Models/Subuser.php @@ -14,7 +14,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; * @property int $id * @property int $user_id * @property int $server_id - * @property array $permissions + * @property string[] $permissions * @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $updated_at * @property \App\Models\User $user @@ -37,6 +37,7 @@ class Subuser extends Model implements Validatable */ protected $guarded = ['id', 'created_at', 'updated_at']; + /** @var array */ public static array $validationRules = [ 'user_id' => 'required|numeric|exists:users,id', 'server_id' => 'required|numeric|exists:servers,id', diff --git a/app/Models/Task.php b/app/Models/Task.php index 69ad93336..b08e5a511 100644 --- a/app/Models/Task.php +++ b/app/Models/Task.php @@ -47,6 +47,8 @@ class Task extends Model implements Validatable /** * Relationships to be updated when this model is updated. + * + * @var string[] */ protected $touches = ['schedule']; @@ -72,6 +74,7 @@ class Task extends Model implements Validatable 'continue_on_failure' => false, ]; + /** @var array */ public static array $validationRules = [ 'schedule_id' => 'required|numeric|exists:schedules,id', 'sequence_id' => 'required|numeric|min:1', diff --git a/app/Models/Traits/HasAccessTokens.php b/app/Models/Traits/HasAccessTokens.php index 14a0f685b..add86ccdd 100644 --- a/app/Models/Traits/HasAccessTokens.php +++ b/app/Models/Traits/HasAccessTokens.php @@ -24,6 +24,9 @@ trait HasAccessTokens return $this->hasMany(Sanctum::$personalAccessTokenModel); } + /** + * @param ?string[] $ips + */ public function createToken(?string $memo, ?array $ips): NewAccessToken { /** @var \App\Models\ApiKey $token */ diff --git a/app/Models/User.php b/app/Models/User.php index d46ebda85..88afbeb59 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -13,6 +13,7 @@ use Filament\Models\Contracts\HasAvatar; use Filament\Models\Contracts\HasName; use Filament\Models\Contracts\HasTenants; use Filament\Panel; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsToMany; @@ -31,7 +32,6 @@ use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; use App\Notifications\SendPasswordReset as ResetPasswordNotification; -use Filament\Facades\Filament; use ResourceBundle; use Spatie\Permission\Traits\HasRoles; @@ -50,7 +50,7 @@ use Spatie\Permission\Traits\HasRoles; * @property bool $use_totp * @property string|null $totp_secret * @property \Illuminate\Support\Carbon|null $totp_authenticated_at - * @property array|null $oauth + * @property string[]|null $oauth * @property bool $gravatar * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at @@ -67,6 +67,8 @@ use Spatie\Permission\Traits\HasRoles; * @property int|null $ssh_keys_count * @property \Illuminate\Database\Eloquent\Collection|\App\Models\ApiKey[] $tokens * @property int|null $tokens_count + * @property \Illuminate\Database\Eloquent\Collection|\App\Models\Role[] $roles + * @property int|null $roles_count * * @method static \Database\Factories\UserFactory factory(...$parameters) * @method static Builder|User newModelQuery() @@ -143,9 +145,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac 'oauth' => '[]', ]; - /** - * Rules verifying that the data being stored matches the expectations of the database. - */ + /** @var array */ public static array $validationRules = [ 'uuid' => 'nullable|string|size:36|unique:users,uuid', 'email' => 'required|email|between:1,255|unique:users,email', @@ -201,17 +201,6 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac return $rules; } - /** - * Return the user model in a format that can be passed over to React templates. - */ - public function toReactObject(): array - { - return array_merge(collect($this->toArray())->except(['id', 'external_id'])->toArray(), [ - 'root_admin' => $this->isRootAdmin(), - 'admin' => $this->canAccessPanel(Filament::getPanel('admin')), - ]); - } - /** * Send the password reset notification. * @@ -227,20 +216,18 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac $this->notify(new ResetPasswordNotification($token)); } - /** - * Store the username as a lowercase string. - */ - public function setUsernameAttribute(string $value): void + public function username(): Attribute { - $this->attributes['username'] = mb_strtolower($value); + return Attribute::make( + set: fn (string $value) => mb_strtolower($value), + ); } - /** - * Store the email as a lowercase string. - */ - public function setEmailAttribute(string $value): void + public function email(): Attribute { - $this->attributes['email'] = mb_strtolower($value); + return Attribute::make( + set: fn (string $value) => mb_strtolower($value), + ); } /** @@ -341,6 +328,9 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac * Laravel's policies strictly check for the existence of a real method, * this checks if the ability is one of our permissions and then checks if the user can do it or not * Otherwise it calls the Authorizable trait's parent method + * + * @param iterable|\BackedEnum|string $abilities + * @param array|mixed $arguments */ public function can($abilities, mixed $arguments = []): bool { diff --git a/app/Models/UserSSHKey.php b/app/Models/UserSSHKey.php index e07b52e3b..3c643f15f 100644 --- a/app/Models/UserSSHKey.php +++ b/app/Models/UserSSHKey.php @@ -53,6 +53,7 @@ class UserSSHKey extends Model 'fingerprint', ]; + /** @var array */ public static array $validationRules = [ 'name' => ['required', 'string'], 'fingerprint' => ['required', 'string'], diff --git a/app/Models/Webhook.php b/app/Models/Webhook.php index 2440d640a..56f2b3da2 100644 --- a/app/Models/Webhook.php +++ b/app/Models/Webhook.php @@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model; * @property string $event * @property string $endpoint * @property \Illuminate\Support\Carbon|null $successful_at - * @property array $payload + * @property array $payload * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at */ diff --git a/app/Models/WebhookConfiguration.php b/app/Models/WebhookConfiguration.php index cf792da19..f6a048e02 100644 --- a/app/Models/WebhookConfiguration.php +++ b/app/Models/WebhookConfiguration.php @@ -12,7 +12,7 @@ use Illuminate\Support\Facades\File; /** * @property string $endpoint * @property string $description - * @property array $events + * @property string[] $events * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at * @property \Illuminate\Support\Carbon|null $deleted_at @@ -21,9 +21,7 @@ class WebhookConfiguration extends Model { use HasFactory, SoftDeletes; - /** - * Blacklisted events. - */ + /** @var string[] */ protected static array $eventBlacklist = [ 'eloquent.created: App\Models\Webhook', ]; @@ -71,6 +69,7 @@ class WebhookConfiguration extends Model return $this->hasMany(Webhook::class); } + /** @return string[] */ public static function allPossibleEvents(): array { return collect(static::discoverCustomEvents()) @@ -80,6 +79,7 @@ class WebhookConfiguration extends Model ->all(); } + /** @return array */ public static function filamentCheckboxList(): array { $list = []; @@ -100,6 +100,7 @@ class WebhookConfiguration extends Model ->toString(); } + /** @return string[] */ public static function allModelEvents(): array { $eventTypes = ['created', 'updated', 'deleted']; @@ -115,6 +116,7 @@ class WebhookConfiguration extends Model return $events; } + /** @return string[] */ public static function discoverModels(): array { $namespace = 'App\\Models\\'; @@ -129,6 +131,7 @@ class WebhookConfiguration extends Model return $models; } + /** @return string[] */ public static function discoverCustomEvents(): array { $directory = app_path('Events'); diff --git a/app/Notifications/AccountCreated.php b/app/Notifications/AccountCreated.php index 344489621..241f0ae5d 100644 --- a/app/Notifications/AccountCreated.php +++ b/app/Notifications/AccountCreated.php @@ -14,6 +14,7 @@ class AccountCreated extends Notification implements ShouldQueue public function __construct(public ?string $token = null) {} + /** @return string[] */ public function via(): array { return ['mail']; diff --git a/app/Notifications/AddedToServer.php b/app/Notifications/AddedToServer.php index 27e54cc4c..0979225a7 100644 --- a/app/Notifications/AddedToServer.php +++ b/app/Notifications/AddedToServer.php @@ -15,6 +15,7 @@ class AddedToServer extends Notification implements ShouldQueue public function __construct(public Server $server) {} + /** @return string[] */ public function via(): array { return ['mail']; diff --git a/app/Notifications/MailTested.php b/app/Notifications/MailTested.php index 1ef42eb9b..ae4d24e7a 100644 --- a/app/Notifications/MailTested.php +++ b/app/Notifications/MailTested.php @@ -10,6 +10,9 @@ class MailTested extends Notification { public function __construct(private User $user) {} + /** + * @return string[] + */ public function via(): array { return ['mail']; diff --git a/app/Notifications/RemovedFromServer.php b/app/Notifications/RemovedFromServer.php index 95b091035..aa2717638 100644 --- a/app/Notifications/RemovedFromServer.php +++ b/app/Notifications/RemovedFromServer.php @@ -15,6 +15,7 @@ class RemovedFromServer extends Notification implements ShouldQueue public function __construct(public Server $server) {} + /** @return string[] */ public function via(): array { return ['mail']; diff --git a/app/Notifications/SendPasswordReset.php b/app/Notifications/SendPasswordReset.php index 768024832..91132b06a 100644 --- a/app/Notifications/SendPasswordReset.php +++ b/app/Notifications/SendPasswordReset.php @@ -14,6 +14,7 @@ class SendPasswordReset extends Notification implements ShouldQueue public function __construct(public string $token) {} + /** @return string[] */ public function via(): array { return ['mail']; diff --git a/app/Notifications/ServerInstalled.php b/app/Notifications/ServerInstalled.php index 5fed2e56d..988a15722 100644 --- a/app/Notifications/ServerInstalled.php +++ b/app/Notifications/ServerInstalled.php @@ -16,6 +16,7 @@ class ServerInstalled extends Notification implements ShouldQueue public function __construct(public Server $server) {} + /** @return string[] */ public function via(): array { return ['mail']; diff --git a/app/PHPStan/ForbiddenGlobalFunctionsRule.php b/app/PHPStan/ForbiddenGlobalFunctionsRule.php index b9c5cb6ab..dc0acc6c5 100644 --- a/app/PHPStan/ForbiddenGlobalFunctionsRule.php +++ b/app/PHPStan/ForbiddenGlobalFunctionsRule.php @@ -10,12 +10,8 @@ use PHPStan\Rules\RuleErrorBuilder; class ForbiddenGlobalFunctionsRule implements Rule { - private array $forbiddenFunctions; - - public function __construct(array $forbiddenFunctions = ['app', 'resolve']) - { - $this->forbiddenFunctions = $forbiddenFunctions; - } + /** @var string[] */ + public const FORBIDDEN_FUNCTIONS = ['app', 'resolve']; public function getNodeType(): string { @@ -27,7 +23,7 @@ class ForbiddenGlobalFunctionsRule implements Rule /** @var FuncCall $node */ if ($node->name instanceof Node\Name) { $functionName = (string) $node->name; - if (in_array($functionName, $this->forbiddenFunctions, true)) { + if (in_array($functionName, self::FORBIDDEN_FUNCTIONS, true)) { return [ RuleErrorBuilder::message(sprintf( 'Usage of global function "%s" is forbidden.', diff --git a/app/Providers/BackupsServiceProvider.php b/app/Providers/BackupsServiceProvider.php index 2a1725760..f0d748124 100644 --- a/app/Providers/BackupsServiceProvider.php +++ b/app/Providers/BackupsServiceProvider.php @@ -18,6 +18,9 @@ class BackupsServiceProvider extends ServiceProvider implements DeferrableProvid }); } + /** + * @return class-string[] + */ public function provides(): array { return [BackupManager::class]; diff --git a/app/Repositories/Daemon/DaemonConfigurationRepository.php b/app/Repositories/Daemon/DaemonConfigurationRepository.php index 5d228fb96..48d2b35c4 100644 --- a/app/Repositories/Daemon/DaemonConfigurationRepository.php +++ b/app/Repositories/Daemon/DaemonConfigurationRepository.php @@ -11,6 +11,8 @@ class DaemonConfigurationRepository extends DaemonRepository /** * Returns system information from the daemon instance. * + * @return array + * * @throws ConnectionException */ public function getSystemInformation(): array diff --git a/app/Repositories/Daemon/DaemonFileRepository.php b/app/Repositories/Daemon/DaemonFileRepository.php index 682b8c842..70cba278c 100644 --- a/app/Repositories/Daemon/DaemonFileRepository.php +++ b/app/Repositories/Daemon/DaemonFileRepository.php @@ -53,6 +53,8 @@ class DaemonFileRepository extends DaemonRepository /** * Return a directory listing for a given path. * + * @return array + * * @throws ConnectionException */ public function getDirectory(string $path): array @@ -80,6 +82,8 @@ class DaemonFileRepository extends DaemonRepository /** * Renames or moves a file on the remote machine. * + * @param array $files + * * @throws ConnectionException */ public function renameFiles(?string $root, array $files): Response @@ -107,6 +111,8 @@ class DaemonFileRepository extends DaemonRepository /** * Delete a file or folder for the server. * + * @param string[] $files + * * @throws ConnectionException */ public function deleteFiles(?string $root, array $files): Response @@ -122,6 +128,9 @@ class DaemonFileRepository extends DaemonRepository /** * Compress the given files or folders in the given root. * + * @param string[] $files + * @return array + * * @throws ConnectionException */ public function compressFiles(?string $root, array $files): array @@ -160,6 +169,8 @@ class DaemonFileRepository extends DaemonRepository /** * Chmods the given files. * + * @param array $files + * * @throws ConnectionException */ public function chmodFiles(?string $root, array $files): Response @@ -175,6 +186,8 @@ class DaemonFileRepository extends DaemonRepository /** * Pulls a file from the given URL and saves it to the disk. * + * @param array $params + * * @throws ConnectionException */ public function pull(string $url, ?string $directory, array $params = []): Response @@ -193,6 +206,8 @@ class DaemonFileRepository extends DaemonRepository /** * Searches all files in the directory (and its subdirectories) for the given search term. * + * @return array + * * @throws ConnectionException */ public function search(string $searchTerm, ?string $directory): array diff --git a/app/Repositories/Daemon/DaemonRepository.php b/app/Repositories/Daemon/DaemonRepository.php index 2785d5b20..ae7440a50 100644 --- a/app/Repositories/Daemon/DaemonRepository.php +++ b/app/Repositories/Daemon/DaemonRepository.php @@ -40,6 +40,8 @@ abstract class DaemonRepository /** * Return an instance of the Guzzle HTTP Client to be used for requests. + * + * @param array $headers */ public function getHttpClient(array $headers = []): PendingRequest { diff --git a/app/Repositories/Daemon/DaemonServerRepository.php b/app/Repositories/Daemon/DaemonServerRepository.php index 301fb722a..673673b98 100644 --- a/app/Repositories/Daemon/DaemonServerRepository.php +++ b/app/Repositories/Daemon/DaemonServerRepository.php @@ -13,6 +13,8 @@ class DaemonServerRepository extends DaemonRepository { /** * Returns details about a server from the Daemon instance. + * + * @return array */ public function getDetails(): array { diff --git a/app/Services/Acl/Api/AdminAcl.php b/app/Services/Acl/Api/AdminAcl.php index 75a93aa86..6539b47d2 100644 --- a/app/Services/Acl/Api/AdminAcl.php +++ b/app/Services/Acl/Api/AdminAcl.php @@ -36,12 +36,4 @@ class AdminAcl { return self::can($key->getPermission($resource), $action); } - - /** - * Returns a list of all possible permissions. - */ - public static function getResourceList(): array - { - return ApiKey::getPermissionList(); - } } diff --git a/app/Services/Activity/ActivityLogService.php b/app/Services/Activity/ActivityLogService.php index 243edb62d..402f433c3 100644 --- a/app/Services/Activity/ActivityLogService.php +++ b/app/Services/Activity/ActivityLogService.php @@ -2,6 +2,7 @@ namespace App\Services\Activity; +use App\Models\User; use Illuminate\Support\Arr; use Throwable; use Webmozart\Assert\Assert; @@ -19,6 +20,7 @@ class ActivityLogService { protected ?ActivityLog $activity = null; + /** @var array */ protected array $subjects = []; public function __construct( @@ -102,7 +104,7 @@ class ActivityLogService /** * Sets a custom property on the activity log instance. * - * @param string|array $key + * @param string|array $key * @param mixed $value */ public function property($key, $value = null): self @@ -223,7 +225,7 @@ class ActivityLogService } /** - * Saves the activity log instance and attaches all of the subject models. + * Saves the activity log instance and attaches all the subject models. * * @throws \Throwable */ diff --git a/app/Services/Allocations/AssignmentService.php b/app/Services/Allocations/AssignmentService.php index f57ba16c6..242a14872 100644 --- a/app/Services/Allocations/AssignmentService.php +++ b/app/Services/Allocations/AssignmentService.php @@ -27,14 +27,14 @@ class AssignmentService public const PORT_RANGE_REGEX = '/^(\d{4,5})-(\d{4,5})$/'; - /** - * AssignmentService constructor. - */ public function __construct(protected ConnectionInterface $connection) {} /** * Insert allocations into the database and link them to a specific node. * + * @param array{allocation_ip: string, allocation_ports: array} $data + * @return array + * * @throws \App\Exceptions\DisplayException * @throws \App\Exceptions\Service\Allocation\CidrOutOfRangeException * @throws \App\Exceptions\Service\Allocation\InvalidPortMappingException diff --git a/app/Services/Allocations/FindAssignableAllocationService.php b/app/Services/Allocations/FindAssignableAllocationService.php index 73f7cc70f..5a439799f 100644 --- a/app/Services/Allocations/FindAssignableAllocationService.php +++ b/app/Services/Allocations/FindAssignableAllocationService.php @@ -72,7 +72,7 @@ class FindAssignableAllocationService Assert::integerish($start); Assert::integerish($end); - // Get all of the currently allocated ports for the node so that we can figure out + // Get all the currently allocated ports for the node so that we can figure out // which port might be available. $ports = $server->node->allocations() ->where('ip', $server->allocation->ip) @@ -84,7 +84,7 @@ class FindAssignableAllocationService // array of ports to create a new allocation to assign to the server. $available = array_diff(range($start, $end), $ports->toArray()); - // If we've already allocated all of the ports, just abort. + // If we've already allocated all the ports, just abort. if (empty($available)) { throw new NoAutoAllocationSpaceAvailableException(); } diff --git a/app/Services/Api/KeyCreationService.php b/app/Services/Api/KeyCreationService.php index d2649fb22..878d00f83 100644 --- a/app/Services/Api/KeyCreationService.php +++ b/app/Services/Api/KeyCreationService.php @@ -24,6 +24,8 @@ class KeyCreationService * This will automatically generate an identifier and an encrypted token that are * stored in the database. * + * @param array $data + * * @throws \App\Exceptions\Model\DataValidationException */ public function handle(array $data): ApiKey diff --git a/app/Services/Backups/InitiateBackupService.php b/app/Services/Backups/InitiateBackupService.php index 506448d25..7a60da8fc 100644 --- a/app/Services/Backups/InitiateBackupService.php +++ b/app/Services/Backups/InitiateBackupService.php @@ -14,6 +14,7 @@ use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException; class InitiateBackupService { + /** @var string[] */ private array $ignoredFiles; private bool $isLocked = false; diff --git a/app/Services/Databases/DatabaseManagementService.php b/app/Services/Databases/DatabaseManagementService.php index 8ec783328..feef10817 100644 --- a/app/Services/Databases/DatabaseManagementService.php +++ b/app/Services/Databases/DatabaseManagementService.php @@ -59,6 +59,8 @@ class DatabaseManagementService /** * Create a new database that is linked to a specific host. * + * @param array{database?: string, database_host_id: int} $data + * * @throws \Throwable * @throws \App\Exceptions\Service\Database\TooManyDatabasesException * @throws \App\Exceptions\Service\Database\DatabaseClientFeatureNotEnabledException @@ -128,6 +130,8 @@ class DatabaseManagementService * have the same name across multiple hosts, for the sake of keeping this logic easy to understand * and avoiding user confusion we will ignore the specific host and just look across all hosts. * + * @param array{server_id: int, database: string} $data + * * @throws \App\Exceptions\Repository\DuplicateDatabaseNameException * @throws \Throwable */ diff --git a/app/Services/Databases/DeployServerDatabaseService.php b/app/Services/Databases/DeployServerDatabaseService.php index c4aa2988a..af9a29ceb 100644 --- a/app/Services/Databases/DeployServerDatabaseService.php +++ b/app/Services/Databases/DeployServerDatabaseService.php @@ -12,6 +12,9 @@ readonly class DeployServerDatabaseService { public function __construct(private DatabaseManagementService $managementService) {} + /** + * @param array{database?: string, remote?: string} $data + */ public function handle(Server $server, array $data): Database { Assert::notEmpty($data['database'] ?? null); diff --git a/app/Services/Databases/Hosts/HostCreationService.php b/app/Services/Databases/Hosts/HostCreationService.php index ff38cb5c9..13dd54bd7 100644 --- a/app/Services/Databases/Hosts/HostCreationService.php +++ b/app/Services/Databases/Hosts/HostCreationService.php @@ -21,6 +21,16 @@ class HostCreationService /** * Create a new database host on the Panel. * + * @param array{ + * password: string, + * name: string, + * host: string, + * port: int, + * username: string, + * max_databases: int, + * node_ids?: array + * } $data + * * @throws \Throwable */ public function handle(array $data): DatabaseHost diff --git a/app/Services/Databases/Hosts/HostUpdateService.php b/app/Services/Databases/Hosts/HostUpdateService.php index 18d9f2838..cf9add21f 100644 --- a/app/Services/Databases/Hosts/HostUpdateService.php +++ b/app/Services/Databases/Hosts/HostUpdateService.php @@ -21,6 +21,8 @@ class HostUpdateService /** * Update a database host and persist to the database. * + * @param array $data + * * @throws \Throwable */ public function handle(DatabaseHost|int $host, array $data): DatabaseHost diff --git a/app/Services/Deployment/AllocationSelectionService.php b/app/Services/Deployment/AllocationSelectionService.php index 3868d0b38..d589b6368 100644 --- a/app/Services/Deployment/AllocationSelectionService.php +++ b/app/Services/Deployment/AllocationSelectionService.php @@ -4,6 +4,7 @@ namespace App\Services\Deployment; use App\Models\Allocation; use App\Exceptions\DisplayException; +use App\Models\Node; use App\Services\Allocations\AssignmentService; use App\Exceptions\Service\Deployment\NoViableAllocationException; @@ -11,8 +12,10 @@ class AllocationSelectionService { protected bool $dedicated = false; + /** @var array */ protected array $nodes = []; + /** @var array */ protected array $ports = []; /** @@ -30,6 +33,8 @@ class AllocationSelectionService /** * A list of node IDs that should be used when selecting an allocation. If empty, all * nodes will be used to filter with. + * + * @param array $nodes */ public function setNodes(array $nodes): self { @@ -43,6 +48,8 @@ class AllocationSelectionService * empty, all ports will be considered when finding an allocation. If set, only ports appearing * in the array or range will be used. * + * @param array $ports + * * @throws \App\Exceptions\DisplayException */ public function setPorts(array $ports): self @@ -87,6 +94,9 @@ class AllocationSelectionService /** * Return a single allocation from those meeting the requirements. + * + * @param array $nodes + * @param array> $ports */ private function getRandomAllocation(array $nodes = [], array $ports = [], bool $dedicated = false): ?Allocation { @@ -133,6 +143,9 @@ class AllocationSelectionService * * If an array of nodes is passed the results will be limited to allocations * in those nodes. + * + * @param array $nodes + * @return array */ private function getDiscardableDedicatedAllocations(array $nodes = []): array { diff --git a/app/Services/Deployment/FindViableNodesService.php b/app/Services/Deployment/FindViableNodesService.php index d95c08c64..113c2a2a3 100644 --- a/app/Services/Deployment/FindViableNodesService.php +++ b/app/Services/Deployment/FindViableNodesService.php @@ -16,6 +16,8 @@ class FindViableNodesService * and cpu availability requirements. Any nodes not meeting those requirements * are tossed out, as are any nodes marked as non-public, meaning automatic * deployments should not be done against them. + * + * @param string[] $tags */ public function handle(int $memory = 0, int $disk = 0, int $cpu = 0, array $tags = []): Collection { diff --git a/app/Services/Eggs/EggConfigurationService.php b/app/Services/Eggs/EggConfigurationService.php index 41becf2b1..c72d6e7c5 100644 --- a/app/Services/Eggs/EggConfigurationService.php +++ b/app/Services/Eggs/EggConfigurationService.php @@ -16,6 +16,12 @@ class EggConfigurationService /** * Return an Egg file to be used by the Daemon. + * + * @return array{ + * startup: array{done: string[], user_interaction: string[], strip_ansi: bool}, + * stop: array{type: string, value: string}, + * configs: array + * } */ public function handle(Server $server): array { @@ -33,6 +39,9 @@ class EggConfigurationService /** * Convert the "done" variable into an array if it is not currently one. + * + * @param array{done: string|string[], strip_ansi: bool} $startup + * @return array{done: string[], user_interaction: string[], strip_ansi: bool} */ protected function convertStartupToNewFormat(array $startup): array { @@ -51,6 +60,8 @@ class EggConfigurationService * For most eggs, this ends up just being a command sent to the server console, but * if the stop command is something starting with a caret (^), it will be converted * into the associated kill signal for the instance. + * + * @return array{type: string, value: string} */ protected function convertStopToNewFormat(string $stop): array { @@ -69,6 +80,9 @@ class EggConfigurationService ]; } + /** + * @return array + */ protected function replacePlaceholders(Server $server, object $configs): array { // Get the legacy configuration structure for the server so that we @@ -116,6 +130,9 @@ class EggConfigurationService return $response; } + /** + * @param array{string, mixed} $structure + */ protected function matchAndReplaceKeys(mixed $value, array $structure): mixed { preg_match_all('/{{(?[\w.-]*)}}/', $value, $matches); @@ -170,6 +187,8 @@ class EggConfigurationService * Iterates over a set of "find" values for a given file in the parser configuration. If * the value of the line match is something iterable, continue iterating, otherwise perform * a match & replace. + * + * @param array $structure */ private function iterate(mixed $data, array $structure): mixed { diff --git a/app/Services/Eggs/Sharing/EggImporterService.php b/app/Services/Eggs/Sharing/EggImporterService.php index 5da64cf7e..c95b556e9 100644 --- a/app/Services/Eggs/Sharing/EggImporterService.php +++ b/app/Services/Eggs/Sharing/EggImporterService.php @@ -94,6 +94,10 @@ class EggImporterService /** * Takes an uploaded file and parses out the egg configuration from within. * + * @todo replace with DTO + * + * @return array + * * @throws \App\Exceptions\Service\InvalidFileUploadException */ protected function parseFile(UploadedFile $file): array @@ -129,6 +133,20 @@ class EggImporterService /** * Fills the provided model with the parsed JSON data. + * + * @param array{ + * name: string, + * description: string, + * features: string[], + * docker_images: string[], + * file_denylist: string[], + * meta: array{update_url: string}, + * config: array{files: string, startup: string, logs: string, stop: string}, + * startup: string, + * scripts: array{ + * installation: array{script: string, entrypoint: string, container: string}, + * }, + * } $parsed */ protected function fillFromParsed(Egg $model, array $parsed): Egg { @@ -155,6 +173,9 @@ class EggImporterService * Converts a PTDL_V1 egg into the expected PTDL_V2 egg format. This just handles * the "docker_images" field potentially not being present, and not being in the * expected "key => value" format. + * + * @param array{images?: string[], image?: string, field_type?: string, docker_images?: array} $parsed + * @return array */ protected function convertToV2(array $parsed): array { diff --git a/app/Services/Eggs/Variables/VariableCreationService.php b/app/Services/Eggs/Variables/VariableCreationService.php index a162830d5..63e0afcd2 100644 --- a/app/Services/Eggs/Variables/VariableCreationService.php +++ b/app/Services/Eggs/Variables/VariableCreationService.php @@ -28,6 +28,14 @@ class VariableCreationService /** * Create a new variable for a given Egg. * + * @param array{ + * name?: string, + * description?: string, + * env_variable?: string, + * default_value?: string, + * rules?: string|string[], + * } $data + * * @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Service\Egg\Variable\BadValidationRuleException * @throws \App\Exceptions\Service\Egg\Variable\ReservedVariableNameException diff --git a/app/Services/Eggs/Variables/VariableUpdateService.php b/app/Services/Eggs/Variables/VariableUpdateService.php index 64e929e52..b14bf5bb2 100644 --- a/app/Services/Eggs/Variables/VariableUpdateService.php +++ b/app/Services/Eggs/Variables/VariableUpdateService.php @@ -29,11 +29,20 @@ class VariableUpdateService /** * Update a specific egg variable. * + * @param array{ + * env_variable?: string, + * rules?: string|string[], + * options?: string[], + * name?: string, + * description?: string, + * default_value?: string, + * } $data + * * @throws \App\Exceptions\DisplayException * @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Service\Egg\Variable\ReservedVariableNameException */ - public function handle(EggVariable $variable, array $data): mixed + public function handle(EggVariable $variable, array $data): EggVariable { if (!is_null(array_get($data, 'env_variable'))) { if (in_array(strtoupper(array_get($data, 'env_variable')), explode(',', EggVariable::RESERVED_ENV_NAMES))) { @@ -57,7 +66,7 @@ class VariableUpdateService $options = array_get($data, 'options') ?? []; - return $variable->update([ + $variable->update([ 'name' => $data['name'] ?? '', 'description' => $data['description'] ?? '', 'env_variable' => $data['env_variable'] ?? '', @@ -66,5 +75,7 @@ class VariableUpdateService 'user_editable' => in_array('user_editable', $options), 'rules' => $data['rules'] ?? [], ]); + + return $variable; } } diff --git a/app/Services/Files/DeleteFilesService.php b/app/Services/Files/DeleteFilesService.php index 71a150e4d..8e4ea457e 100644 --- a/app/Services/Files/DeleteFilesService.php +++ b/app/Services/Files/DeleteFilesService.php @@ -7,11 +7,8 @@ use App\Repositories\Daemon\DaemonFileRepository; use Illuminate\Http\Client\ConnectionException; use Illuminate\Support\Str; -class DeleteFilesService +readonly class DeleteFilesService { - /** - * DeleteFilesService constructor. - */ public function __construct( private DaemonFileRepository $daemonFileRepository ) {} @@ -19,6 +16,8 @@ class DeleteFilesService /** * Deletes the given files. * + * @param string[] $files + * * @throws ConnectionException */ public function handle(Server $server, array $files): void diff --git a/app/Services/Helpers/LanguageService.php b/app/Services/Helpers/LanguageService.php index 83607a1a6..41c91e2b0 100644 --- a/app/Services/Helpers/LanguageService.php +++ b/app/Services/Helpers/LanguageService.php @@ -16,6 +16,9 @@ class LanguageService return in_array($countryCode, self::TRANSLATED_COMPLETELY, true); } + /** + * @return array + */ public function getAvailableLanguages(string $path = 'lang'): array { return collect(File::directories(base_path($path)))->mapWithKeys(function ($path) { diff --git a/app/Services/Nodes/NodeCreationService.php b/app/Services/Nodes/NodeCreationService.php index 1c10b328d..cbd89d277 100644 --- a/app/Services/Nodes/NodeCreationService.php +++ b/app/Services/Nodes/NodeCreationService.php @@ -11,6 +11,10 @@ class NodeCreationService /** * Create a new node on the panel. * + * @todo remove this class + * + * @param array $data + * * @throws \App\Exceptions\Model\DataValidationException */ public function handle(array $data): Node diff --git a/app/Services/Nodes/NodeJWTService.php b/app/Services/Nodes/NodeJWTService.php index 2a5b1a3ff..7d9765fa9 100644 --- a/app/Services/Nodes/NodeJWTService.php +++ b/app/Services/Nodes/NodeJWTService.php @@ -15,6 +15,7 @@ use App\Extensions\Lcobucci\JWT\Encoding\TimestampDates; class NodeJWTService { + /** @var array */ private array $claims = []; private ?User $user = null; @@ -25,6 +26,8 @@ class NodeJWTService /** * Set the claims to include in this JWT. + * + * @param array $claims */ public function setClaims(array $claims): self { @@ -44,7 +47,7 @@ class NodeJWTService return $this; } - public function setExpiresAt(\DateTimeImmutable $date): self + public function setExpiresAt(DateTimeImmutable $date): self { $this->expiresAt = $date; diff --git a/app/Services/Nodes/NodeUpdateService.php b/app/Services/Nodes/NodeUpdateService.php index 5deed35aa..9ebb09a0e 100644 --- a/app/Services/Nodes/NodeUpdateService.php +++ b/app/Services/Nodes/NodeUpdateService.php @@ -22,6 +22,8 @@ class NodeUpdateService /** * Update the configuration values for a given node on the machine. * + * @param array $data + * * @throws \Throwable */ public function handle(Node $node, array $data, bool $resetToken = false): Node diff --git a/app/Services/Servers/BuildModificationService.php b/app/Services/Servers/BuildModificationService.php index 89ea0dd1e..71486059f 100644 --- a/app/Services/Servers/BuildModificationService.php +++ b/app/Services/Servers/BuildModificationService.php @@ -25,6 +25,8 @@ class BuildModificationService /** * Change the build details for a specified server. * + * @param array $data + * * @throws \Throwable * @throws \App\Exceptions\DisplayException */ @@ -80,6 +82,14 @@ class BuildModificationService /** * Process the allocations being assigned in the data and ensure they are available for a server. * + * @param array{ + * add_allocations?: array, + * remove_allocations?: array, + * allocation_id?: int, + * oom_killer?: bool, + * oom_disabled?: bool, + * } $data + * * @throws \App\Exceptions\DisplayException */ private function processAllocations(Server $server, array &$data): void diff --git a/app/Services/Servers/DetailsModificationService.php b/app/Services/Servers/DetailsModificationService.php index be6e497d8..894a3bffa 100644 --- a/app/Services/Servers/DetailsModificationService.php +++ b/app/Services/Servers/DetailsModificationService.php @@ -21,6 +21,13 @@ class DetailsModificationService /** * Update the details for a single server instance. * + * @param array{ + * external_id: int, + * owner_id: int, + * name: string, + * description?: ?string + * } $data + * * @throws \Throwable */ public function handle(Server $server, array $data): Server diff --git a/app/Services/Servers/EnvironmentService.php b/app/Services/Servers/EnvironmentService.php index b960db3ed..3979fa55c 100644 --- a/app/Services/Servers/EnvironmentService.php +++ b/app/Services/Servers/EnvironmentService.php @@ -7,11 +7,11 @@ use App\Models\EggVariable; class EnvironmentService { + /** @var array */ private array $additional = []; /** - * Dynamically configure additional environment variables to be assigned - * with a specific server. + * Dynamically configure additional environment variables to be assigned with a specific server. */ public function setEnvironmentKey(string $key, callable $closure): void { @@ -20,6 +20,8 @@ class EnvironmentService /** * Return the dynamically added additional keys. + * + * @return array */ public function getEnvironmentKeys(): array { @@ -27,8 +29,10 @@ class EnvironmentService } /** - * Take all of the environment variables configured for this server and return + * Take all the environment variables configured for this server and return * them in an easy to process format. + * + * @return array */ public function handle(Server $server): array { @@ -61,6 +65,8 @@ class EnvironmentService /** * Return a mapping of Panel default environment variables. + * + * @return array */ private function getEnvironmentMappings(): array { diff --git a/app/Services/Servers/GetUserPermissionsService.php b/app/Services/Servers/GetUserPermissionsService.php index c3bc672aa..f9d0e31fa 100644 --- a/app/Services/Servers/GetUserPermissionsService.php +++ b/app/Services/Servers/GetUserPermissionsService.php @@ -11,6 +11,8 @@ class GetUserPermissionsService * Returns the server specific permissions that a user has. This checks * if they are an admin, the owner or a subuser for the server. If no * permissions are found, an empty array is returned. + * + * @return string[] */ public function handle(Server $server, User $user): array { diff --git a/app/Services/Servers/ServerConfigurationStructureService.php b/app/Services/Servers/ServerConfigurationStructureService.php index 874a4ebde..541d07399 100644 --- a/app/Services/Servers/ServerConfigurationStructureService.php +++ b/app/Services/Servers/ServerConfigurationStructureService.php @@ -7,9 +7,6 @@ use App\Models\Server; class ServerConfigurationStructureService { - /** - * ServerConfigurationStructureService constructor. - */ public function __construct(private EnvironmentService $environment) {} /** @@ -17,6 +14,9 @@ class ServerConfigurationStructureService * * DO NOT MODIFY THIS FUNCTION. This powers legacy code handling for the new daemon * daemon, if you modify the structure eggs will break unexpectedly. + * + * @param array $override + * @return array */ public function handle(Server $server, array $override = []): array { @@ -35,6 +35,35 @@ class ServerConfigurationStructureService /** * Returns the data format used for the daemon. + * + * @return array{ + * uuid: string, + * meta: array{name: string, description: string}, + * suspended: bool, + * environment: array, + * invocation: string, + * skip_egg_scripts: bool, + * build: array{ + * memory_limit: int, + * swap: int, + * io_weight: int, + * cpu_limit: int, + * threads: ?string, + * disk_space: int, + * oom_killer: bool, + * }, + * container: array{image: string, requires_rebuild: false}, + * allocations: array{ + * force_outgoing_ip: bool, + * default: array{ip: string, port: int}, + * mappings: array, + * }, + * egg: array{id: string, file_denylist: string[]}, + * labels?: string[], + * mounts: array{source: string, target: string, read_only: bool}, + * } + * + * @todo convert to API Resource */ protected function returnFormat(Server $server): array { diff --git a/app/Services/Servers/ServerCreationService.php b/app/Services/Servers/ServerCreationService.php index bb802ceba..26f38bbc6 100644 --- a/app/Services/Servers/ServerCreationService.php +++ b/app/Services/Servers/ServerCreationService.php @@ -39,6 +39,15 @@ class ServerCreationService * as possible given the input data. For example, if an allocation_id is passed with * no node_id the node_is will be picked from the allocation. * + * @param array{ + * oom_killer?: bool, + * oom_disabled?: bool, + * egg_id?: int, + * image?: ?string, + * startup?: ?string, + * start_on_completion?: ?bool, + * } $data + * * @throws \Throwable * @throws \App\Exceptions\DisplayException * @throws \Illuminate\Validation\ValidationException @@ -109,6 +118,8 @@ class ServerCreationService /** * Gets an allocation to use for automatic deployment. * + * @param array{memory?: ?int, disk?: ?int, cpu?: ?int, tags?: ?string[]} $data + * * @throws \App\Exceptions\DisplayException * @throws \App\Exceptions\Service\Deployment\NoViableAllocationException */ @@ -130,6 +141,8 @@ class ServerCreationService /** * Store the server in the database and return the model. * + * @param array $data + * * @throws \App\Exceptions\Model\DataValidationException */ private function createModel(array $data): Server @@ -166,11 +179,13 @@ class ServerCreationService /** * Configure the allocations assigned to this server. + * + * @param array{allocation_id: int, allocation_additional?: ?int[]} $data */ private function storeAssignedAllocations(Server $server, array $data): void { $records = [$data['allocation_id']]; - if (isset($data['allocation_additional']) && is_array($data['allocation_additional'])) { + if (isset($data['allocation_additional'])) { $records = array_merge($records, $data['allocation_additional']); } diff --git a/app/Services/Servers/StartupModificationService.php b/app/Services/Servers/StartupModificationService.php index 0ca7acafb..815fce2e9 100644 --- a/app/Services/Servers/StartupModificationService.php +++ b/app/Services/Servers/StartupModificationService.php @@ -22,6 +22,8 @@ class StartupModificationService /** * Process startup modification for a server. * + * @param array $data + * * @throws \Throwable */ public function handle(Server $server, array $data): Server @@ -62,6 +64,13 @@ class StartupModificationService /** * Update certain administrative settings for a server in the DB. + * + * @param array{ + * egg_id: ?int, + * docker_image?: ?string, + * startup?: ?string, + * skip_scripts?: ?bool, + * } $data */ protected function updateAdministrativeSettings(array $data, Server &$server): void { diff --git a/app/Services/Servers/TransferServerService.php b/app/Services/Servers/TransferServerService.php index e4fcfce54..dec6d435a 100644 --- a/app/Services/Servers/TransferServerService.php +++ b/app/Services/Servers/TransferServerService.php @@ -40,6 +40,12 @@ class TransferServerService /** * Starts a transfer of a server to a new node. * + * @param array{ + * allocation_id: int, + * node_id: int, + * allocation_additional?: ?int[], + * } $data + * * @throws \Throwable */ public function handle(Server $server, array $data): bool @@ -98,6 +104,8 @@ class TransferServerService /** * Assigns the specified allocations to the specified server. + * + * @param int[] $additional_allocations */ private function assignAllocationsToServer(Server $server, int $node_id, int $allocation_id, array $additional_allocations): void { diff --git a/app/Services/Servers/VariableValidatorService.php b/app/Services/Servers/VariableValidatorService.php index d61bfa4d1..a1a7f88bc 100644 --- a/app/Services/Servers/VariableValidatorService.php +++ b/app/Services/Servers/VariableValidatorService.php @@ -13,13 +13,12 @@ class VariableValidatorService { use HasUserLevels; - /** - * VariableValidatorService constructor. - */ - public function __construct(private ValidationFactory $validator) {} + public function __construct(private readonly ValidationFactory $validator) {} /** - * Validate all of the passed data against the given egg variables. + * Validate passed data against the given egg variables. + * + * @param array $fields * * @throws \Illuminate\Validation\ValidationException */ diff --git a/app/Services/Subusers/SubuserCreationService.php b/app/Services/Subusers/SubuserCreationService.php index 83c268330..51e4f758c 100644 --- a/app/Services/Subusers/SubuserCreationService.php +++ b/app/Services/Subusers/SubuserCreationService.php @@ -28,6 +28,8 @@ class SubuserCreationService * If the email address already belongs to a user on the system a new user will not * be created. * + * @param string[] $permissions + * * @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Service\Subuser\ServerSubuserExistsException * @throws \App\Exceptions\Service\Subuser\UserIsServerOwnerException diff --git a/app/Services/Subusers/SubuserUpdateService.php b/app/Services/Subusers/SubuserUpdateService.php index 5f2c61d78..a5a53d91e 100644 --- a/app/Services/Subusers/SubuserUpdateService.php +++ b/app/Services/Subusers/SubuserUpdateService.php @@ -15,6 +15,9 @@ class SubuserUpdateService private DaemonServerRepository $serverRepository, ) {} + /** + * @param string[] $permissions + */ public function handle(Subuser $subuser, Server $server, array $permissions): void { $cleanedPermissions = collect($permissions) diff --git a/app/Services/Users/ToggleTwoFactorService.php b/app/Services/Users/ToggleTwoFactorService.php index 2fdcbe757..0edec54fd 100644 --- a/app/Services/Users/ToggleTwoFactorService.php +++ b/app/Services/Users/ToggleTwoFactorService.php @@ -23,6 +23,8 @@ class ToggleTwoFactorService /** * Toggle 2FA on an account only if the token provided is valid. * + * @return string[] + * * @throws \Throwable * @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException * @throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersException diff --git a/app/Services/Users/TwoFactorSetupService.php b/app/Services/Users/TwoFactorSetupService.php index fb906c9db..56bcf57c2 100644 --- a/app/Services/Users/TwoFactorSetupService.php +++ b/app/Services/Users/TwoFactorSetupService.php @@ -13,6 +13,8 @@ class TwoFactorSetupService * QR code URL. This URL will need to be attached to a QR generating service in * order to function. * + * @return array{image_url_data: string, secret: string} + * * @throws \App\Exceptions\Model\DataValidationException */ public function handle(User $user): array diff --git a/app/Services/Users/UserCreationService.php b/app/Services/Users/UserCreationService.php index ce6af9b13..1282c1346 100644 --- a/app/Services/Users/UserCreationService.php +++ b/app/Services/Users/UserCreationService.php @@ -12,18 +12,17 @@ use App\Notifications\AccountCreated; class UserCreationService { - /** - * UserCreationService constructor. - */ public function __construct( - private ConnectionInterface $connection, - private Hasher $hasher, - private PasswordBroker $passwordBroker, + private readonly ConnectionInterface $connection, + private readonly Hasher $hasher, + private readonly PasswordBroker $passwordBroker, ) {} /** * Create a new user on the system. * + * @param array $data + * * @throws \Exception * @throws \App\Exceptions\Model\DataValidationException */ diff --git a/app/Services/Users/UserUpdateService.php b/app/Services/Users/UserUpdateService.php index d529aee33..ba7b45ae1 100644 --- a/app/Services/Users/UserUpdateService.php +++ b/app/Services/Users/UserUpdateService.php @@ -10,14 +10,13 @@ class UserUpdateService { use HasUserLevels; - /** - * UserUpdateService constructor. - */ - public function __construct(private Hasher $hasher) {} + public function __construct(private readonly Hasher $hasher) {} /** * Update the user model instance and return the updated model. * + * @param array $data + * * @throws \Throwable */ public function handle(User $user, array $data): User diff --git a/app/Traits/CheckMigrationsTrait.php b/app/Traits/CheckMigrationsTrait.php index 1f849e8aa..c149085b9 100644 --- a/app/Traits/CheckMigrationsTrait.php +++ b/app/Traits/CheckMigrationsTrait.php @@ -12,7 +12,7 @@ trait CheckMigrationsTrait protected function hasCompletedMigrations(): bool { /** @var Migrator $migrator */ - $migrator = app()->make('migrator'); // @phpstan-ignore-line + $migrator = app()->make('migrator'); // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions $files = $migrator->getMigrationFiles(database_path('migrations')); diff --git a/app/Traits/Commands/RequestRedisSettingsTrait.php b/app/Traits/Commands/RequestRedisSettingsTrait.php index e0b98da4e..77ae01d52 100644 --- a/app/Traits/Commands/RequestRedisSettingsTrait.php +++ b/app/Traits/Commands/RequestRedisSettingsTrait.php @@ -4,6 +4,9 @@ namespace App\Traits\Commands; trait RequestRedisSettingsTrait { + /** @var array */ + protected array $variables; + protected function requestRedisSettings(): void { $this->output->note(trans('commands.appsettings.redis.note')); diff --git a/app/Traits/Commands/RequiresDatabaseMigrations.php b/app/Traits/Commands/RequiresDatabaseMigrations.php index 67551a26a..aed555b9f 100644 --- a/app/Traits/Commands/RequiresDatabaseMigrations.php +++ b/app/Traits/Commands/RequiresDatabaseMigrations.php @@ -14,7 +14,7 @@ trait RequiresDatabaseMigrations /** * Throw a massive error into the console to hopefully catch the users attention and get - * them to properly run the migrations rather than ignoring all of the other previous + * them to properly run the migrations rather than ignoring other previous * errors... */ protected function showMigrationWarning(): void diff --git a/app/Traits/EnvironmentWriterTrait.php b/app/Traits/EnvironmentWriterTrait.php index cb5bef047..ea8a03e6e 100644 --- a/app/Traits/EnvironmentWriterTrait.php +++ b/app/Traits/EnvironmentWriterTrait.php @@ -23,6 +23,8 @@ trait EnvironmentWriterTrait /** * Update the .env file for the application using the passed in values. * + * @param array $values + * * @throws Exception */ public function writeToEnvironment(array $values = []): void diff --git a/app/Traits/HasValidation.php b/app/Traits/HasValidation.php index 8cb3617be..131497830 100644 --- a/app/Traits/HasValidation.php +++ b/app/Traits/HasValidation.php @@ -4,6 +4,7 @@ namespace App\Traits; use App\Observers\ValidationObserver; use Illuminate\Container\Container; +use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Database\Eloquent\Attributes\ObservedBy; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Arr; @@ -30,6 +31,8 @@ trait HasValidation /** * Returns the rules associated with this model. + * + * @return array> */ public static function getRules(): array { @@ -42,8 +45,9 @@ trait HasValidation } /** - * Returns the rules for a specific field. If the field is not found an empty - * array is returned. + * Returns the rules for a specific field. If the field is not found, an empty array is returned. + * + * @return string[]|ValidationRule[] */ public static function getRulesForField(string $field): array { @@ -51,8 +55,9 @@ trait HasValidation } /** - * Returns the rules associated with the model, specifically for updating the given model - * rather than just creating it. + * Returns the rules associated with the model, specifically for updating the given model rather than just creating it. + * + * @return array */ public static function getRulesForUpdate(self $model): array { @@ -65,7 +70,7 @@ trait HasValidation // working model, so we don't run into errors due to the way that field validation // works. foreach ($data as &$datum) { - if (!is_string($datum) || !Str::startsWith($datum, 'unique')) { + if (!Str::startsWith($datum, 'unique')) { continue; } diff --git a/app/Traits/Services/ValidatesValidationRules.php b/app/Traits/Services/ValidatesValidationRules.php index ccb393a6f..95e234983 100644 --- a/app/Traits/Services/ValidatesValidationRules.php +++ b/app/Traits/Services/ValidatesValidationRules.php @@ -11,8 +11,9 @@ trait ValidatesValidationRules abstract protected function getValidator(): ValidationFactory; /** - * Validate that the rules being provided are valid for Laravel and can - * be resolved. + * Validate that the rules being provided are valid and can be resolved. + * + * @param string[]|string|\Illuminate\Contracts\Validation\ValidationRule[] $rules * * @throws \App\Exceptions\Service\Egg\Variable\BadValidationRuleException */ diff --git a/app/Transformers/Api/Application/AllocationTransformer.php b/app/Transformers/Api/Application/AllocationTransformer.php index 9f4f7c2f8..b272eefcb 100644 --- a/app/Transformers/Api/Application/AllocationTransformer.php +++ b/app/Transformers/Api/Application/AllocationTransformer.php @@ -24,9 +24,9 @@ class AllocationTransformer extends BaseTransformer } /** - * Return a generic transformed allocation array. + * @param Allocation $allocation */ - public function transform(Allocation $allocation): array + public function transform($allocation): array { return [ 'id' => $allocation->id, diff --git a/app/Transformers/Api/Application/BaseTransformer.php b/app/Transformers/Api/Application/BaseTransformer.php index bc9353566..443e4f466 100644 --- a/app/Transformers/Api/Application/BaseTransformer.php +++ b/app/Transformers/Api/Application/BaseTransformer.php @@ -8,22 +8,21 @@ use Illuminate\Http\Request; use Webmozart\Assert\Assert; use App\Models\ApiKey; use Illuminate\Container\Container; -use Illuminate\Database\Eloquent\Model; use League\Fractal\TransformerAbstract; use App\Services\Acl\Api\AdminAcl; -/** - * @method array transform(Model $model) - */ abstract class BaseTransformer extends TransformerAbstract { public const RESPONSE_TIMEZONE = 'UTC'; protected Request $request; - /** - * BaseTransformer constructor. - */ + /** @var string[] */ + protected array $availableIncludes = []; + + /** @var string[] */ + protected array $defaultIncludes = []; + final public function __construct() { // Transformers allow for dependency injection on the handle method. @@ -37,6 +36,13 @@ abstract class BaseTransformer extends TransformerAbstract */ abstract public function getResourceName(): string; + /** + * @return array + * + * Transforms a Model into a representation that can be shown to regular users of the API. + */ + abstract public function transform($model): array; // @phpstan-ignore missingType.parameter + /** * Sets the request on the instance. */ diff --git a/app/Transformers/Api/Application/DatabaseHostTransformer.php b/app/Transformers/Api/Application/DatabaseHostTransformer.php index 8f3453f6a..2bf54f508 100644 --- a/app/Transformers/Api/Application/DatabaseHostTransformer.php +++ b/app/Transformers/Api/Application/DatabaseHostTransformer.php @@ -24,9 +24,9 @@ class DatabaseHostTransformer extends BaseTransformer } /** - * Transform database host into a representation for the application API. + * @param DatabaseHost $model */ - public function transform(DatabaseHost $model): array + public function transform($model): array { return [ 'id' => $model->id, diff --git a/app/Transformers/Api/Application/EggTransformer.php b/app/Transformers/Api/Application/EggTransformer.php index a80847f8a..be342f24f 100644 --- a/app/Transformers/Api/Application/EggTransformer.php +++ b/app/Transformers/Api/Application/EggTransformer.php @@ -30,12 +30,9 @@ class EggTransformer extends BaseTransformer } /** - * Transform an Egg model into a representation that can be consumed by - * the application api. - * - * @throws \JsonException + * @param Egg $model */ - public function transform(Egg $model): array + public function transform($model): array { $model->loadMissing('configFrom'); diff --git a/app/Transformers/Api/Application/EggVariableTransformer.php b/app/Transformers/Api/Application/EggVariableTransformer.php index d70299787..af8320844 100644 --- a/app/Transformers/Api/Application/EggVariableTransformer.php +++ b/app/Transformers/Api/Application/EggVariableTransformer.php @@ -15,7 +15,10 @@ class EggVariableTransformer extends BaseTransformer return Egg::RESOURCE_NAME; } - public function transform(EggVariable $model): array + /** + * @param EggVariable $model + */ + public function transform($model): array { return $model->toArray(); } diff --git a/app/Transformers/Api/Application/MountTransformer.php b/app/Transformers/Api/Application/MountTransformer.php index ddd41d549..91e51ca6c 100644 --- a/app/Transformers/Api/Application/MountTransformer.php +++ b/app/Transformers/Api/Application/MountTransformer.php @@ -24,7 +24,10 @@ class MountTransformer extends BaseTransformer return Mount::RESOURCE_NAME; } - public function transform(Mount $model): array + /** + * @param Mount $model + */ + public function transform($model): array { return $model->toArray(); } diff --git a/app/Transformers/Api/Application/NodeTransformer.php b/app/Transformers/Api/Application/NodeTransformer.php index 1ee8950ce..1d0801706 100644 --- a/app/Transformers/Api/Application/NodeTransformer.php +++ b/app/Transformers/Api/Application/NodeTransformer.php @@ -24,9 +24,9 @@ class NodeTransformer extends BaseTransformer } /** - * Return a node transformed into a format that can be consumed by the external administrative API. + * @param Node $node */ - public function transform(Node $node): array + public function transform($node): array { $response = collect($node->toArray()) ->mapWithKeys(fn ($value, $key) => [snake_case($key) => $value]) diff --git a/app/Transformers/Api/Application/RolePermissionTransformer.php b/app/Transformers/Api/Application/RolePermissionTransformer.php index 16d9cc6cb..a0b24a5c3 100644 --- a/app/Transformers/Api/Application/RolePermissionTransformer.php +++ b/app/Transformers/Api/Application/RolePermissionTransformer.php @@ -11,7 +11,10 @@ class RolePermissionTransformer extends BaseTransformer return 'permissions'; } - public function transform(Permission $model): array + /** + * @param Permission $model + */ + public function transform($model): array { return [ 'name' => $model->name, diff --git a/app/Transformers/Api/Application/RoleTransformer.php b/app/Transformers/Api/Application/RoleTransformer.php index 8112d8b5a..1eb5047d6 100644 --- a/app/Transformers/Api/Application/RoleTransformer.php +++ b/app/Transformers/Api/Application/RoleTransformer.php @@ -21,9 +21,9 @@ class RoleTransformer extends BaseTransformer } /** - * Transform role into a representation for the application API. + * @param Role $model */ - public function transform(Role $model): array + public function transform($model): array { return [ 'id' => $model->id, diff --git a/app/Transformers/Api/Application/ServerDatabaseTransformer.php b/app/Transformers/Api/Application/ServerDatabaseTransformer.php index 0a680cb16..873621ec3 100644 --- a/app/Transformers/Api/Application/ServerDatabaseTransformer.php +++ b/app/Transformers/Api/Application/ServerDatabaseTransformer.php @@ -20,9 +20,9 @@ class ServerDatabaseTransformer extends BaseTransformer } /** - * Transform a database model in a representation for the application API. + * @param Database $model */ - public function transform(Database $model): array + public function transform($model): array { return [ 'id' => $model->id, diff --git a/app/Transformers/Api/Application/ServerTransformer.php b/app/Transformers/Api/Application/ServerTransformer.php index 5820c8952..2a1fe2598 100644 --- a/app/Transformers/Api/Application/ServerTransformer.php +++ b/app/Transformers/Api/Application/ServerTransformer.php @@ -48,9 +48,9 @@ class ServerTransformer extends BaseTransformer } /** - * Return a generic transformed server array. + * @param Server $server */ - public function transform(Server $server): array + public function transform($server): array { return [ 'id' => $server->getKey(), diff --git a/app/Transformers/Api/Application/ServerVariableTransformer.php b/app/Transformers/Api/Application/ServerVariableTransformer.php index a562170fe..da11bedab 100644 --- a/app/Transformers/Api/Application/ServerVariableTransformer.php +++ b/app/Transformers/Api/Application/ServerVariableTransformer.php @@ -23,9 +23,9 @@ class ServerVariableTransformer extends BaseTransformer } /** - * Return a generic transformed server variable array. + * @param EggVariable $variable */ - public function transform(EggVariable $variable): array + public function transform($variable): array { return $variable->toArray(); } diff --git a/app/Transformers/Api/Application/SubuserTransformer.php b/app/Transformers/Api/Application/SubuserTransformer.php index 26c214db8..f56bc4d6a 100644 --- a/app/Transformers/Api/Application/SubuserTransformer.php +++ b/app/Transformers/Api/Application/SubuserTransformer.php @@ -24,9 +24,9 @@ class SubuserTransformer extends BaseTransformer } /** - * Return a transformed Subuser model that can be consumed by external services. + * @param Subuser $subuser */ - public function transform(Subuser $subuser): array + public function transform($subuser): array { return [ 'id' => $subuser->id, diff --git a/app/Transformers/Api/Application/UserTransformer.php b/app/Transformers/Api/Application/UserTransformer.php index 0a5d751b6..1d2ddc1e8 100644 --- a/app/Transformers/Api/Application/UserTransformer.php +++ b/app/Transformers/Api/Application/UserTransformer.php @@ -10,9 +10,6 @@ use League\Fractal\Resource\NullResource; class UserTransformer extends BaseTransformer { - /** - * List of resources that can be included. - */ protected array $availableIncludes = [ 'servers', 'roles', @@ -27,9 +24,9 @@ class UserTransformer extends BaseTransformer } /** - * Return a transformed User model that can be consumed by external services. + * @param User $user */ - public function transform(User $user): array + public function transform($user): array { return [ 'id' => $user->id, diff --git a/app/Transformers/Api/Client/ActivityLogTransformer.php b/app/Transformers/Api/Client/ActivityLogTransformer.php index c54733f34..58388dec1 100644 --- a/app/Transformers/Api/Client/ActivityLogTransformer.php +++ b/app/Transformers/Api/Client/ActivityLogTransformer.php @@ -16,7 +16,10 @@ class ActivityLogTransformer extends BaseClientTransformer return ActivityLog::RESOURCE_NAME; } - public function transform(ActivityLog $model): array + /** + * @param ActivityLog $model + */ + public function transform($model): array { return [ // This is not for security, it is only to provide a unique identifier to diff --git a/app/Transformers/Api/Client/AllocationTransformer.php b/app/Transformers/Api/Client/AllocationTransformer.php index 4fd84ed61..553412ec1 100644 --- a/app/Transformers/Api/Client/AllocationTransformer.php +++ b/app/Transformers/Api/Client/AllocationTransformer.php @@ -14,7 +14,10 @@ class AllocationTransformer extends BaseClientTransformer return 'allocation'; } - public function transform(Allocation $model): array + /** + * @param Allocation $model + */ + public function transform($model): array { return [ 'id' => $model->id, diff --git a/app/Transformers/Api/Client/ApiKeyTransformer.php b/app/Transformers/Api/Client/ApiKeyTransformer.php index aadd81ac2..1d06b76e1 100644 --- a/app/Transformers/Api/Client/ApiKeyTransformer.php +++ b/app/Transformers/Api/Client/ApiKeyTransformer.php @@ -15,9 +15,9 @@ class ApiKeyTransformer extends BaseClientTransformer } /** - * Transform this model into a representation that can be consumed by a client. + * @param ApiKey $model */ - public function transform(ApiKey $model): array + public function transform($model): array { return [ 'identifier' => $model->identifier, diff --git a/app/Transformers/Api/Client/BackupTransformer.php b/app/Transformers/Api/Client/BackupTransformer.php index eb5a6776e..39b3ca8f7 100644 --- a/app/Transformers/Api/Client/BackupTransformer.php +++ b/app/Transformers/Api/Client/BackupTransformer.php @@ -11,7 +11,10 @@ class BackupTransformer extends BaseClientTransformer return Backup::RESOURCE_NAME; } - public function transform(Backup $backup): array + /** + * @param Backup $backup + */ + public function transform($backup): array { return [ 'uuid' => $backup->uuid, diff --git a/app/Transformers/Api/Client/DatabaseTransformer.php b/app/Transformers/Api/Client/DatabaseTransformer.php index 1a3855939..fcfc841cd 100644 --- a/app/Transformers/Api/Client/DatabaseTransformer.php +++ b/app/Transformers/Api/Client/DatabaseTransformer.php @@ -16,7 +16,10 @@ class DatabaseTransformer extends BaseClientTransformer return Database::RESOURCE_NAME; } - public function transform(Database $model): array + /** + * @param Database $model + */ + public function transform($model): array { $model->loadMissing('host'); diff --git a/app/Transformers/Api/Client/EggTransformer.php b/app/Transformers/Api/Client/EggTransformer.php index 78d6e7de4..cefc3c7e6 100644 --- a/app/Transformers/Api/Client/EggTransformer.php +++ b/app/Transformers/Api/Client/EggTransformer.php @@ -14,7 +14,10 @@ class EggTransformer extends BaseClientTransformer return Egg::RESOURCE_NAME; } - public function transform(Egg $egg): array + /** + * @param Egg $egg + */ + public function transform($egg): array { return [ 'uuid' => $egg->uuid, diff --git a/app/Transformers/Api/Client/EggVariableTransformer.php b/app/Transformers/Api/Client/EggVariableTransformer.php index 141f43b61..3730184ca 100644 --- a/app/Transformers/Api/Client/EggVariableTransformer.php +++ b/app/Transformers/Api/Client/EggVariableTransformer.php @@ -11,7 +11,10 @@ class EggVariableTransformer extends BaseClientTransformer return EggVariable::RESOURCE_NAME; } - public function transform(EggVariable $variable): array + /** + * @param EggVariable $variable + */ + public function transform($variable): array { // This guards against someone incorrectly retrieving variables (haha, me) and then passing // them into the transformer and along to the user. Just throw an exception and break the entire diff --git a/app/Transformers/Api/Client/FileObjectTransformer.php b/app/Transformers/Api/Client/FileObjectTransformer.php index d55b9f6ae..b8ebdbd56 100644 --- a/app/Transformers/Api/Client/FileObjectTransformer.php +++ b/app/Transformers/Api/Client/FileObjectTransformer.php @@ -8,9 +8,19 @@ use Illuminate\Support\Arr; class FileObjectTransformer extends BaseClientTransformer { /** - * Transform a file object response from the daemon into a standardized response. + * @param array{ + * name: string, + * mode: string, + * mode_bits: mixed, + * size: int, + * file: bool, + * symlink: bool, + * mime: string, + * created: mixed, + * modified: mixed, + * } $item */ - public function transform(array $item): array + public function transform($item): array { return [ 'name' => Arr::get($item, 'name'), diff --git a/app/Transformers/Api/Client/ScheduleTransformer.php b/app/Transformers/Api/Client/ScheduleTransformer.php index 3d7f77297..051c595b4 100644 --- a/app/Transformers/Api/Client/ScheduleTransformer.php +++ b/app/Transformers/Api/Client/ScheduleTransformer.php @@ -21,9 +21,9 @@ class ScheduleTransformer extends BaseClientTransformer } /** - * Returns a transformed schedule model such that a client can view the information. + * @param Schedule $model */ - public function transform(Schedule $model): array + public function transform($model): array { return [ 'id' => $model->id, diff --git a/app/Transformers/Api/Client/ServerTransformer.php b/app/Transformers/Api/Client/ServerTransformer.php index 281e1d00f..820a19cca 100644 --- a/app/Transformers/Api/Client/ServerTransformer.php +++ b/app/Transformers/Api/Client/ServerTransformer.php @@ -26,10 +26,9 @@ class ServerTransformer extends BaseClientTransformer } /** - * Transform a server model into a representation that can be returned - * to a client. + * @param Server $server */ - public function transform(Server $server): array + public function transform($server): array { /** @var \App\Services\Servers\StartupCommandService $service */ $service = Container::getInstance()->make(StartupCommandService::class); diff --git a/app/Transformers/Api/Client/StatsTransformer.php b/app/Transformers/Api/Client/StatsTransformer.php index 40949d8e8..d7273c1ee 100644 --- a/app/Transformers/Api/Client/StatsTransformer.php +++ b/app/Transformers/Api/Client/StatsTransformer.php @@ -12,10 +12,20 @@ class StatsTransformer extends BaseClientTransformer } /** - * Transform stats from the daemon into a result set that can be used in - * the client API. + * @param array{ + * state: string, + * is_suspended: bool, + * utilization: array{ + * memory_bytes: int, + * cpu_absolute: int, + * disk_bytes: int, + * rx_bytes: int, + * tx_bytes: int, + * uptime: int, + * }, + * } $data */ - public function transform(array $data): array + public function transform($data): array { return [ 'current_state' => Arr::get($data, 'state', 'stopped'), diff --git a/app/Transformers/Api/Client/SubuserTransformer.php b/app/Transformers/Api/Client/SubuserTransformer.php index 102d14d0c..9fc7e1812 100644 --- a/app/Transformers/Api/Client/SubuserTransformer.php +++ b/app/Transformers/Api/Client/SubuserTransformer.php @@ -15,9 +15,9 @@ class SubuserTransformer extends BaseClientTransformer } /** - * Transforms a subuser into a model that can be shown to a front-end user. + * @param Subuser $model */ - public function transform(Subuser $model): array + public function transform($model): array { return array_merge( $this->makeTransformer(UserTransformer::class)->transform($model->user), diff --git a/app/Transformers/Api/Client/TaskTransformer.php b/app/Transformers/Api/Client/TaskTransformer.php index 3e95577ea..3710bec19 100644 --- a/app/Transformers/Api/Client/TaskTransformer.php +++ b/app/Transformers/Api/Client/TaskTransformer.php @@ -15,9 +15,9 @@ class TaskTransformer extends BaseClientTransformer } /** - * Transforms a schedule's task into a client viewable format. + * @param Task $model */ - public function transform(Task $model): array + public function transform($model): array { return [ 'id' => $model->id, diff --git a/app/Transformers/Api/Client/UserSSHKeyTransformer.php b/app/Transformers/Api/Client/UserSSHKeyTransformer.php index ce153904e..880bba220 100644 --- a/app/Transformers/Api/Client/UserSSHKeyTransformer.php +++ b/app/Transformers/Api/Client/UserSSHKeyTransformer.php @@ -12,9 +12,9 @@ class UserSSHKeyTransformer extends BaseClientTransformer } /** - * Return's a user's SSH key in an API response format. + * @param UserSSHKey $model */ - public function transform(UserSSHKey $model): array + public function transform($model): array { return [ 'name' => $model->name, diff --git a/app/Transformers/Api/Client/UserTransformer.php b/app/Transformers/Api/Client/UserTransformer.php index e2399cdb4..df1f4cd93 100644 --- a/app/Transformers/Api/Client/UserTransformer.php +++ b/app/Transformers/Api/Client/UserTransformer.php @@ -16,10 +16,11 @@ class UserTransformer extends BaseClientTransformer } /** - * Transforms a User model into a representation that can be shown to regular - * users of the API. + * @param User $user + * + * {@inheritdoc} */ - public function transform(User $user): array + public function transform($user): array { return [ 'uuid' => $user->uuid, diff --git a/phpstan.neon b/phpstan.neon index e66afe111..778952147 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -14,8 +14,6 @@ parameters: ignoreErrors: - identifier: argument.templateType - identifier: missingType.generics - - identifier: missingType.iterableValue - - identifier: property.notFound # We are getting and setting environment variables directly -