From cc404c5bb7156494a1ebacb7a69ba10232181ada Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Mon, 21 Oct 2024 19:07:30 -0600 Subject: [PATCH] chore: run `php-cs-fixer` Signed-off-by: Matthew Penner --- .../Location/DeleteLocationCommand.php | 2 +- .../Node/NodeConfigurationCommand.php | 2 +- .../Server/BulkPowerActionCommand.php | 2 +- app/Console/Commands/UpgradeCommand.php | 2 +- app/Contracts/Extensions/HashidsInterface.php | 2 +- .../Repository/NestRepositoryInterface.php | 4 +-- .../Repository/ServerRepositoryInterface.php | 4 +-- .../SettingsRepositoryInterface.php | 2 +- app/Exceptions/DisplayException.php | 2 +- .../Http/HttpForbiddenException.php | 2 +- .../Server/ServerStateConflictException.php | 2 +- .../Http/TwoFactorAuthRequiredException.php | 2 +- .../Service/ServiceLimitExceededException.php | 2 +- app/Extensions/Backups/BackupManager.php | 2 +- app/Extensions/DynamicDatabaseConnection.php | 2 +- app/Extensions/Hashids.php | 5 +-- .../Laravel/Sanctum/NewAccessToken.php | 2 +- .../Controllers/Admin/DatabaseController.php | 2 +- .../Controllers/Admin/LocationController.php | 4 +-- .../Controllers/Admin/MountController.php | 2 +- .../Controllers/Admin/Nests/EggController.php | 4 +-- .../Admin/Nests/EggScriptController.php | 2 +- .../Admin/Nests/EggShareController.php | 2 +- .../Admin/Nests/EggVariableController.php | 2 +- .../Admin/Nests/NestController.php | 2 +- .../Admin/NodeAutoDeployController.php | 4 +-- .../Admin/Nodes/NodeViewController.php | 2 +- .../Controllers/Admin/NodesController.php | 2 +- .../Admin/Servers/CreateServerController.php | 2 +- .../Servers/ServerTransferController.php | 2 +- .../Admin/Servers/ServerViewController.php | 4 +-- .../Controllers/Admin/ServersController.php | 26 +++++++------- .../Admin/Settings/AdvancedController.php | 2 +- .../Admin/Settings/IndexController.php | 2 +- .../Admin/Settings/MailController.php | 2 +- app/Http/Controllers/Admin/UserController.php | 4 +-- .../Locations/LocationController.php | 2 +- .../Nodes/AllocationController.php | 2 +- .../Api/Application/Nodes/NodeController.php | 2 +- .../Servers/DatabaseController.php | 2 +- .../Application/Servers/ServerController.php | 2 +- .../Servers/ServerDetailsController.php | 2 +- .../Servers/ServerManagementController.php | 2 +- .../Api/Application/Users/UserController.php | 2 +- .../Api/Client/ApiKeyController.php | 4 +-- .../Api/Client/Servers/BackupController.php | 10 +++--- .../Api/Client/Servers/CommandController.php | 2 +- .../Api/Client/Servers/DatabaseController.php | 2 +- .../Api/Client/Servers/FileController.php | 2 +- .../Client/Servers/FileUploadController.php | 2 +- .../Servers/NetworkAllocationController.php | 6 ++-- .../Api/Client/Servers/ScheduleController.php | 8 ++--- .../Client/Servers/ScheduleTaskController.php | 8 ++--- .../Api/Client/Servers/SettingsController.php | 2 +- .../Api/Client/Servers/StartupController.php | 2 +- .../Api/Client/Servers/SubuserController.php | 2 +- .../Client/Servers/WebsocketController.php | 2 +- .../Api/Client/TwoFactorController.php | 2 +- .../Remote/ActivityProcessingController.php | 2 +- .../Backups/BackupRemoteUploadController.php | 2 +- .../Remote/Backups/BackupStatusController.php | 6 ++-- .../Servers/ServerDetailsController.php | 4 +-- .../Servers/ServerTransferController.php | 2 +- .../Auth/AbstractLoginController.php | 8 ++--- .../Auth/LoginCheckpointController.php | 4 +-- app/Http/Controllers/Auth/LoginController.php | 2 +- .../Auth/ResetPasswordController.php | 4 +-- app/Http/Controllers/Base/IndexController.php | 2 +- .../Admin/Servers/ServerInstalled.php | 2 +- app/Http/Middleware/AdminAuthenticate.php | 2 +- .../Middleware/Api/AuthenticateIPAccess.php | 4 +-- .../Client/Server/ResourceBelongsToServer.php | 2 +- .../Api/Daemon/DaemonAuthenticate.php | 2 +- .../Middleware/RedirectIfAuthenticated.php | 2 +- .../RequireTwoFactorAuthentication.php | 2 +- app/Http/Requests/Admin/AdminFormRequest.php | 2 +- .../Settings/MailSettingsFormRequest.php | 2 +- .../Api/Application/ApplicationApiRequest.php | 2 +- .../Application/Nodes/StoreNodeRequest.php | 2 +- .../Application/Nodes/UpdateNodeRequest.php | 2 +- .../Application/Users/StoreUserRequest.php | 2 +- .../Application/Users/UpdateUserRequest.php | 2 +- .../Api/Client/Account/UpdateEmailRequest.php | 2 +- .../Client/Account/UpdatePasswordRequest.php | 2 +- .../Settings/SetDockerImageRequest.php | 2 +- .../Servers/Subusers/SubuserRequest.php | 4 +-- app/Jobs/Schedule/RunTaskJob.php | 6 ++-- app/Models/ActivityLog.php | 4 +-- app/Models/ActivityLogSubject.php | 2 +- app/Models/Allocation.php | 7 ++-- app/Models/ApiKey.php | 4 +-- app/Models/AuditLog.php | 2 +- app/Models/Backup.php | 2 +- app/Models/Database.php | 8 ++--- app/Models/Egg.php | 6 ++-- app/Models/EggMount.php | 2 +- app/Models/EggVariable.php | 4 +-- app/Models/Location.php | 3 -- app/Models/Model.php | 4 +-- app/Models/MountNode.php | 2 +- app/Models/MountServer.php | 2 +- app/Models/Node.php | 2 +- app/Models/RecoveryToken.php | 2 +- app/Models/Schedule.php | 5 +-- app/Models/Server.php | 30 ++++++++-------- app/Models/ServerTransfer.php | 6 ++-- app/Models/ServerVariable.php | 4 +-- app/Models/Subuser.php | 4 +-- app/Models/Task.php | 7 ++-- app/Models/Traits/HasAccessTokens.php | 2 +- app/Models/UserSSHKey.php | 2 +- app/Repositories/Eloquent/EggRepository.php | 6 ++-- .../Eloquent/EloquentRepository.php | 14 ++++---- .../Eloquent/LocationRepository.php | 4 +-- app/Repositories/Eloquent/MountRepository.php | 2 +- app/Repositories/Eloquent/NestRepository.php | 10 +++--- .../Eloquent/ScheduleRepository.php | 2 +- .../Eloquent/ServerRepository.php | 10 +++--- .../Eloquent/SettingsRepository.php | 2 +- .../Eloquent/SubuserRepository.php | 2 +- app/Repositories/Eloquent/TaskRepository.php | 2 +- .../Wings/DaemonBackupRepository.php | 12 ++++--- .../Wings/DaemonCommandRepository.php | 6 +++- .../Wings/DaemonConfigurationRepository.php | 8 +++-- .../Wings/DaemonFileRepository.php | 32 +++++++++-------- .../Wings/DaemonPowerRepository.php | 6 +++- app/Repositories/Wings/DaemonRepository.php | 4 +++ .../Wings/DaemonServerRepository.php | 20 ++++++----- .../Wings/DaemonTransferRepository.php | 6 +++- app/Rules/Fqdn.php | 3 +- app/Rules/Username.php | 1 - app/Services/Activity/ActivityLogService.php | 5 ++- .../Allocations/AllocationDeletionService.php | 2 +- .../Allocations/AssignmentService.php | 10 +++--- .../FindAssignableAllocationService.php | 4 +-- app/Services/Backups/DeleteBackupService.php | 2 +- .../Backups/InitiateBackupService.php | 12 +++---- .../Databases/DatabaseManagementService.php | 8 ++--- .../Databases/DatabasePasswordService.php | 2 +- .../Databases/Hosts/HostCreationService.php | 2 +- .../Databases/Hosts/HostDeletionService.php | 4 +-- .../Databases/Hosts/HostUpdateService.php | 2 +- .../Deployment/AllocationSelectionService.php | 4 +-- .../Deployment/FindViableNodesService.php | 4 +-- app/Services/Eggs/EggCreationService.php | 2 +- app/Services/Eggs/EggDeletionService.php | 6 ++-- app/Services/Eggs/EggParserService.php | 2 +- app/Services/Eggs/EggUpdateService.php | 2 +- .../Eggs/Scripts/InstallScriptService.php | 2 +- .../Eggs/Sharing/EggImporterService.php | 2 +- .../Variables/VariableCreationService.php | 2 +- .../Eggs/Variables/VariableUpdateService.php | 4 +-- .../Helpers/SoftwareVersionService.php | 5 ++- .../Locations/LocationDeletionService.php | 4 +-- app/Services/Nests/NestCreationService.php | 2 +- app/Services/Nests/NestDeletionService.php | 4 +-- app/Services/Nodes/NodeDeletionService.php | 4 +-- app/Services/Nodes/NodeUpdateService.php | 4 +-- .../Servers/BuildModificationService.php | 8 ++--- .../Servers/ReinstallServerService.php | 2 +- .../Servers/ServerCreationService.php | 10 +++--- .../Servers/ServerDeletionService.php | 2 +- .../Servers/StartupModificationService.php | 2 +- app/Services/Servers/SuspensionService.php | 2 +- .../Servers/VariableValidatorService.php | 2 +- .../Subusers/SubuserCreationService.php | 6 ++-- .../Telemetry/TelemetryCollectionService.php | 23 ++++++------- app/Services/Users/ToggleTwoFactorService.php | 6 ++-- app/Services/Users/TwoFactorSetupService.php | 2 +- app/Services/Users/UserCreationService.php | 4 +-- app/Services/Users/UserDeletionService.php | 4 +-- .../Commands/EnvironmentWriterTrait.php | 2 +- .../Services/ValidatesValidationRules.php | 2 +- .../Api/Client/ActivityLogTransformer.php | 2 +- .../Api/Client/ApiKeyTransformer.php | 3 -- .../Api/Client/BaseClientTransformer.php | 5 +-- .../Api/Client/ScheduleTransformer.php | 3 -- .../Api/Client/ServerTransformer.php | 2 +- .../Api/Client/TaskTransformer.php | 3 -- bootstrap/tests.php | 2 +- config/app.php | 6 ++-- config/session.php | 6 ++-- database/Seeders/EggSeeder.php | 2 +- database/Seeders/NestSeeder.php | 14 ++++---- .../2017_04_15_125021_UpgradeTaskSystem.php | 4 +-- ...1_13_142012_SetupTableForKeyEncryption.php | 8 ++--- ...152_remove_default_null_value_on_table.php | 4 +-- ...4_store_node_tokens_as_encrypted_value.php | 6 ++-- tests/Assertions/AssertsActivityLogged.php | 2 +- .../Api/Client/AccountControllerTest.php | 14 ++++---- .../Api/Client/ApiKeyControllerTest.php | 34 +++++++++---------- .../Client/ClientApiIntegrationTestCase.php | 2 +- .../Api/Client/ClientControllerTest.php | 8 ++--- .../Allocation/DeleteAllocationTest.php | 6 ++-- .../Client/Server/Backup/DeleteBackupTest.php | 2 +- .../Schedule/CreateServerScheduleTest.php | 2 +- .../Server/Schedule/ExecuteScheduleTest.php | 6 ++-- .../Schedule/GetServerSchedulesTest.php | 4 +-- .../Schedule/UpdateServerScheduleTest.php | 4 +-- .../CreateServerScheduleTaskTest.php | 14 ++++---- .../Client/Server/SettingsControllerTest.php | 4 +-- .../Subuser/CreateServerSubuserTest.php | 4 +-- .../Server/Subuser/DeleteSubuserTest.php | 6 ++-- .../Subuser/SubuserAuthorizationTest.php | 2 +- .../Server/Subuser/UpdateSubuserTest.php | 2 +- .../Api/Client/TwoFactorControllerTest.php | 14 ++++---- .../SftpAuthenticationControllerTest.php | 2 +- .../Jobs/Schedule/RunTaskJobTest.php | 16 ++++----- .../Schedules/ProcessScheduleServiceTest.php | 16 ++++----- .../Servers/BuildModificationServiceTest.php | 10 +++--- .../Servers/ServerCreationServiceTest.php | 14 ++++---- .../Servers/ServerDeletionServiceTest.php | 4 +-- .../StartupModificationServiceTest.php | 2 +- tests/Traits/Http/RequestMockHelpers.php | 6 ++-- .../Traits/Integration/CreatesTestModels.php | 16 ++++----- .../Api/Daemon/DaemonAuthenticateTest.php | 4 +-- 216 files changed, 500 insertions(+), 506 deletions(-) diff --git a/app/Console/Commands/Location/DeleteLocationCommand.php b/app/Console/Commands/Location/DeleteLocationCommand.php index 3193e0c3d4..ae9d11915f 100644 --- a/app/Console/Commands/Location/DeleteLocationCommand.php +++ b/app/Console/Commands/Location/DeleteLocationCommand.php @@ -20,7 +20,7 @@ class DeleteLocationCommand extends Command */ public function __construct( private LocationDeletionService $deletionService, - private LocationRepositoryInterface $repository + private LocationRepositoryInterface $repository, ) { parent::__construct(); } diff --git a/app/Console/Commands/Node/NodeConfigurationCommand.php b/app/Console/Commands/Node/NodeConfigurationCommand.php index 9bf0f425c9..83a25720b1 100644 --- a/app/Console/Commands/Node/NodeConfigurationCommand.php +++ b/app/Console/Commands/Node/NodeConfigurationCommand.php @@ -17,7 +17,7 @@ public function handle(): int { $column = ctype_digit((string) $this->argument('node')) ? 'id' : 'uuid'; - /** @var \Pterodactyl\Models\Node $node */ + /** @var Node $node */ $node = Node::query()->where($column, $this->argument('node'))->firstOr(function () { $this->error('The selected node does not exist.'); diff --git a/app/Console/Commands/Server/BulkPowerActionCommand.php b/app/Console/Commands/Server/BulkPowerActionCommand.php index 4e7ae1af95..5df31bec94 100644 --- a/app/Console/Commands/Server/BulkPowerActionCommand.php +++ b/app/Console/Commands/Server/BulkPowerActionCommand.php @@ -30,7 +30,7 @@ public function __construct(private DaemonPowerRepository $powerRepository, priv /** * Handle the bulk power request. * - * @throws \Illuminate\Validation\ValidationException + * @throws ValidationException */ public function handle() { diff --git a/app/Console/Commands/UpgradeCommand.php b/app/Console/Commands/UpgradeCommand.php index 6d033a51ca..ddb83ebf46 100644 --- a/app/Console/Commands/UpgradeCommand.php +++ b/app/Console/Commands/UpgradeCommand.php @@ -133,7 +133,7 @@ public function handle() /** @var \Illuminate\Foundation\Application $app */ $app = require __DIR__ . '/../../../bootstrap/app.php'; - /** @var \Pterodactyl\Console\Kernel $kernel */ + /** @var Kernel $kernel */ $kernel = $app->make(Kernel::class); $kernel->bootstrap(); $this->setLaravel($app); diff --git a/app/Contracts/Extensions/HashidsInterface.php b/app/Contracts/Extensions/HashidsInterface.php index 1cf83b4a00..3fd3dedbbd 100644 --- a/app/Contracts/Extensions/HashidsInterface.php +++ b/app/Contracts/Extensions/HashidsInterface.php @@ -11,5 +11,5 @@ interface HashidsInterface extends VendorHashidsInterface * * @throws \InvalidArgumentException */ - public function decodeFirst(string $encoded, string $default = null): mixed; + public function decodeFirst(string $encoded, ?string $default = null): mixed; } diff --git a/app/Contracts/Repository/NestRepositoryInterface.php b/app/Contracts/Repository/NestRepositoryInterface.php index 2f80bedd56..9049d16cb2 100644 --- a/app/Contracts/Repository/NestRepositoryInterface.php +++ b/app/Contracts/Repository/NestRepositoryInterface.php @@ -12,14 +12,14 @@ interface NestRepositoryInterface extends RepositoryInterface * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function getWithEggs(int $id = null): Collection|Nest; + public function getWithEggs(?int $id = null): Collection|Nest; /** * Return a nest or all nests and the count of eggs and servers for that nest. * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function getWithCounts(int $id = null): Collection|Nest; + public function getWithCounts(?int $id = null): Collection|Nest; /** * Return a nest along with its associated eggs and the servers relation on those eggs. diff --git a/app/Contracts/Repository/ServerRepositoryInterface.php b/app/Contracts/Repository/ServerRepositoryInterface.php index 9294a191b5..1a30f1ec01 100644 --- a/app/Contracts/Repository/ServerRepositoryInterface.php +++ b/app/Contracts/Repository/ServerRepositoryInterface.php @@ -16,12 +16,12 @@ public function loadEggRelations(Server $server, bool $refresh = false): Server; /** * Return a collection of servers with their associated data for rebuild operations. */ - public function getDataForRebuild(int $server = null, int $node = null): Collection; + public function getDataForRebuild(?int $server = null, ?int $node = null): Collection; /** * Return a collection of servers with their associated data for reinstall operations. */ - public function getDataForReinstall(int $server = null, int $node = null): Collection; + public function getDataForReinstall(?int $server = null, ?int $node = null): Collection; /** * Return a server model and all variables associated with the server. diff --git a/app/Contracts/Repository/SettingsRepositoryInterface.php b/app/Contracts/Repository/SettingsRepositoryInterface.php index c55c09b747..09fd8f0e8a 100644 --- a/app/Contracts/Repository/SettingsRepositoryInterface.php +++ b/app/Contracts/Repository/SettingsRepositoryInterface.php @@ -10,7 +10,7 @@ interface SettingsRepositoryInterface extends RepositoryInterface * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function set(string $key, string $value = null); + public function set(string $key, ?string $value = null); /** * Retrieve a persistent setting from the database. diff --git a/app/Exceptions/DisplayException.php b/app/Exceptions/DisplayException.php index c1440dbe08..884df9a893 100644 --- a/app/Exceptions/DisplayException.php +++ b/app/Exceptions/DisplayException.php @@ -72,7 +72,7 @@ public function report() try { $logger = Container::getInstance()->make(LoggerInterface::class); - } catch (Exception) { + } catch (\Exception) { throw $this->getPrevious(); } diff --git a/app/Exceptions/Http/HttpForbiddenException.php b/app/Exceptions/Http/HttpForbiddenException.php index 1488265a93..3fc8cb6d8c 100644 --- a/app/Exceptions/Http/HttpForbiddenException.php +++ b/app/Exceptions/Http/HttpForbiddenException.php @@ -10,7 +10,7 @@ class HttpForbiddenException extends HttpException /** * HttpForbiddenException constructor. */ - public function __construct(string $message = null, \Throwable $previous = null) + public function __construct(?string $message = null, ?\Throwable $previous = null) { parent::__construct(Response::HTTP_FORBIDDEN, $message, $previous); } diff --git a/app/Exceptions/Http/Server/ServerStateConflictException.php b/app/Exceptions/Http/Server/ServerStateConflictException.php index 546024c238..7d19bfc497 100644 --- a/app/Exceptions/Http/Server/ServerStateConflictException.php +++ b/app/Exceptions/Http/Server/ServerStateConflictException.php @@ -11,7 +11,7 @@ class ServerStateConflictException extends ConflictHttpException * Exception thrown when the server is in an unsupported state for API access or * certain operations within the codebase. */ - public function __construct(Server $server, \Throwable $previous = null) + public function __construct(Server $server, ?\Throwable $previous = null) { $message = 'This server is currently in an unsupported state, please try again later.'; if ($server->isSuspended()) { diff --git a/app/Exceptions/Http/TwoFactorAuthRequiredException.php b/app/Exceptions/Http/TwoFactorAuthRequiredException.php index 95f300e2e6..9689338c2e 100644 --- a/app/Exceptions/Http/TwoFactorAuthRequiredException.php +++ b/app/Exceptions/Http/TwoFactorAuthRequiredException.php @@ -11,7 +11,7 @@ class TwoFactorAuthRequiredException extends HttpException implements HttpExcept /** * TwoFactorAuthRequiredException constructor. */ - public function __construct(\Throwable $previous = null) + public function __construct(?\Throwable $previous = null) { parent::__construct(Response::HTTP_BAD_REQUEST, 'Two-factor authentication is required on this account in order to access this endpoint.', $previous); } diff --git a/app/Exceptions/Service/ServiceLimitExceededException.php b/app/Exceptions/Service/ServiceLimitExceededException.php index 450a1743ba..9bbb371f4c 100644 --- a/app/Exceptions/Service/ServiceLimitExceededException.php +++ b/app/Exceptions/Service/ServiceLimitExceededException.php @@ -10,7 +10,7 @@ class ServiceLimitExceededException extends DisplayException * Exception thrown when something goes over a defined limit, such as allocated * ports, tasks, databases, etc. */ - public function __construct(string $message, \Throwable $previous = null) + public function __construct(string $message, ?\Throwable $previous = null) { parent::__construct($message, $previous, self::LEVEL_WARNING); } diff --git a/app/Extensions/Backups/BackupManager.php b/app/Extensions/Backups/BackupManager.php index 41e26c34cb..60f394fb92 100644 --- a/app/Extensions/Backups/BackupManager.php +++ b/app/Extensions/Backups/BackupManager.php @@ -38,7 +38,7 @@ public function __construct(protected Application $app) /** * Returns a backup adapter instance. */ - public function adapter(string $name = null): FilesystemAdapter + public function adapter(?string $name = null): FilesystemAdapter { return $this->get($name ?: $this->getDefaultAdapter()); } diff --git a/app/Extensions/DynamicDatabaseConnection.php b/app/Extensions/DynamicDatabaseConnection.php index 5adbd171da..2bed3436e0 100644 --- a/app/Extensions/DynamicDatabaseConnection.php +++ b/app/Extensions/DynamicDatabaseConnection.php @@ -19,7 +19,7 @@ class DynamicDatabaseConnection public function __construct( protected ConfigRepository $config, protected Encrypter $encrypter, - protected DatabaseHostRepositoryInterface $repository + protected DatabaseHostRepositoryInterface $repository, ) { } diff --git a/app/Extensions/Hashids.php b/app/Extensions/Hashids.php index 1a6bfdb39c..4a0c4c6627 100644 --- a/app/Extensions/Hashids.php +++ b/app/Extensions/Hashids.php @@ -7,10 +7,7 @@ class Hashids extends VendorHashids implements HashidsInterface { - /** - * {@inheritdoc} - */ - public function decodeFirst(string $encoded, string $default = null): mixed + public function decodeFirst(string $encoded, ?string $default = null): mixed { $result = $this->decode($encoded); if (!is_array($result)) { diff --git a/app/Extensions/Laravel/Sanctum/NewAccessToken.php b/app/Extensions/Laravel/Sanctum/NewAccessToken.php index 256e57b61f..53e9fe4992 100644 --- a/app/Extensions/Laravel/Sanctum/NewAccessToken.php +++ b/app/Extensions/Laravel/Sanctum/NewAccessToken.php @@ -6,7 +6,7 @@ use Laravel\Sanctum\NewAccessToken as SanctumAccessToken; /** - * @property \Pterodactyl\Models\ApiKey $accessToken + * @property ApiKey $accessToken */ class NewAccessToken extends SanctumAccessToken { diff --git a/app/Http/Controllers/Admin/DatabaseController.php b/app/Http/Controllers/Admin/DatabaseController.php index 864fb0307e..3755166f3f 100644 --- a/app/Http/Controllers/Admin/DatabaseController.php +++ b/app/Http/Controllers/Admin/DatabaseController.php @@ -30,7 +30,7 @@ public function __construct( private HostDeletionService $deletionService, private HostUpdateService $updateService, private LocationRepositoryInterface $locationRepository, - private ViewFactory $view + private ViewFactory $view, ) { } diff --git a/app/Http/Controllers/Admin/LocationController.php b/app/Http/Controllers/Admin/LocationController.php index ea01cbaa90..829f52dafa 100644 --- a/app/Http/Controllers/Admin/LocationController.php +++ b/app/Http/Controllers/Admin/LocationController.php @@ -26,7 +26,7 @@ public function __construct( protected LocationDeletionService $deletionService, protected LocationRepositoryInterface $repository, protected LocationUpdateService $updateService, - protected ViewFactory $view + protected ViewFactory $view, ) { } @@ -86,7 +86,7 @@ public function update(LocationFormRequest $request, Location $location): Redire * Delete a location from the system. * * @throws \Exception - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException */ public function delete(Location $location): RedirectResponse { diff --git a/app/Http/Controllers/Admin/MountController.php b/app/Http/Controllers/Admin/MountController.php index 097ad6690b..a0a93c9549 100644 --- a/app/Http/Controllers/Admin/MountController.php +++ b/app/Http/Controllers/Admin/MountController.php @@ -28,7 +28,7 @@ public function __construct( protected NestRepositoryInterface $nestRepository, protected LocationRepositoryInterface $locationRepository, protected MountRepository $repository, - protected ViewFactory $view + protected ViewFactory $view, ) { } diff --git a/app/Http/Controllers/Admin/Nests/EggController.php b/app/Http/Controllers/Admin/Nests/EggController.php index e71e48e91a..6698d24c92 100644 --- a/app/Http/Controllers/Admin/Nests/EggController.php +++ b/app/Http/Controllers/Admin/Nests/EggController.php @@ -27,7 +27,7 @@ public function __construct( protected EggRepositoryInterface $repository, protected EggUpdateService $updateService, protected NestRepositoryInterface $nestRepository, - protected ViewFactory $view + protected ViewFactory $view, ) { } @@ -111,7 +111,7 @@ public function destroy(Egg $egg): RedirectResponse /** * Normalizes a string of docker image data into the expected egg format. */ - protected function normalizeDockerImages(string $input = null): array + protected function normalizeDockerImages(?string $input = null): array { $data = array_map(fn ($value) => trim($value), explode("\n", $input ?? '')); diff --git a/app/Http/Controllers/Admin/Nests/EggScriptController.php b/app/Http/Controllers/Admin/Nests/EggScriptController.php index 4f997e5a86..ef6a5f799c 100644 --- a/app/Http/Controllers/Admin/Nests/EggScriptController.php +++ b/app/Http/Controllers/Admin/Nests/EggScriptController.php @@ -21,7 +21,7 @@ public function __construct( protected AlertsMessageBag $alert, protected EggRepositoryInterface $repository, protected InstallScriptService $installScriptService, - protected ViewFactory $view + protected ViewFactory $view, ) { } diff --git a/app/Http/Controllers/Admin/Nests/EggShareController.php b/app/Http/Controllers/Admin/Nests/EggShareController.php index b2c704e52a..85efa09a62 100644 --- a/app/Http/Controllers/Admin/Nests/EggShareController.php +++ b/app/Http/Controllers/Admin/Nests/EggShareController.php @@ -21,7 +21,7 @@ public function __construct( protected AlertsMessageBag $alert, protected EggExporterService $exporterService, protected EggImporterService $importerService, - protected EggUpdateImporterService $updateImporterService + protected EggUpdateImporterService $updateImporterService, ) { } diff --git a/app/Http/Controllers/Admin/Nests/EggVariableController.php b/app/Http/Controllers/Admin/Nests/EggVariableController.php index 2b84e8b022..520866488c 100644 --- a/app/Http/Controllers/Admin/Nests/EggVariableController.php +++ b/app/Http/Controllers/Admin/Nests/EggVariableController.php @@ -26,7 +26,7 @@ public function __construct( protected VariableUpdateService $updateService, protected EggRepositoryInterface $repository, protected EggVariableRepositoryInterface $variableRepository, - protected ViewFactory $view + protected ViewFactory $view, ) { } diff --git a/app/Http/Controllers/Admin/Nests/NestController.php b/app/Http/Controllers/Admin/Nests/NestController.php index 311a5df28b..09220670ec 100644 --- a/app/Http/Controllers/Admin/Nests/NestController.php +++ b/app/Http/Controllers/Admin/Nests/NestController.php @@ -24,7 +24,7 @@ public function __construct( protected NestDeletionService $nestDeletionService, protected NestRepositoryInterface $repository, protected NestUpdateService $nestUpdateService, - protected ViewFactory $view + protected ViewFactory $view, ) { } diff --git a/app/Http/Controllers/Admin/NodeAutoDeployController.php b/app/Http/Controllers/Admin/NodeAutoDeployController.php index ac0684a9c9..c53d8b9a40 100644 --- a/app/Http/Controllers/Admin/NodeAutoDeployController.php +++ b/app/Http/Controllers/Admin/NodeAutoDeployController.php @@ -19,7 +19,7 @@ class NodeAutoDeployController extends Controller public function __construct( private ApiKeyRepository $repository, private Encrypter $encrypter, - private KeyCreationService $keyCreationService + private KeyCreationService $keyCreationService, ) { } @@ -31,7 +31,7 @@ public function __construct( */ public function __invoke(Request $request, Node $node): JsonResponse { - /** @var \Pterodactyl\Models\ApiKey|null $key */ + /** @var ApiKey|null $key */ $key = $this->repository->getApplicationKeys($request->user()) ->filter(function (ApiKey $key) { foreach ($key->getAttributes() as $permission => $value) { diff --git a/app/Http/Controllers/Admin/Nodes/NodeViewController.php b/app/Http/Controllers/Admin/Nodes/NodeViewController.php index 6738903230..ed8cd20584 100644 --- a/app/Http/Controllers/Admin/Nodes/NodeViewController.php +++ b/app/Http/Controllers/Admin/Nodes/NodeViewController.php @@ -29,7 +29,7 @@ public function __construct( private NodeRepository $repository, private ServerRepository $serverRepository, private SoftwareVersionService $versionService, - private ViewFactory $view + private ViewFactory $view, ) { } diff --git a/app/Http/Controllers/Admin/NodesController.php b/app/Http/Controllers/Admin/NodesController.php index 71094a5175..a641310e15 100644 --- a/app/Http/Controllers/Admin/NodesController.php +++ b/app/Http/Controllers/Admin/NodesController.php @@ -44,7 +44,7 @@ public function __construct( protected ServerRepositoryInterface $serverRepository, protected NodeUpdateService $updateService, protected SoftwareVersionService $versionService, - protected ViewFactory $view + protected ViewFactory $view, ) { } diff --git a/app/Http/Controllers/Admin/Servers/CreateServerController.php b/app/Http/Controllers/Admin/Servers/CreateServerController.php index c0fee8c8e6..0bf26df49d 100644 --- a/app/Http/Controllers/Admin/Servers/CreateServerController.php +++ b/app/Http/Controllers/Admin/Servers/CreateServerController.php @@ -24,7 +24,7 @@ public function __construct( private NestRepository $nestRepository, private NodeRepository $nodeRepository, private ServerCreationService $creationService, - private ViewFactory $view + private ViewFactory $view, ) { } diff --git a/app/Http/Controllers/Admin/Servers/ServerTransferController.php b/app/Http/Controllers/Admin/Servers/ServerTransferController.php index 8941ce10c5..d9fc5d153a 100644 --- a/app/Http/Controllers/Admin/Servers/ServerTransferController.php +++ b/app/Http/Controllers/Admin/Servers/ServerTransferController.php @@ -26,7 +26,7 @@ public function __construct( private ConnectionInterface $connection, private DaemonTransferRepository $daemonTransferRepository, private NodeJWTService $nodeJWTService, - private NodeRepository $nodeRepository + private NodeRepository $nodeRepository, ) { } diff --git a/app/Http/Controllers/Admin/Servers/ServerViewController.php b/app/Http/Controllers/Admin/Servers/ServerViewController.php index 58d8b7d1a2..1bf731cf18 100644 --- a/app/Http/Controllers/Admin/Servers/ServerViewController.php +++ b/app/Http/Controllers/Admin/Servers/ServerViewController.php @@ -33,7 +33,7 @@ public function __construct( private NodeRepository $nodeRepository, private ServerRepository $repository, private EnvironmentService $environmentService, - private ViewFactory $view + private ViewFactory $view, ) { } @@ -118,7 +118,7 @@ public function mounts(Request $request, Server $server): View * Returns the base server management page, or an exception if the server * is in a state that cannot be recovered from. * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException */ public function manage(Request $request, Server $server): View { diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index 3d2c55ac40..1805a831a3 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -57,14 +57,14 @@ public function __construct( protected NestRepositoryInterface $nestRepository, protected ServerConfigurationStructureService $serverConfigurationStructureService, protected StartupModificationService $startupModificationService, - protected SuspensionService $suspensionService + protected SuspensionService $suspensionService, ) { } /** * Update the details for a server. * - * @throws \Pterodactyl\Exceptions\Model\DataValidationException + * @throws DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function setDetails(Request $request, Server $server): RedirectResponse @@ -81,8 +81,8 @@ public function setDetails(Request $request, Server $server): RedirectResponse /** * Toggles the installation status for a server. * - * @throws \Pterodactyl\Exceptions\DisplayException - * @throws \Pterodactyl\Exceptions\Model\DataValidationException + * @throws DisplayException + * @throws DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function toggleInstall(Server $server): RedirectResponse @@ -103,8 +103,8 @@ public function toggleInstall(Server $server): RedirectResponse /** * Reinstalls the server with the currently assigned service. * - * @throws \Pterodactyl\Exceptions\DisplayException - * @throws \Pterodactyl\Exceptions\Model\DataValidationException + * @throws DisplayException + * @throws DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function reinstallServer(Server $server): RedirectResponse @@ -118,8 +118,8 @@ public function reinstallServer(Server $server): RedirectResponse /** * Manage the suspension status for a server. * - * @throws \Pterodactyl\Exceptions\DisplayException - * @throws \Pterodactyl\Exceptions\Model\DataValidationException + * @throws DisplayException + * @throws DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function manageSuspension(Request $request, Server $server): RedirectResponse @@ -135,9 +135,9 @@ public function manageSuspension(Request $request, Server $server): RedirectResp /** * Update the build configuration for a server. * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException - * @throws \Illuminate\Validation\ValidationException + * @throws ValidationException */ public function updateBuild(Request $request, Server $server): RedirectResponse { @@ -159,7 +159,7 @@ public function updateBuild(Request $request, Server $server): RedirectResponse /** * Start the server deletion process. * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException * @throws \Throwable */ public function delete(Request $request, Server $server): RedirectResponse @@ -173,7 +173,7 @@ public function delete(Request $request, Server $server): RedirectResponse /** * Update the startup command as well as variables. * - * @throws \Illuminate\Validation\ValidationException + * @throws ValidationException */ public function saveStartup(Request $request, Server $server): RedirectResponse { @@ -220,7 +220,7 @@ public function newDatabase(StoreServerDatabaseRequest $request, Server $server) */ public function resetDatabasePassword(Request $request, Server $server): Response { - /** @var \Pterodactyl\Models\Database $database */ + /** @var Database $database */ $database = $server->databases()->findOrFail($request->input('database')); $this->databasePasswordService->handle($database); diff --git a/app/Http/Controllers/Admin/Settings/AdvancedController.php b/app/Http/Controllers/Admin/Settings/AdvancedController.php index bf68832325..9033e7b924 100644 --- a/app/Http/Controllers/Admin/Settings/AdvancedController.php +++ b/app/Http/Controllers/Admin/Settings/AdvancedController.php @@ -22,7 +22,7 @@ public function __construct( private ConfigRepository $config, private Kernel $kernel, private SettingsRepositoryInterface $settings, - private ViewFactory $view + private ViewFactory $view, ) { } diff --git a/app/Http/Controllers/Admin/Settings/IndexController.php b/app/Http/Controllers/Admin/Settings/IndexController.php index eabede932c..f45a464046 100644 --- a/app/Http/Controllers/Admin/Settings/IndexController.php +++ b/app/Http/Controllers/Admin/Settings/IndexController.php @@ -25,7 +25,7 @@ public function __construct( private Kernel $kernel, private SettingsRepositoryInterface $settings, private SoftwareVersionService $versionService, - private ViewFactory $view + private ViewFactory $view, ) { } diff --git a/app/Http/Controllers/Admin/Settings/MailController.php b/app/Http/Controllers/Admin/Settings/MailController.php index ab81ec06f3..b62a250cfa 100644 --- a/app/Http/Controllers/Admin/Settings/MailController.php +++ b/app/Http/Controllers/Admin/Settings/MailController.php @@ -27,7 +27,7 @@ public function __construct( private Encrypter $encrypter, private Kernel $kernel, private SettingsRepositoryInterface $settings, - private ViewFactory $view + private ViewFactory $view, ) { } diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 1d6db65691..76f9bacb8a 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -36,7 +36,7 @@ public function __construct( protected Translator $translator, protected UserUpdateService $updateService, protected UserRepositoryInterface $repository, - protected ViewFactory $view + protected ViewFactory $view, ) { } @@ -85,7 +85,7 @@ public function view(User $user): View * Delete a user from the system. * * @throws \Exception - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException */ public function delete(Request $request, User $user): RedirectResponse { diff --git a/app/Http/Controllers/Api/Application/Locations/LocationController.php b/app/Http/Controllers/Api/Application/Locations/LocationController.php index b95a0776a9..ae67d13907 100644 --- a/app/Http/Controllers/Api/Application/Locations/LocationController.php +++ b/app/Http/Controllers/Api/Application/Locations/LocationController.php @@ -25,7 +25,7 @@ class LocationController extends ApplicationApiController public function __construct( private LocationCreationService $creationService, private LocationDeletionService $deletionService, - private LocationUpdateService $updateService + private LocationUpdateService $updateService, ) { parent::__construct(); } diff --git a/app/Http/Controllers/Api/Application/Nodes/AllocationController.php b/app/Http/Controllers/Api/Application/Nodes/AllocationController.php index 77404945a4..07c2017234 100644 --- a/app/Http/Controllers/Api/Application/Nodes/AllocationController.php +++ b/app/Http/Controllers/Api/Application/Nodes/AllocationController.php @@ -23,7 +23,7 @@ class AllocationController extends ApplicationApiController */ public function __construct( private AssignmentService $assignmentService, - private AllocationDeletionService $deletionService + private AllocationDeletionService $deletionService, ) { parent::__construct(); } diff --git a/app/Http/Controllers/Api/Application/Nodes/NodeController.php b/app/Http/Controllers/Api/Application/Nodes/NodeController.php index e0e3575d81..5c40f77f66 100644 --- a/app/Http/Controllers/Api/Application/Nodes/NodeController.php +++ b/app/Http/Controllers/Api/Application/Nodes/NodeController.php @@ -24,7 +24,7 @@ class NodeController extends ApplicationApiController public function __construct( private NodeCreationService $creationService, private NodeDeletionService $deletionService, - private NodeUpdateService $updateService + private NodeUpdateService $updateService, ) { parent::__construct(); } diff --git a/app/Http/Controllers/Api/Application/Servers/DatabaseController.php b/app/Http/Controllers/Api/Application/Servers/DatabaseController.php index 1717c5dd88..43fc9a551c 100644 --- a/app/Http/Controllers/Api/Application/Servers/DatabaseController.php +++ b/app/Http/Controllers/Api/Application/Servers/DatabaseController.php @@ -22,7 +22,7 @@ class DatabaseController extends ApplicationApiController */ public function __construct( private DatabaseManagementService $databaseManagementService, - private DatabasePasswordService $databasePasswordService + private DatabasePasswordService $databasePasswordService, ) { parent::__construct(); } diff --git a/app/Http/Controllers/Api/Application/Servers/ServerController.php b/app/Http/Controllers/Api/Application/Servers/ServerController.php index 2eb69162dd..b1e80c4719 100644 --- a/app/Http/Controllers/Api/Application/Servers/ServerController.php +++ b/app/Http/Controllers/Api/Application/Servers/ServerController.php @@ -22,7 +22,7 @@ class ServerController extends ApplicationApiController */ public function __construct( private ServerCreationService $creationService, - private ServerDeletionService $deletionService + private ServerDeletionService $deletionService, ) { parent::__construct(); } diff --git a/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php b/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php index ae5f5438ca..20ea05422e 100644 --- a/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php +++ b/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php @@ -17,7 +17,7 @@ class ServerDetailsController extends ApplicationApiController */ public function __construct( private BuildModificationService $buildModificationService, - private DetailsModificationService $detailsModificationService + private DetailsModificationService $detailsModificationService, ) { parent::__construct(); } diff --git a/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php b/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php index d4dcaa24cb..51a1476fec 100644 --- a/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php +++ b/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php @@ -16,7 +16,7 @@ class ServerManagementController extends ApplicationApiController */ public function __construct( private ReinstallServerService $reinstallServerService, - private SuspensionService $suspensionService + private SuspensionService $suspensionService, ) { parent::__construct(); } diff --git a/app/Http/Controllers/Api/Application/Users/UserController.php b/app/Http/Controllers/Api/Application/Users/UserController.php index 0ddae27b1e..4e251573df 100644 --- a/app/Http/Controllers/Api/Application/Users/UserController.php +++ b/app/Http/Controllers/Api/Application/Users/UserController.php @@ -23,7 +23,7 @@ class UserController extends ApplicationApiController public function __construct( private UserCreationService $creationService, private UserDeletionService $deletionService, - private UserUpdateService $updateService + private UserUpdateService $updateService, ) { parent::__construct(); } diff --git a/app/Http/Controllers/Api/Client/ApiKeyController.php b/app/Http/Controllers/Api/Client/ApiKeyController.php index ac00a4d8f2..fc9aa649a5 100644 --- a/app/Http/Controllers/Api/Client/ApiKeyController.php +++ b/app/Http/Controllers/Api/Client/ApiKeyController.php @@ -25,7 +25,7 @@ public function index(ClientApiRequest $request): array /** * Store a new API key for a user's account. * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException */ public function store(StoreApiKeyRequest $request): array { @@ -54,7 +54,7 @@ public function store(StoreApiKeyRequest $request): array */ public function delete(ClientApiRequest $request, string $identifier): JsonResponse { - /** @var \Pterodactyl\Models\ApiKey $key */ + /** @var ApiKey $key */ $key = $request->user()->apiKeys() ->where('key_type', ApiKey::TYPE_ACCOUNT) ->where('identifier', $identifier) diff --git a/app/Http/Controllers/Api/Client/Servers/BackupController.php b/app/Http/Controllers/Api/Client/Servers/BackupController.php index 11907c5b36..d11187c7e3 100644 --- a/app/Http/Controllers/Api/Client/Servers/BackupController.php +++ b/app/Http/Controllers/Api/Client/Servers/BackupController.php @@ -30,7 +30,7 @@ public function __construct( private DeleteBackupService $deleteBackupService, private InitiateBackupService $initiateBackupService, private DownloadLinkService $downloadLinkService, - private BackupRepository $repository + private BackupRepository $repository, ) { parent::__construct(); } @@ -39,7 +39,7 @@ public function __construct( * Returns all the backups for a given server instance in a paginated * result set. * - * @throws \Illuminate\Auth\Access\AuthorizationException + * @throws AuthorizationException */ public function index(Request $request, Server $server): array { @@ -93,7 +93,7 @@ public function store(StoreBackupRequest $request, Server $server): array * Toggles the lock status of a given backup for a server. * * @throws \Throwable - * @throws \Illuminate\Auth\Access\AuthorizationException + * @throws AuthorizationException */ public function toggleLock(Request $request, Server $server, Backup $backup): array { @@ -115,7 +115,7 @@ public function toggleLock(Request $request, Server $server, Backup $backup): ar /** * Returns information about a single backup. * - * @throws \Illuminate\Auth\Access\AuthorizationException + * @throws AuthorizationException */ public function view(Request $request, Server $server, Backup $backup): array { @@ -156,7 +156,7 @@ public function delete(Request $request, Server $server, Backup $backup): JsonRe * which the user is redirected to. * * @throws \Throwable - * @throws \Illuminate\Auth\Access\AuthorizationException + * @throws AuthorizationException */ public function download(Request $request, Server $server, Backup $backup): JsonResponse { diff --git a/app/Http/Controllers/Api/Client/Servers/CommandController.php b/app/Http/Controllers/Api/Client/Servers/CommandController.php index 6cc50de473..55ac2131a8 100644 --- a/app/Http/Controllers/Api/Client/Servers/CommandController.php +++ b/app/Http/Controllers/Api/Client/Servers/CommandController.php @@ -26,7 +26,7 @@ public function __construct(private DaemonCommandRepository $repository) /** * Send a command to a running server. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function index(SendCommandRequest $request, Server $server): Response { diff --git a/app/Http/Controllers/Api/Client/Servers/DatabaseController.php b/app/Http/Controllers/Api/Client/Servers/DatabaseController.php index 728c67e913..c4bb888759 100644 --- a/app/Http/Controllers/Api/Client/Servers/DatabaseController.php +++ b/app/Http/Controllers/Api/Client/Servers/DatabaseController.php @@ -24,7 +24,7 @@ class DatabaseController extends ClientApiController public function __construct( private DeployServerDatabaseService $deployDatabaseService, private DatabaseManagementService $managementService, - private DatabasePasswordService $passwordService + private DatabasePasswordService $passwordService, ) { parent::__construct(); } diff --git a/app/Http/Controllers/Api/Client/Servers/FileController.php b/app/Http/Controllers/Api/Client/Servers/FileController.php index 23e6718a50..bce98f9190 100644 --- a/app/Http/Controllers/Api/Client/Servers/FileController.php +++ b/app/Http/Controllers/Api/Client/Servers/FileController.php @@ -30,7 +30,7 @@ class FileController extends ClientApiController */ public function __construct( private NodeJWTService $jwtService, - private DaemonFileRepository $fileRepository + private DaemonFileRepository $fileRepository, ) { parent::__construct(); } diff --git a/app/Http/Controllers/Api/Client/Servers/FileUploadController.php b/app/Http/Controllers/Api/Client/Servers/FileUploadController.php index 98fcd587dc..d2741e2f41 100644 --- a/app/Http/Controllers/Api/Client/Servers/FileUploadController.php +++ b/app/Http/Controllers/Api/Client/Servers/FileUploadController.php @@ -16,7 +16,7 @@ class FileUploadController extends ClientApiController * FileUploadController constructor. */ public function __construct( - private NodeJWTService $jwtService + private NodeJWTService $jwtService, ) { parent::__construct(); } diff --git a/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php b/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php index 4e3c5f9bbd..5cf774ae67 100644 --- a/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php +++ b/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php @@ -24,7 +24,7 @@ class NetworkAllocationController extends ClientApiController */ public function __construct( private FindAssignableAllocationService $assignableAllocationService, - private ServerRepository $serverRepository + private ServerRepository $serverRepository, ) { parent::__construct(); } @@ -88,7 +88,7 @@ public function setPrimary(SetPrimaryAllocationRequest $request, Server $server, * Set the notes for the allocation for a server. *s. * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException */ public function store(NewAllocationRequest $request, Server $server): array { @@ -111,7 +111,7 @@ public function store(NewAllocationRequest $request, Server $server): array /** * Delete an allocation from a server. * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException */ public function delete(DeleteAllocationRequest $request, Server $server, Allocation $allocation): JsonResponse { diff --git a/app/Http/Controllers/Api/Client/Servers/ScheduleController.php b/app/Http/Controllers/Api/Client/Servers/ScheduleController.php index b955fb16bf..832e426e2b 100644 --- a/app/Http/Controllers/Api/Client/Servers/ScheduleController.php +++ b/app/Http/Controllers/Api/Client/Servers/ScheduleController.php @@ -47,12 +47,12 @@ public function index(ViewScheduleRequest $request, Server $server): array /** * Store a new schedule for a server. * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ public function store(StoreScheduleRequest $request, Server $server): array { - /** @var \Pterodactyl\Models\Schedule $model */ + /** @var Schedule $model */ $model = $this->repository->create([ 'server_id' => $server->id, 'name' => $request->input('name'), @@ -95,7 +95,7 @@ public function view(ViewScheduleRequest $request, Server $server, Schedule $sch /** * Updates a given schedule with the new data provided. * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -165,7 +165,7 @@ public function delete(DeleteScheduleRequest $request, Server $server, Schedule /** * Get the next run timestamp based on the cron data provided. * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException */ protected function getNextRunAt(Request $request): Carbon { diff --git a/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php b/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php index e2e4389a1b..1091fb2cae 100644 --- a/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php +++ b/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php @@ -26,7 +26,7 @@ class ScheduleTaskController extends ClientApiController */ public function __construct( private ConnectionInterface $connection, - private TaskRepository $repository + private TaskRepository $repository, ) { parent::__construct(); } @@ -35,7 +35,7 @@ public function __construct( * Create a new task for a given schedule and store it in the database. * * @throws \Pterodactyl\Exceptions\Model\DataValidationException - * @throws \Pterodactyl\Exceptions\Service\ServiceLimitExceededException + * @throws ServiceLimitExceededException */ public function store(StoreTaskRequest $request, Server $server, Schedule $schedule): array { @@ -48,10 +48,10 @@ public function store(StoreTaskRequest $request, Server $server, Schedule $sched throw new HttpForbiddenException("A backup task cannot be created when the server's backup limit is set to 0."); } - /** @var \Pterodactyl\Models\Task|null $lastTask */ + /** @var Task|null $lastTask */ $lastTask = $schedule->tasks()->orderByDesc('sequence_id')->first(); - /** @var \Pterodactyl\Models\Task $task */ + /** @var Task $task */ $task = $this->connection->transaction(function () use ($request, $schedule, $lastTask) { $sequenceId = ($lastTask->sequence_id ?? 0) + 1; $requestSequenceId = $request->integer('sequence_id', $sequenceId); diff --git a/app/Http/Controllers/Api/Client/Servers/SettingsController.php b/app/Http/Controllers/Api/Client/Servers/SettingsController.php index b939f16806..b77678889f 100644 --- a/app/Http/Controllers/Api/Client/Servers/SettingsController.php +++ b/app/Http/Controllers/Api/Client/Servers/SettingsController.php @@ -21,7 +21,7 @@ class SettingsController extends ClientApiController */ public function __construct( private ServerRepository $repository, - private ReinstallServerService $reinstallServerService + private ReinstallServerService $reinstallServerService, ) { parent::__construct(); } diff --git a/app/Http/Controllers/Api/Client/Servers/StartupController.php b/app/Http/Controllers/Api/Client/Servers/StartupController.php index 9548be25e9..b987c04f94 100644 --- a/app/Http/Controllers/Api/Client/Servers/StartupController.php +++ b/app/Http/Controllers/Api/Client/Servers/StartupController.php @@ -19,7 +19,7 @@ class StartupController extends ClientApiController */ public function __construct( private StartupCommandService $startupCommandService, - private ServerVariableRepository $repository + private ServerVariableRepository $repository, ) { parent::__construct(); } diff --git a/app/Http/Controllers/Api/Client/Servers/SubuserController.php b/app/Http/Controllers/Api/Client/Servers/SubuserController.php index 2c403c691d..f868a4154f 100644 --- a/app/Http/Controllers/Api/Client/Servers/SubuserController.php +++ b/app/Http/Controllers/Api/Client/Servers/SubuserController.php @@ -27,7 +27,7 @@ class SubuserController extends ClientApiController public function __construct( private SubuserRepository $repository, private SubuserCreationService $creationService, - private DaemonServerRepository $serverRepository + private DaemonServerRepository $serverRepository, ) { parent::__construct(); } diff --git a/app/Http/Controllers/Api/Client/Servers/WebsocketController.php b/app/Http/Controllers/Api/Client/Servers/WebsocketController.php index 59b6f75d4d..9a3a1f509d 100644 --- a/app/Http/Controllers/Api/Client/Servers/WebsocketController.php +++ b/app/Http/Controllers/Api/Client/Servers/WebsocketController.php @@ -19,7 +19,7 @@ class WebsocketController extends ClientApiController */ public function __construct( private NodeJWTService $jwtService, - private GetUserPermissionsService $permissionsService + private GetUserPermissionsService $permissionsService, ) { parent::__construct(); } diff --git a/app/Http/Controllers/Api/Client/TwoFactorController.php b/app/Http/Controllers/Api/Client/TwoFactorController.php index 8cfa09b6eb..edc13d26f7 100644 --- a/app/Http/Controllers/Api/Client/TwoFactorController.php +++ b/app/Http/Controllers/Api/Client/TwoFactorController.php @@ -20,7 +20,7 @@ class TwoFactorController extends ClientApiController public function __construct( private ToggleTwoFactorService $toggleTwoFactorService, private TwoFactorSetupService $setupService, - private ValidationFactory $validation + private ValidationFactory $validation, ) { parent::__construct(); } diff --git a/app/Http/Controllers/Api/Remote/ActivityProcessingController.php b/app/Http/Controllers/Api/Remote/ActivityProcessingController.php index b9d12c248b..b88d7ae7a7 100644 --- a/app/Http/Controllers/Api/Remote/ActivityProcessingController.php +++ b/app/Http/Controllers/Api/Remote/ActivityProcessingController.php @@ -27,7 +27,7 @@ public function __invoke(ActivityEventRequest $request) $logs = []; foreach ($request->input('data') as $datum) { - /** @var \Pterodactyl\Models\Server|null $server */ + /** @var Server|null $server */ $server = $servers->get($datum['server']); if (is_null($server) || !Str::startsWith($datum['event'], 'server:')) { continue; diff --git a/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php b/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php index 15fe8d9bd1..aa01e6b3c4 100644 --- a/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php +++ b/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php @@ -42,7 +42,7 @@ public function __invoke(Request $request, string $backup): JsonResponse throw new BadRequestHttpException('A non-empty "size" query parameter must be provided.'); } - /** @var \Pterodactyl\Models\Backup $model */ + /** @var Backup $model */ $model = Backup::query() ->where('uuid', $backup) ->firstOrFail(); diff --git a/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php b/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php index a7535a9ecf..60eefd1e1f 100644 --- a/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php +++ b/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php @@ -35,7 +35,7 @@ public function index(ReportBackupCompleteRequest $request, string $backup): Jso /** @var \Pterodactyl\Models\Node $node */ $node = $request->attributes->get('node'); - /** @var \Pterodactyl\Models\Backup $model */ + /** @var Backup $model */ $model = Backup::query() ->where('uuid', $backup) ->firstOrFail(); @@ -92,7 +92,7 @@ public function index(ReportBackupCompleteRequest $request, string $backup): Jso */ public function restore(Request $request, string $backup): JsonResponse { - /** @var \Pterodactyl\Models\Backup $model */ + /** @var Backup $model */ $model = Backup::query()->where('uuid', $backup)->firstOrFail(); $model->server->update(['status' => null]); @@ -110,7 +110,7 @@ public function restore(Request $request, string $backup): JsonResponse * the given backup. * * @throws \Exception - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException */ protected function completeMultipartUpload(Backup $backup, S3Filesystem $adapter, bool $successful, ?array $parts): void { diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php b/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php index 8ce88e89ee..8f3bb321be 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php @@ -22,7 +22,7 @@ public function __construct( protected ConnectionInterface $connection, private ServerRepository $repository, private ServerConfigurationStructureService $configurationStructureService, - private EggConfigurationService $eggConfigurationService + private EggConfigurationService $eggConfigurationService, ) { } @@ -90,7 +90,7 @@ public function resetState(Request $request): JsonResponse ->get(); $this->connection->transaction(function () use ($node, $servers) { - /** @var \Pterodactyl\Models\Server $server */ + /** @var Server $server */ foreach ($servers as $server) { /** @var \Pterodactyl\Models\ActivityLog|null $activity */ $activity = $server->activity->first(); diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php b/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php index c14ddea97a..bfaf49821d 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php @@ -22,7 +22,7 @@ class ServerTransferController extends Controller public function __construct( private ConnectionInterface $connection, private ServerRepository $repository, - private DaemonServerRepository $daemonServerRepository + private DaemonServerRepository $daemonServerRepository, ) { } diff --git a/app/Http/Controllers/Auth/AbstractLoginController.php b/app/Http/Controllers/Auth/AbstractLoginController.php index f07282fbac..e1e3101b18 100644 --- a/app/Http/Controllers/Auth/AbstractLoginController.php +++ b/app/Http/Controllers/Auth/AbstractLoginController.php @@ -49,9 +49,9 @@ public function __construct() /** * Get the failed login response instance. * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException */ - protected function sendFailedLoginResponse(Request $request, Authenticatable $user = null, string $message = null) + protected function sendFailedLoginResponse(Request $request, ?Authenticatable $user = null, ?string $message = null) { $this->incrementLoginAttempts($request); $this->fireFailedLoginEvent($user, [ @@ -91,7 +91,7 @@ protected function sendLoginResponse(User $user, Request $request): JsonResponse /** * Determine if the user is logging in using an email or username. */ - protected function getField(string $input = null): string + protected function getField(?string $input = null): string { return ($input && str_contains($input, '@')) ? 'email' : 'username'; } @@ -99,7 +99,7 @@ protected function getField(string $input = null): string /** * Fire a failed login event. */ - protected function fireFailedLoginEvent(Authenticatable $user = null, array $credentials = []) + protected function fireFailedLoginEvent(?Authenticatable $user = null, array $credentials = []) { Event::dispatch(new Failed('auth', $user, $credentials)); } diff --git a/app/Http/Controllers/Auth/LoginCheckpointController.php b/app/Http/Controllers/Auth/LoginCheckpointController.php index af05c55ef7..ddcb7e7547 100644 --- a/app/Http/Controllers/Auth/LoginCheckpointController.php +++ b/app/Http/Controllers/Auth/LoginCheckpointController.php @@ -24,7 +24,7 @@ class LoginCheckpointController extends AbstractLoginController public function __construct( private Encrypter $encrypter, private Google2FA $google2FA, - private ValidationFactory $validation + private ValidationFactory $validation, ) { parent::__construct(); } @@ -56,7 +56,7 @@ public function __invoke(LoginCheckpointRequest $request): JsonResponse } try { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::query()->findOrFail($details['user_id']); } catch (ModelNotFoundException) { $this->sendFailedLoginResponse($request, null, self::TOKEN_EXPIRED_MESSAGE); diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 2dbb34ee36..0de1dfea00 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -48,7 +48,7 @@ public function login(Request $request): JsonResponse try { $username = $request->input('user'); - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::query()->where($this->getField($username), $username)->firstOrFail(); } catch (ModelNotFoundException) { $this->sendFailedLoginResponse($request); diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index 3325a1e6b3..292eb25cb2 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -31,14 +31,14 @@ class ResetPasswordController extends Controller public function __construct( private Dispatcher $dispatcher, private Hasher $hasher, - private UserRepositoryInterface $userRepository + private UserRepositoryInterface $userRepository, ) { } /** * Reset the given user's password. * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException */ public function __invoke(ResetPasswordRequest $request): JsonResponse { diff --git a/app/Http/Controllers/Base/IndexController.php b/app/Http/Controllers/Base/IndexController.php index fecaa91a3e..a7a8d45f95 100644 --- a/app/Http/Controllers/Base/IndexController.php +++ b/app/Http/Controllers/Base/IndexController.php @@ -14,7 +14,7 @@ class IndexController extends Controller */ public function __construct( protected ServerRepositoryInterface $repository, - protected ViewFactory $view + protected ViewFactory $view, ) { } diff --git a/app/Http/Middleware/Admin/Servers/ServerInstalled.php b/app/Http/Middleware/Admin/Servers/ServerInstalled.php index ae99b896ef..d3fa75951e 100644 --- a/app/Http/Middleware/Admin/Servers/ServerInstalled.php +++ b/app/Http/Middleware/Admin/Servers/ServerInstalled.php @@ -15,7 +15,7 @@ class ServerInstalled */ public function handle(Request $request, \Closure $next): mixed { - /** @var \Pterodactyl\Models\Server|null $server */ + /** @var Server|null $server */ $server = $request->route()->parameter('server'); if (!$server instanceof Server) { diff --git a/app/Http/Middleware/AdminAuthenticate.php b/app/Http/Middleware/AdminAuthenticate.php index 4c7f48befb..2e61f64296 100644 --- a/app/Http/Middleware/AdminAuthenticate.php +++ b/app/Http/Middleware/AdminAuthenticate.php @@ -10,7 +10,7 @@ class AdminAuthenticate /** * Handle an incoming request. * - * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException + * @throws AccessDeniedHttpException */ public function handle(Request $request, \Closure $next): mixed { diff --git a/app/Http/Middleware/Api/AuthenticateIPAccess.php b/app/Http/Middleware/Api/AuthenticateIPAccess.php index b8a9937ab8..e2332de3ad 100644 --- a/app/Http/Middleware/Api/AuthenticateIPAccess.php +++ b/app/Http/Middleware/Api/AuthenticateIPAccess.php @@ -15,11 +15,11 @@ class AuthenticateIPAccess * Determine if a request IP has permission to access the API. * * @throws \Exception - * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException + * @throws AccessDeniedHttpException */ public function handle(Request $request, \Closure $next): mixed { - /** @var \Laravel\Sanctum\TransientToken|\Pterodactyl\Models\ApiKey $token */ + /** @var TransientToken|\Pterodactyl\Models\ApiKey $token */ $token = $request->user()->currentAccessToken(); // If this is a stateful request just push the request through to the next diff --git a/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php b/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php index 1157ddcedf..9197b415e7 100644 --- a/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php +++ b/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php @@ -31,7 +31,7 @@ public function handle(Request $request, \Closure $next): mixed throw new \InvalidArgumentException('This middleware cannot be used in a context that is missing a server in the parameters.'); } - /** @var \Pterodactyl\Models\Server $server */ + /** @var Server $server */ $server = $request->route()->parameter('server'); $exception = new NotFoundHttpException('The requested resource was not found for this server.'); foreach ($params as $key => $model) { diff --git a/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php b/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php index 6e5ae2a434..d782ed8cf3 100644 --- a/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php +++ b/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php @@ -29,7 +29,7 @@ public function __construct(private Encrypter $encrypter, private NodeRepository /** * Check if a request from the daemon can be properly attributed back to a single node instance. * - * @throws \Symfony\Component\HttpKernel\Exception\HttpException + * @throws HttpException */ public function handle(Request $request, \Closure $next): mixed { diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index ad3eecdc7b..2889506c96 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -17,7 +17,7 @@ public function __construct(private AuthManager $authManager) /** * Handle an incoming request. */ - public function handle(Request $request, \Closure $next, string $guard = null): mixed + public function handle(Request $request, \Closure $next, ?string $guard = null): mixed { if ($this->authManager->guard($guard)->check()) { return redirect()->route('index'); diff --git a/app/Http/Middleware/RequireTwoFactorAuthentication.php b/app/Http/Middleware/RequireTwoFactorAuthentication.php index 090e146c4e..a97e3796e8 100644 --- a/app/Http/Middleware/RequireTwoFactorAuthentication.php +++ b/app/Http/Middleware/RequireTwoFactorAuthentication.php @@ -31,7 +31,7 @@ public function __construct(private AlertsMessageBag $alert) * order to perform actions. If so, we check the level at which it is required (all users * or just admins) and then check if the user has enabled it for their account. * - * @throws \Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException + * @throws TwoFactorAuthRequiredException */ public function handle(Request $request, \Closure $next): mixed { diff --git a/app/Http/Requests/Admin/AdminFormRequest.php b/app/Http/Requests/Admin/AdminFormRequest.php index 8597e1d939..59ba0db64d 100644 --- a/app/Http/Requests/Admin/AdminFormRequest.php +++ b/app/Http/Requests/Admin/AdminFormRequest.php @@ -28,7 +28,7 @@ public function authorize(): bool * Return only the fields that we are interested in from the request. * This will include empty fields as a null value. */ - public function normalize(array $only = null): array + public function normalize(?array $only = null): array { return $this->only($only ?? array_keys($this->rules())); } diff --git a/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php b/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php index 3f014e9821..9836980703 100644 --- a/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php +++ b/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php @@ -27,7 +27,7 @@ public function rules(): array * Override the default normalization function for this type of request * as we need to accept empty values on the keys. */ - public function normalize(array $only = null): array + public function normalize(?array $only = null): array { $keys = array_flip(array_keys($this->rules())); diff --git a/app/Http/Requests/Api/Application/ApplicationApiRequest.php b/app/Http/Requests/Api/Application/ApplicationApiRequest.php index 2e0ed133a5..e6d36a8a3c 100644 --- a/app/Http/Requests/Api/Application/ApplicationApiRequest.php +++ b/app/Http/Requests/Api/Application/ApplicationApiRequest.php @@ -29,7 +29,7 @@ abstract class ApplicationApiRequest extends FormRequest * Determine if the current user is authorized to perform * the requested action against the API. * - * @throws \Pterodactyl\Exceptions\PterodactylException + * @throws PterodactylException */ public function authorize(): bool { diff --git a/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php index 4fe7054485..e80fdd4a76 100644 --- a/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php @@ -15,7 +15,7 @@ class StoreNodeRequest extends ApplicationApiRequest /** * Validation rules to apply to this request. */ - public function rules(array $rules = null): array + public function rules(?array $rules = null): array { return collect($rules ?? Node::getRules())->only([ 'public', diff --git a/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php index 7133bd0b52..45aaea630a 100644 --- a/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php @@ -10,7 +10,7 @@ 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. */ - public function rules(array $rules = null): array + public function rules(?array $rules = null): array { $node = $this->route()->parameter('node')->id; diff --git a/app/Http/Requests/Api/Application/Users/StoreUserRequest.php b/app/Http/Requests/Api/Application/Users/StoreUserRequest.php index 569dba3406..9d4a98561c 100644 --- a/app/Http/Requests/Api/Application/Users/StoreUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/StoreUserRequest.php @@ -15,7 +15,7 @@ class StoreUserRequest extends ApplicationApiRequest /** * Return the validation rules for this request. */ - public function rules(array $rules = null): array + public function rules(?array $rules = null): array { $rules = $rules ?? User::getRules(); diff --git a/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php b/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php index fa2e1291c7..b31a3c52c2 100644 --- a/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php @@ -9,7 +9,7 @@ class UpdateUserRequest extends StoreUserRequest /** * Return the validation rules for this request. */ - public function rules(array $rules = null): array + public function rules(?array $rules = null): array { $userId = $this->parameter('user', User::class)->id; diff --git a/app/Http/Requests/Api/Client/Account/UpdateEmailRequest.php b/app/Http/Requests/Api/Client/Account/UpdateEmailRequest.php index 6287ba5855..abafc2dc6a 100644 --- a/app/Http/Requests/Api/Client/Account/UpdateEmailRequest.php +++ b/app/Http/Requests/Api/Client/Account/UpdateEmailRequest.php @@ -11,7 +11,7 @@ class UpdateEmailRequest extends ClientApiRequest { /** - * @throws \Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException + * @throws InvalidPasswordProvidedException */ public function authorize(): bool { diff --git a/app/Http/Requests/Api/Client/Account/UpdatePasswordRequest.php b/app/Http/Requests/Api/Client/Account/UpdatePasswordRequest.php index de8215b07e..8f003d0282 100644 --- a/app/Http/Requests/Api/Client/Account/UpdatePasswordRequest.php +++ b/app/Http/Requests/Api/Client/Account/UpdatePasswordRequest.php @@ -10,7 +10,7 @@ class UpdatePasswordRequest extends ClientApiRequest { /** - * @throws \Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException + * @throws InvalidPasswordProvidedException */ public function authorize(): bool { diff --git a/app/Http/Requests/Api/Client/Servers/Settings/SetDockerImageRequest.php b/app/Http/Requests/Api/Client/Servers/Settings/SetDockerImageRequest.php index 62edfb59c3..b36f337565 100644 --- a/app/Http/Requests/Api/Client/Servers/Settings/SetDockerImageRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Settings/SetDockerImageRequest.php @@ -18,7 +18,7 @@ public function permission(): string public function rules(): array { - /** @var \Pterodactyl\Models\Server $server */ + /** @var Server $server */ $server = $this->route()->parameter('server'); Assert::isInstanceOf($server, Server::class); diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php index 7c4fab9d22..7aec2263e1 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php @@ -63,8 +63,8 @@ protected function validatePermissionsCanBeAssigned(array $permissions) // Otherwise, get the current subuser's permission set, and ensure that the // permissions they are trying to assign are not _more_ than the ones they // already have. - /** @var \Pterodactyl\Models\Subuser|null $subuser */ - /** @var \Pterodactyl\Services\Servers\GetUserPermissionsService $service */ + /** @var Subuser|null $subuser */ + /** @var GetUserPermissionsService $service */ $service = $this->container->make(GetUserPermissionsService::class); if (count(array_diff($permissions, $service->handle($server, $user))) > 0) { diff --git a/app/Jobs/Schedule/RunTaskJob.php b/app/Jobs/Schedule/RunTaskJob.php index be52a4dba2..6aded8621a 100644 --- a/app/Jobs/Schedule/RunTaskJob.php +++ b/app/Jobs/Schedule/RunTaskJob.php @@ -37,7 +37,7 @@ public function __construct(public Task $task, public bool $manualRun = false) public function handle( DaemonCommandRepository $commandRepository, InitiateBackupService $backupService, - DaemonPowerRepository $powerRepository + DaemonPowerRepository $powerRepository, ) { // Do not process a task that is not set to active, unless it's been manually triggered. if (!$this->task->schedule->is_active && !$this->manualRun) { @@ -88,7 +88,7 @@ public function handle( /** * Handle a failure while sending the action to the daemon or otherwise processing the job. */ - public function failed(\Exception $exception = null) + public function failed(?\Exception $exception = null) { $this->markTaskNotQueued(); $this->markScheduleComplete(); @@ -99,7 +99,7 @@ public function failed(\Exception $exception = null) */ private function queueNextTask() { - /** @var \Pterodactyl\Models\Task|null $nextTask */ + /** @var Task|null $nextTask */ $nextTask = Task::query()->where('schedule_id', $this->task->schedule_id) ->orderBy('sequence_id', 'asc') ->where('sequence_id', '>', $this->task->sequence_id) diff --git a/app/Models/ActivityLog.php b/app/Models/ActivityLog.php index e8f8a4e302..5c9ce6efd7 100644 --- a/app/Models/ActivityLog.php +++ b/app/Models/ActivityLog.php @@ -24,11 +24,11 @@ * @property int|null $actor_id * @property int|null $api_key_id * @property \Illuminate\Support\Collection|null $properties - * @property \Carbon\Carbon $timestamp + * @property Carbon $timestamp * @property IlluminateModel|\Eloquent $actor * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\ActivityLogSubject[] $subjects * @property int|null $subjects_count - * @property \Pterodactyl\Models\ApiKey|null $apiKey + * @property ApiKey|null $apiKey * * @method static Builder|ActivityLog forActor(\Illuminate\Database\Eloquent\Model $actor) * @method static Builder|ActivityLog forEvent(string $action) diff --git a/app/Models/ActivityLogSubject.php b/app/Models/ActivityLogSubject.php index 6629b3e7d6..aabeb0ad22 100644 --- a/app/Models/ActivityLogSubject.php +++ b/app/Models/ActivityLogSubject.php @@ -11,7 +11,7 @@ * @property int $activity_log_id * @property int $subject_id * @property string $subject_type - * @property \Pterodactyl\Models\ActivityLog|null $activityLog + * @property ActivityLog|null $activityLog * @property \Illuminate\Database\Eloquent\Model|\Eloquent $subject * * @method static \Illuminate\Database\Eloquent\Builder|ActivityLogSubject newModelQuery() diff --git a/app/Models/Allocation.php b/app/Models/Allocation.php index 770b71d15e..cf07750084 100644 --- a/app/Models/Allocation.php +++ b/app/Models/Allocation.php @@ -19,8 +19,8 @@ * @property \Carbon\Carbon|null $updated_at * @property string $alias * @property bool $has_alias - * @property \Pterodactyl\Models\Server|null $server - * @property \Pterodactyl\Models\Node $node + * @property Server|null $server + * @property Node $node * @property string $hashid * * @method static \Database\Factories\AllocationFactory factory(...$parameters) @@ -78,9 +78,6 @@ class Allocation extends Model 'notes' => 'nullable|string|max:256', ]; - /** - * {@inheritDoc} - */ public function getRouteKeyName(): string { return $this->getKeyName(); diff --git a/app/Models/ApiKey.php b/app/Models/ApiKey.php index 8b2d655a16..4a6f1b65b2 100644 --- a/app/Models/ApiKey.php +++ b/app/Models/ApiKey.php @@ -31,8 +31,8 @@ * @property int $r_eggs * @property int $r_database_hosts * @property int $r_server_databases - * @property \Pterodactyl\Models\User $tokenable - * @property \Pterodactyl\Models\User $user + * @property User $tokenable + * @property User $user * * @method static \Database\Factories\ApiKeyFactory factory(...$parameters) * @method static \Illuminate\Database\Eloquent\Builder|ApiKey newModelQuery() diff --git a/app/Models/AuditLog.php b/app/Models/AuditLog.php index f42acbfffb..ed5c884be7 100644 --- a/app/Models/AuditLog.php +++ b/app/Models/AuditLog.php @@ -58,7 +58,7 @@ public function server(): BelongsTo */ public static function instance(string $action, array $metadata, bool $isSystem = false): self { - /** @var \Illuminate\Http\Request $request */ + /** @var Request $request */ $request = Container::getInstance()->make('request'); if ($isSystem || !$request instanceof Request) { $request = null; diff --git a/app/Models/Backup.php b/app/Models/Backup.php index fb5312d0ae..9b546ba281 100644 --- a/app/Models/Backup.php +++ b/app/Models/Backup.php @@ -22,7 +22,7 @@ * @property \Carbon\CarbonImmutable $created_at * @property \Carbon\CarbonImmutable $updated_at * @property \Carbon\CarbonImmutable|null $deleted_at - * @property \Pterodactyl\Models\Server $server + * @property Server $server * @property \Pterodactyl\Models\AuditLog[] $audits */ class Backup extends Model diff --git a/app/Models/Database.php b/app/Models/Database.php index a6582f31fb..c6a06c3652 100644 --- a/app/Models/Database.php +++ b/app/Models/Database.php @@ -18,8 +18,8 @@ * @property int $max_connections * @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $updated_at - * @property \Pterodactyl\Models\Server $server - * @property \Pterodactyl\Models\DatabaseHost $host + * @property Server $server + * @property DatabaseHost $host */ class Database extends Model { @@ -68,9 +68,6 @@ class Database extends Model 'password' => 'string', ]; - /** - * {@inheritDoc} - */ public function getRouteKeyName(): string { return $this->getKeyName(); @@ -80,7 +77,6 @@ public function getRouteKeyName(): string * Resolves the database using the ID by checking if the value provided is a HashID * string value, or just the ID to the database itself. * - * @param mixed $value * @param string|null $field * * @throws \Illuminate\Contracts\Container\BindingResolutionException diff --git a/app/Models/Egg.php b/app/Models/Egg.php index 60389e85d0..08a281ce17 100644 --- a/app/Models/Egg.php +++ b/app/Models/Egg.php @@ -41,11 +41,11 @@ * @property string|null $inherit_config_stop * @property string $inherit_file_denylist * @property array|null $inherit_features - * @property \Pterodactyl\Models\Nest $nest + * @property Nest $nest * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Server[] $servers * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\EggVariable[] $variables - * @property \Pterodactyl\Models\Egg|null $scriptFrom - * @property \Pterodactyl\Models\Egg|null $configFrom + * @property Egg|null $scriptFrom + * @property Egg|null $configFrom */ class Egg extends Model { diff --git a/app/Models/EggMount.php b/app/Models/EggMount.php index ed494a13ed..2016f54236 100644 --- a/app/Models/EggMount.php +++ b/app/Models/EggMount.php @@ -6,7 +6,7 @@ class EggMount extends Model { protected $table = 'egg_mount'; - protected $primaryKey = null; + protected $primaryKey; public $incrementing = false; } diff --git a/app/Models/EggVariable.php b/app/Models/EggVariable.php index faf6a18477..887adc795c 100644 --- a/app/Models/EggVariable.php +++ b/app/Models/EggVariable.php @@ -19,8 +19,8 @@ * @property \Carbon\CarbonImmutable $created_at * @property \Carbon\CarbonImmutable $updated_at * @property bool $required - * @property \Pterodactyl\Models\Egg $egg - * @property \Pterodactyl\Models\ServerVariable $serverVariable + * @property Egg $egg + * @property ServerVariable $serverVariable * * The "server_value" variable is only present on the object if you've loaded this model * using the server relationship. diff --git a/app/Models/Location.php b/app/Models/Location.php index d01d0c959c..656d6ce01e 100644 --- a/app/Models/Location.php +++ b/app/Models/Location.php @@ -44,9 +44,6 @@ class Location extends Model 'long' => 'string|nullable|between:1,191', ]; - /** - * {@inheritDoc} - */ public function getRouteKeyName(): string { return $this->getKeyName(); diff --git a/app/Models/Model.php b/app/Models/Model.php index 9da41505f0..2a1c93c678 100644 --- a/app/Models/Model.php +++ b/app/Models/Model.php @@ -144,7 +144,7 @@ public static function getRulesForUpdate($model, string $column = 'id'): array /** * Determines if the model is in a valid state or not. * - * @throws \Illuminate\Validation\ValidationException + * @throws ValidationException */ public function validate(): void { @@ -170,8 +170,6 @@ public function validate(): void /** * Return a timestamp as DateTime object. - * - * @param mixed $value */ protected function asDateTime($value): Carbon|CarbonImmutable { diff --git a/app/Models/MountNode.php b/app/Models/MountNode.php index 3a189c46b5..dae6b3179e 100644 --- a/app/Models/MountNode.php +++ b/app/Models/MountNode.php @@ -8,7 +8,7 @@ class MountNode extends Model { protected $table = 'mount_node'; - protected $primaryKey = null; + protected $primaryKey; public $incrementing = false; } diff --git a/app/Models/MountServer.php b/app/Models/MountServer.php index b9c0219e33..61d9bcb658 100644 --- a/app/Models/MountServer.php +++ b/app/Models/MountServer.php @@ -10,7 +10,7 @@ class MountServer extends Model public $timestamps = false; - protected $primaryKey = null; + protected $primaryKey; public $incrementing = false; } diff --git a/app/Models/Node.php b/app/Models/Node.php index c574cd90d2..fdb1a43e95 100644 --- a/app/Models/Node.php +++ b/app/Models/Node.php @@ -35,7 +35,7 @@ * @property string $daemonBase * @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $updated_at - * @property \Pterodactyl\Models\Location $location + * @property Location $location * @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts * @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers * @property \Pterodactyl\Models\Allocation[]|\Illuminate\Database\Eloquent\Collection $allocations diff --git a/app/Models/RecoveryToken.php b/app/Models/RecoveryToken.php index d4ca764a08..cb64a6886d 100644 --- a/app/Models/RecoveryToken.php +++ b/app/Models/RecoveryToken.php @@ -9,7 +9,7 @@ * @property int $user_id * @property string $token * @property \Carbon\CarbonImmutable $created_at - * @property \Pterodactyl\Models\User $user + * @property User $user */ class RecoveryToken extends Model { diff --git a/app/Models/Schedule.php b/app/Models/Schedule.php index bd5693f83e..2d85314f0c 100644 --- a/app/Models/Schedule.php +++ b/app/Models/Schedule.php @@ -27,7 +27,7 @@ * @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $updated_at * @property string $hashid - * @property \Pterodactyl\Models\Server $server + * @property Server $server * @property \Pterodactyl\Models\Task[]|\Illuminate\Support\Collection $tasks */ class Schedule extends Model @@ -106,9 +106,6 @@ class Schedule extends Model 'next_run_at' => 'nullable|date', ]; - /** - * {@inheritDoc} - */ public function getRouteKeyName(): string { return $this->getKeyName(); diff --git a/app/Models/Server.php b/app/Models/Server.php index ab0f2f49e2..8c89b85d87 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -46,26 +46,26 @@ * @property \Illuminate\Support\Carbon|null $installed_at * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\ActivityLog[] $activity * @property int|null $activity_count - * @property \Pterodactyl\Models\Allocation|null $allocation + * @property Allocation|null $allocation * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Allocation[] $allocations * @property int|null $allocations_count * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Backup[] $backups * @property int|null $backups_count * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Database[] $databases * @property int|null $databases_count - * @property \Pterodactyl\Models\Egg|null $egg + * @property Egg|null $egg * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Mount[] $mounts * @property int|null $mounts_count - * @property \Pterodactyl\Models\Nest $nest - * @property \Pterodactyl\Models\Node $node + * @property Nest $nest + * @property Node $node * @property \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications * @property int|null $notifications_count * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Schedule[] $schedules * @property int|null $schedules_count * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Subuser[] $subusers * @property int|null $subusers_count - * @property \Pterodactyl\Models\ServerTransfer|null $transfer - * @property \Pterodactyl\Models\User $user + * @property ServerTransfer|null $transfer + * @property User $user * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\EggVariable[] $variables * @property int|null $variables_count * @@ -351,16 +351,16 @@ public function activity(): MorphToMany * exception is raised. This should be called whenever something needs to make * sure the server is not in a weird state that should block user access. * - * @throws \Pterodactyl\Exceptions\Http\Server\ServerStateConflictException + * @throws ServerStateConflictException */ public function validateCurrentState() { if ( - $this->isSuspended() || - $this->node->isUnderMaintenance() || - !$this->isInstalled() || - $this->status === self::STATUS_RESTORING_BACKUP || - !is_null($this->transfer) + $this->isSuspended() + || $this->node->isUnderMaintenance() + || !$this->isInstalled() + || $this->status === self::STATUS_RESTORING_BACKUP + || !is_null($this->transfer) ) { throw new ServerStateConflictException($this); } @@ -375,9 +375,9 @@ public function validateCurrentState() public function validateTransferState() { if ( - !$this->isInstalled() || - $this->status === self::STATUS_RESTORING_BACKUP || - !is_null($this->transfer) + !$this->isInstalled() + || $this->status === self::STATUS_RESTORING_BACKUP + || !is_null($this->transfer) ) { throw new ServerStateConflictException($this); } diff --git a/app/Models/ServerTransfer.php b/app/Models/ServerTransfer.php index da46188282..861252c661 100644 --- a/app/Models/ServerTransfer.php +++ b/app/Models/ServerTransfer.php @@ -18,9 +18,9 @@ * @property bool $archived * @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $updated_at - * @property \Pterodactyl\Models\Server $server - * @property \Pterodactyl\Models\Node $oldNode - * @property \Pterodactyl\Models\Node $newNode + * @property Server $server + * @property Node $oldNode + * @property Node $newNode */ class ServerTransfer extends Model { diff --git a/app/Models/ServerVariable.php b/app/Models/ServerVariable.php index 46ae57dd4b..7acca466ae 100644 --- a/app/Models/ServerVariable.php +++ b/app/Models/ServerVariable.php @@ -11,8 +11,8 @@ * @property string $variable_value * @property \Carbon\CarbonImmutable|null $created_at * @property \Carbon\CarbonImmutable|null $updated_at - * @property \Pterodactyl\Models\EggVariable $variable - * @property \Pterodactyl\Models\Server $server + * @property EggVariable $variable + * @property Server $server */ class ServerVariable extends Model { diff --git a/app/Models/Subuser.php b/app/Models/Subuser.php index 51d401394a..e8c74a49d6 100644 --- a/app/Models/Subuser.php +++ b/app/Models/Subuser.php @@ -14,8 +14,8 @@ * @property array $permissions * @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $updated_at - * @property \Pterodactyl\Models\User $user - * @property \Pterodactyl\Models\Server $server + * @property User $user + * @property Server $server */ class Subuser extends Model { diff --git a/app/Models/Task.php b/app/Models/Task.php index a43cb13fd2..15d699473e 100644 --- a/app/Models/Task.php +++ b/app/Models/Task.php @@ -20,8 +20,8 @@ * @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $updated_at * @property string $hashid - * @property \Pterodactyl\Models\Schedule $schedule - * @property \Pterodactyl\Models\Server $server + * @property Schedule $schedule + * @property Server $server */ class Task extends Model { @@ -96,9 +96,6 @@ class Task extends Model 'continue_on_failure' => 'boolean', ]; - /** - * {@inheritDoc} - */ public function getRouteKeyName(): string { return $this->getKeyName(); diff --git a/app/Models/Traits/HasAccessTokens.php b/app/Models/Traits/HasAccessTokens.php index ed042ccfa0..ff50c3f77f 100644 --- a/app/Models/Traits/HasAccessTokens.php +++ b/app/Models/Traits/HasAccessTokens.php @@ -26,7 +26,7 @@ public function tokens(): HasMany public function createToken(?string $memo, ?array $ips): NewAccessToken { - /** @var \Pterodactyl\Models\ApiKey $token */ + /** @var ApiKey $token */ $token = $this->tokens()->forceCreate([ 'user_id' => $this->id, 'key_type' => ApiKey::TYPE_ACCOUNT, diff --git a/app/Models/UserSSHKey.php b/app/Models/UserSSHKey.php index ab8075b3b6..97b4725b84 100644 --- a/app/Models/UserSSHKey.php +++ b/app/Models/UserSSHKey.php @@ -17,7 +17,7 @@ * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at * @property \Illuminate\Support\Carbon|null $deleted_at - * @property \Pterodactyl\Models\User $user + * @property User $user * * @method static \Illuminate\Database\Eloquent\Builder|UserSSHKey newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|UserSSHKey newQuery() diff --git a/app/Repositories/Eloquent/EggRepository.php b/app/Repositories/Eloquent/EggRepository.php index 8c4a01a270..0e09ab20fa 100644 --- a/app/Repositories/Eloquent/EggRepository.php +++ b/app/Repositories/Eloquent/EggRepository.php @@ -22,7 +22,7 @@ public function model(): string /** * Return an egg with the variables relation attached. * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws RecordNotFoundException */ public function getWithVariables(int $id): Egg { @@ -46,7 +46,7 @@ public function getAllWithCopyAttributes(): Collection * * @param int|string $value * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws RecordNotFoundException */ public function getWithCopyAttributes($value, string $column = 'id'): Egg { @@ -62,7 +62,7 @@ public function getWithCopyAttributes($value, string $column = 'id'): Egg /** * Return all the data needed to export a service. * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws RecordNotFoundException */ public function getWithExportAttributes(int $id): Egg { diff --git a/app/Repositories/Eloquent/EloquentRepository.php b/app/Repositories/Eloquent/EloquentRepository.php index a4e7f2fd78..443accfd36 100644 --- a/app/Repositories/Eloquent/EloquentRepository.php +++ b/app/Repositories/Eloquent/EloquentRepository.php @@ -71,7 +71,7 @@ public function getBuilder(): Builder /** * Create a new record in the database and return the associated model. * - * @throws \Pterodactyl\Exceptions\Model\DataValidationException + * @throws DataValidationException */ public function create(array $fields, bool $validate = true, bool $force = false): Model|bool { @@ -92,7 +92,7 @@ public function create(array $fields, bool $validate = true, bool $force = false /** * Find a model that has the specific ID passed. * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws RecordNotFoundException */ public function find(int $id): Model { @@ -114,7 +114,7 @@ public function findWhere(array $fields): Collection /** * Find and return the first matching instance for the given fields. * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws RecordNotFoundException */ public function findFirstWhere(array $fields): Model { @@ -154,8 +154,8 @@ public function deleteWhere(array $attributes, bool $force = false): int /** * Update a given ID with the passed array of fields. * - * @throws \Pterodactyl\Exceptions\Model\DataValidationException - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws DataValidationException + * @throws RecordNotFoundException */ public function update(int $id, array $fields, bool $validate = true, bool $force = false): Model|bool { @@ -200,8 +200,8 @@ public function updateWhereIn(string $column, array $values, array $fields): int /** * Update a record if it exists in the database, otherwise create it. * - * @throws \Pterodactyl\Exceptions\Model\DataValidationException - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws DataValidationException + * @throws RecordNotFoundException */ public function updateOrCreate(array $where, array $fields, bool $validate = true, bool $force = false): Model|bool { diff --git a/app/Repositories/Eloquent/LocationRepository.php b/app/Repositories/Eloquent/LocationRepository.php index e25737cb36..066f6d2fa2 100644 --- a/app/Repositories/Eloquent/LocationRepository.php +++ b/app/Repositories/Eloquent/LocationRepository.php @@ -37,7 +37,7 @@ public function getAllWithNodes(): Collection /** * Return all the nodes and their respective count of servers for a location. * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws RecordNotFoundException */ public function getWithNodes(int $id): Location { @@ -51,7 +51,7 @@ public function getWithNodes(int $id): Location /** * Return a location and the count of nodes in that location. * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws RecordNotFoundException */ public function getWithNodeCount(int $id): Location { diff --git a/app/Repositories/Eloquent/MountRepository.php b/app/Repositories/Eloquent/MountRepository.php index b33e6cb249..f0983aa0bf 100644 --- a/app/Repositories/Eloquent/MountRepository.php +++ b/app/Repositories/Eloquent/MountRepository.php @@ -29,7 +29,7 @@ public function getAllWithDetails(): Collection /** * Return all the mounts and their respective relations. * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws RecordNotFoundException */ public function getWithRelations(string $id): Mount { diff --git a/app/Repositories/Eloquent/NestRepository.php b/app/Repositories/Eloquent/NestRepository.php index f472e4b808..9d8ab3b746 100644 --- a/app/Repositories/Eloquent/NestRepository.php +++ b/app/Repositories/Eloquent/NestRepository.php @@ -20,9 +20,9 @@ public function model(): string /** * Return a nest or all nests with their associated eggs and variables. * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws RecordNotFoundException */ - public function getWithEggs(int $id = null): Collection|Nest + public function getWithEggs(?int $id = null): Collection|Nest { $instance = $this->getBuilder()->with('eggs', 'eggs.variables'); @@ -41,9 +41,9 @@ public function getWithEggs(int $id = null): Collection|Nest /** * Return a nest or all nests and the count of eggs and servers for that nest. * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws RecordNotFoundException */ - public function getWithCounts(int $id = null): Collection|Nest + public function getWithCounts(?int $id = null): Collection|Nest { $instance = $this->getBuilder()->withCount(['eggs', 'servers']); @@ -62,7 +62,7 @@ public function getWithCounts(int $id = null): Collection|Nest /** * Return a nest along with its associated eggs and the servers relation on those eggs. * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws RecordNotFoundException */ public function getWithEggServers(int $id): Nest { diff --git a/app/Repositories/Eloquent/ScheduleRepository.php b/app/Repositories/Eloquent/ScheduleRepository.php index 145333f45f..cff1c1144f 100644 --- a/app/Repositories/Eloquent/ScheduleRepository.php +++ b/app/Repositories/Eloquent/ScheduleRepository.php @@ -29,7 +29,7 @@ public function findServerSchedules(int $server): Collection /** * Return a schedule model with all the associated tasks as a relationship. * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws RecordNotFoundException */ public function getScheduleWithTasks(int $schedule): Schedule { diff --git a/app/Repositories/Eloquent/ServerRepository.php b/app/Repositories/Eloquent/ServerRepository.php index a353dba466..56097f9763 100644 --- a/app/Repositories/Eloquent/ServerRepository.php +++ b/app/Repositories/Eloquent/ServerRepository.php @@ -35,7 +35,7 @@ public function loadEggRelations(Server $server, bool $refresh = false): Server /** * Return a collection of servers with their associated data for rebuild operations. */ - public function getDataForRebuild(int $server = null, int $node = null): Collection + public function getDataForRebuild(?int $server = null, ?int $node = null): Collection { $instance = $this->getBuilder()->with(['allocation', 'allocations', 'egg', 'node']); @@ -51,7 +51,7 @@ public function getDataForRebuild(int $server = null, int $node = null): Collect /** * Return a collection of servers with their associated data for reinstall operations. */ - public function getDataForReinstall(int $server = null, int $node = null): Collection + public function getDataForReinstall(?int $server = null, ?int $node = null): Collection { $instance = $this->getBuilder()->with(['allocation', 'allocations', 'egg', 'node']); @@ -67,7 +67,7 @@ public function getDataForReinstall(int $server = null, int $node = null): Colle /** * Return a server model and all variables associated with the server. * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws RecordNotFoundException */ public function findWithVariables(int $id): Server { @@ -139,12 +139,12 @@ public function getDaemonServiceData(Server $server, bool $refresh = false): arr /** * Return a server by UUID. * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws RecordNotFoundException */ public function getByUuid(string $uuid): Server { try { - /** @var \Pterodactyl\Models\Server $model */ + /** @var Server $model */ $model = $this->getBuilder() ->with('nest', 'node') ->where(function (Builder $query) use ($uuid) { diff --git a/app/Repositories/Eloquent/SettingsRepository.php b/app/Repositories/Eloquent/SettingsRepository.php index df22fce595..4deea80a70 100644 --- a/app/Repositories/Eloquent/SettingsRepository.php +++ b/app/Repositories/Eloquent/SettingsRepository.php @@ -24,7 +24,7 @@ public function model(): string * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ - public function set(string $key, string $value = null) + public function set(string $key, ?string $value = null) { // Clear item from the cache. $this->clearCache($key); diff --git a/app/Repositories/Eloquent/SubuserRepository.php b/app/Repositories/Eloquent/SubuserRepository.php index 141378753d..01bc0c0cb9 100644 --- a/app/Repositories/Eloquent/SubuserRepository.php +++ b/app/Repositories/Eloquent/SubuserRepository.php @@ -51,7 +51,7 @@ public function getWithPermissions(Subuser $subuser, bool $refresh = false): Sub /** * Return a subuser and associated permissions given a user_id and server_id. * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws RecordNotFoundException */ public function getWithPermissionsUsingUserAndServer(int $user, int $server): Subuser { diff --git a/app/Repositories/Eloquent/TaskRepository.php b/app/Repositories/Eloquent/TaskRepository.php index 942c54d479..4a68167cfd 100644 --- a/app/Repositories/Eloquent/TaskRepository.php +++ b/app/Repositories/Eloquent/TaskRepository.php @@ -20,7 +20,7 @@ public function model(): string /** * Get a task and the server relationship for that task. * - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException + * @throws RecordNotFoundException */ public function getTaskForJobProcess(int $id): Task { diff --git a/app/Repositories/Wings/DaemonBackupRepository.php b/app/Repositories/Wings/DaemonBackupRepository.php index 4c164ee6b3..2287840897 100644 --- a/app/Repositories/Wings/DaemonBackupRepository.php +++ b/app/Repositories/Wings/DaemonBackupRepository.php @@ -9,6 +9,10 @@ use GuzzleHttp\Exception\TransferException; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; +/** + * @method \Pterodactyl\Repositories\Wings\DaemonBackupRepository setNode(\Pterodactyl\Models\Node $node) + * @method \Pterodactyl\Repositories\Wings\DaemonBackupRepository setServer(\Pterodactyl\Models\Server $server) + */ class DaemonBackupRepository extends DaemonRepository { protected ?string $adapter; @@ -26,7 +30,7 @@ public function setBackupAdapter(string $adapter): self /** * Tells the remote Daemon to begin generating a backup for the server. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function backup(Backup $backup): ResponseInterface { @@ -51,9 +55,9 @@ public function backup(Backup $backup): ResponseInterface /** * Sends a request to Wings to begin restoring a backup for a server. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ - public function restore(Backup $backup, string $url = null, bool $truncate = false): ResponseInterface + public function restore(Backup $backup, ?string $url = null, bool $truncate = false): ResponseInterface { Assert::isInstanceOf($this->server, Server::class); @@ -76,7 +80,7 @@ public function restore(Backup $backup, string $url = null, bool $truncate = fal /** * Deletes a backup from the daemon. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function delete(Backup $backup): ResponseInterface { diff --git a/app/Repositories/Wings/DaemonCommandRepository.php b/app/Repositories/Wings/DaemonCommandRepository.php index cde29ff366..858d41a773 100644 --- a/app/Repositories/Wings/DaemonCommandRepository.php +++ b/app/Repositories/Wings/DaemonCommandRepository.php @@ -8,12 +8,16 @@ use GuzzleHttp\Exception\TransferException; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; +/** + * @method \Pterodactyl\Repositories\Wings\DaemonCommandRepository setNode(\Pterodactyl\Models\Node $node) + * @method \Pterodactyl\Repositories\Wings\DaemonCommandRepository setServer(\Pterodactyl\Models\Server $server) + */ class DaemonCommandRepository extends DaemonRepository { /** * Sends a command or multiple commands to a running server instance. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function send(array|string $command): ResponseInterface { diff --git a/app/Repositories/Wings/DaemonConfigurationRepository.php b/app/Repositories/Wings/DaemonConfigurationRepository.php index 5580f9a8be..90a7ef21ce 100644 --- a/app/Repositories/Wings/DaemonConfigurationRepository.php +++ b/app/Repositories/Wings/DaemonConfigurationRepository.php @@ -7,12 +7,16 @@ use GuzzleHttp\Exception\TransferException; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; +/** + * @method \Pterodactyl\Repositories\Wings\DaemonConfigurationRepository setNode(\Pterodactyl\Models\Node $node) + * @method \Pterodactyl\Repositories\Wings\DaemonConfigurationRepository setServer(\Pterodactyl\Models\Server $server) + */ class DaemonConfigurationRepository extends DaemonRepository { /** * Returns system information from the wings instance. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function getSystemInformation(?int $version = null): array { @@ -30,7 +34,7 @@ public function getSystemInformation(?int $version = null): array * this instance using a passed-in model. This allows us to change plenty of information * in the model, and still use the old, pre-update model to actually make the HTTP request. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function update(Node $node): ResponseInterface { diff --git a/app/Repositories/Wings/DaemonFileRepository.php b/app/Repositories/Wings/DaemonFileRepository.php index ca757151ed..af8db9be61 100644 --- a/app/Repositories/Wings/DaemonFileRepository.php +++ b/app/Repositories/Wings/DaemonFileRepository.php @@ -11,6 +11,10 @@ use Pterodactyl\Exceptions\Http\Server\FileSizeTooLargeException; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; +/** + * @method \Pterodactyl\Repositories\Wings\DaemonFileRepository setNode(\Pterodactyl\Models\Node $node) + * @method \Pterodactyl\Repositories\Wings\DaemonFileRepository setServer(\Pterodactyl\Models\Server $server) + */ class DaemonFileRepository extends DaemonRepository { /** @@ -18,11 +22,11 @@ class DaemonFileRepository extends DaemonRepository * * @param int|null $notLargerThan the maximum content length in bytes * - * @throws \GuzzleHttp\Exception\TransferException - * @throws \Pterodactyl\Exceptions\Http\Server\FileSizeTooLargeException - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws TransferException + * @throws FileSizeTooLargeException + * @throws DaemonConnectionException */ - public function getContent(string $path, int $notLargerThan = null): string + public function getContent(string $path, ?int $notLargerThan = null): string { Assert::isInstanceOf($this->server, Server::class); @@ -49,7 +53,7 @@ public function getContent(string $path, int $notLargerThan = null): string * Save new contents to a given file. This works for both creating and updating * a file. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function putContent(string $path, string $content): ResponseInterface { @@ -71,7 +75,7 @@ public function putContent(string $path, string $content): ResponseInterface /** * Return a directory listing for a given path. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function getDirectory(string $path): array { @@ -94,7 +98,7 @@ public function getDirectory(string $path): array /** * Creates a new directory for the server in the given $path. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function createDirectory(string $name, string $path): ResponseInterface { @@ -118,7 +122,7 @@ public function createDirectory(string $name, string $path): ResponseInterface /** * Renames or moves a file on the remote machine. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function renameFiles(?string $root, array $files): ResponseInterface { @@ -142,7 +146,7 @@ public function renameFiles(?string $root, array $files): ResponseInterface /** * Copy a given file and give it a unique name. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function copyFile(string $location): ResponseInterface { @@ -165,7 +169,7 @@ public function copyFile(string $location): ResponseInterface /** * Delete a file or folder for the server. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function deleteFiles(?string $root, array $files): ResponseInterface { @@ -189,7 +193,7 @@ public function deleteFiles(?string $root, array $files): ResponseInterface /** * Compress the given files or folders in the given root. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function compressFiles(?string $root, array $files): array { @@ -218,7 +222,7 @@ public function compressFiles(?string $root, array $files): array /** * Decompresses a given archive file. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function decompressFile(?string $root, string $file): ResponseInterface { @@ -245,7 +249,7 @@ public function decompressFile(?string $root, string $file): ResponseInterface /** * Chmods the given files. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function chmodFiles(?string $root, array $files): ResponseInterface { @@ -269,7 +273,7 @@ public function chmodFiles(?string $root, array $files): ResponseInterface /** * Pulls a file from the given URL and saves it to the disk. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function pull(string $url, ?string $directory, array $params = []): ResponseInterface { diff --git a/app/Repositories/Wings/DaemonPowerRepository.php b/app/Repositories/Wings/DaemonPowerRepository.php index 4e290cfc91..2b6f339a6d 100644 --- a/app/Repositories/Wings/DaemonPowerRepository.php +++ b/app/Repositories/Wings/DaemonPowerRepository.php @@ -8,12 +8,16 @@ use GuzzleHttp\Exception\TransferException; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; +/** + * @method \Pterodactyl\Repositories\Wings\DaemonPowerRepository setNode(\Pterodactyl\Models\Node $node) + * @method \Pterodactyl\Repositories\Wings\DaemonPowerRepository setServer(\Pterodactyl\Models\Server $server) + */ class DaemonPowerRepository extends DaemonRepository { /** * Sends a power action to the server instance. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function send(string $action): ResponseInterface { diff --git a/app/Repositories/Wings/DaemonRepository.php b/app/Repositories/Wings/DaemonRepository.php index 512626d73f..5803579c37 100644 --- a/app/Repositories/Wings/DaemonRepository.php +++ b/app/Repositories/Wings/DaemonRepository.php @@ -8,6 +8,10 @@ use Pterodactyl\Models\Server; use Illuminate\Contracts\Foundation\Application; +/** + * @method \Pterodactyl\Repositories\Wings\DaemonRepository setNode(\Pterodactyl\Models\Node $node) + * @method \Pterodactyl\Repositories\Wings\DaemonRepository setServer(\Pterodactyl\Models\Server $server) + */ abstract class DaemonRepository { protected ?Server $server; diff --git a/app/Repositories/Wings/DaemonServerRepository.php b/app/Repositories/Wings/DaemonServerRepository.php index f013ac08c4..d7ee51a81e 100644 --- a/app/Repositories/Wings/DaemonServerRepository.php +++ b/app/Repositories/Wings/DaemonServerRepository.php @@ -8,12 +8,16 @@ use GuzzleHttp\Exception\TransferException; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; +/** + * @method \Pterodactyl\Repositories\Wings\DaemonServerRepository setNode(\Pterodactyl\Models\Node $node) + * @method \Pterodactyl\Repositories\Wings\DaemonServerRepository setServer(\Pterodactyl\Models\Server $server) + */ class DaemonServerRepository extends DaemonRepository { /** * Returns details about a server from the Daemon instance. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function getDetails(): array { @@ -33,7 +37,7 @@ public function getDetails(): array /** * Creates a new server on the Wings daemon. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function create(bool $startOnCompletion = true): void { @@ -54,7 +58,7 @@ public function create(bool $startOnCompletion = true): void /** * Triggers a server sync on Wings. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function sync(): void { @@ -70,7 +74,7 @@ public function sync(): void /** * Delete a server from the daemon, forcibly if passed. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function delete(): void { @@ -86,7 +90,7 @@ public function delete(): void /** * Reinstall a server on the daemon. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function reinstall(): void { @@ -106,7 +110,7 @@ public function reinstall(): void * Requests the daemon to create a full archive of the server. Once the daemon is finished * they will send a POST request to "/api/remote/servers/{uuid}/archive" with a boolean. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function requestArchive(): void { @@ -127,7 +131,7 @@ public function requestArchive(): void * make it easier to revoke tokens on the fly. This ensures that the JTI key is formatted * correctly and avoids any costly mistakes in the codebase. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function revokeUserJTI(int $id): void { @@ -140,7 +144,7 @@ public function revokeUserJTI(int $id): void * Revokes an array of JWT JTI's by marking any token generated before the current time on * the Wings instance as being invalid. * - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ protected function revokeJTIs(array $jtis): void { diff --git a/app/Repositories/Wings/DaemonTransferRepository.php b/app/Repositories/Wings/DaemonTransferRepository.php index 9c8745232b..9a2cd2160a 100644 --- a/app/Repositories/Wings/DaemonTransferRepository.php +++ b/app/Repositories/Wings/DaemonTransferRepository.php @@ -7,10 +7,14 @@ use GuzzleHttp\Exception\GuzzleException; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; +/** + * @method \Pterodactyl\Repositories\Wings\DaemonTransferRepository setNode(\Pterodactyl\Models\Node $node) + * @method \Pterodactyl\Repositories\Wings\DaemonTransferRepository setServer(\Pterodactyl\Models\Server $server) + */ class DaemonTransferRepository extends DaemonRepository { /** - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException + * @throws DaemonConnectionException */ public function notify(Node $targetNode, Plain $token): void { diff --git a/app/Rules/Fqdn.php b/app/Rules/Fqdn.php index 47baf510d7..997f6a7cf0 100644 --- a/app/Rules/Fqdn.php +++ b/app/Rules/Fqdn.php @@ -27,7 +27,6 @@ public function setData($data): self * specified when this rule is created additional checks will be applied. * * @param string $attribute - * @param mixed $value */ public function passes($attribute, $value): bool { @@ -71,7 +70,7 @@ public function message(): string /** * Returns a new instance of the rule with a defined scheme set. */ - public static function make(string $schemeField = null): self + public static function make(?string $schemeField = null): self { return tap(new static(), function ($fqdn) use ($schemeField) { $fqdn->schemeField = $schemeField; diff --git a/app/Rules/Username.php b/app/Rules/Username.php index b89184e9ab..4e3dc249cd 100644 --- a/app/Rules/Username.php +++ b/app/Rules/Username.php @@ -18,7 +18,6 @@ class Username implements Rule * Allowed characters: a-z0-9_-. * * @param string $attribute - * @param mixed $value */ public function passes($attribute, $value): bool { diff --git a/app/Services/Activity/ActivityLogService.php b/app/Services/Activity/ActivityLogService.php index f863852149..fefffdc8c6 100644 --- a/app/Services/Activity/ActivityLogService.php +++ b/app/Services/Activity/ActivityLogService.php @@ -23,7 +23,7 @@ public function __construct( protected AuthFactory $manager, protected ActivityLogBatchService $batch, protected ActivityLogTargetableService $targetable, - protected ConnectionInterface $connection + protected ConnectionInterface $connection, ) { } @@ -102,7 +102,6 @@ public function actor(Model $actor): self * Sets a custom property on the activity log instance. * * @param string|array $key - * @param mixed $value */ public function property($key, $value = null): self { @@ -131,7 +130,7 @@ public function withRequestMetadata(): self * performing this action it will be logged to the disk but will not interrupt * the code flow. */ - public function log(string $description = null): ActivityLog + public function log(?string $description = null): ActivityLog { $activity = $this->getActivity(); diff --git a/app/Services/Allocations/AllocationDeletionService.php b/app/Services/Allocations/AllocationDeletionService.php index 8ea677245e..be5d4372fa 100644 --- a/app/Services/Allocations/AllocationDeletionService.php +++ b/app/Services/Allocations/AllocationDeletionService.php @@ -19,7 +19,7 @@ public function __construct(private AllocationRepositoryInterface $repository) * Delete an allocation from the database only if it does not have a server * that is actively attached to it. * - * @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException + * @throws ServerUsingAllocationException */ public function handle(Allocation $allocation): int { diff --git a/app/Services/Allocations/AssignmentService.php b/app/Services/Allocations/AssignmentService.php index 821255d49c..979f74bb92 100644 --- a/app/Services/Allocations/AssignmentService.php +++ b/app/Services/Allocations/AssignmentService.php @@ -31,11 +31,11 @@ public function __construct(protected AllocationRepositoryInterface $repository, /** * Insert allocations into the database and link them to a specific node. * - * @throws \Pterodactyl\Exceptions\DisplayException - * @throws \Pterodactyl\Exceptions\Service\Allocation\CidrOutOfRangeException - * @throws \Pterodactyl\Exceptions\Service\Allocation\InvalidPortMappingException - * @throws \Pterodactyl\Exceptions\Service\Allocation\PortOutOfRangeException - * @throws \Pterodactyl\Exceptions\Service\Allocation\TooManyPortsInRangeException + * @throws DisplayException + * @throws CidrOutOfRangeException + * @throws InvalidPortMappingException + * @throws PortOutOfRangeException + * @throws TooManyPortsInRangeException */ public function handle(Node $node, array $data): void { diff --git a/app/Services/Allocations/FindAssignableAllocationService.php b/app/Services/Allocations/FindAssignableAllocationService.php index 3374fa07ee..ffc15d0449 100644 --- a/app/Services/Allocations/FindAssignableAllocationService.php +++ b/app/Services/Allocations/FindAssignableAllocationService.php @@ -37,7 +37,7 @@ public function handle(Server $server): Allocation // Attempt to find a given available allocation for a server. If one cannot be found // we will fall back to attempting to create a new allocation that can be used for the // server. - /** @var \Pterodactyl\Models\Allocation|null $allocation */ + /** @var Allocation|null $allocation */ $allocation = $server->node->allocations() ->where('ip', $server->allocation->ip) ->whereNull('server_id') @@ -100,7 +100,7 @@ protected function createNewAllocation(Server $server): Allocation 'allocation_ports' => [$port], ]); - /** @var \Pterodactyl\Models\Allocation $allocation */ + /** @var Allocation $allocation */ $allocation = $server->node->allocations() ->where('ip', $server->allocation->ip) ->where('port', $port) diff --git a/app/Services/Backups/DeleteBackupService.php b/app/Services/Backups/DeleteBackupService.php index fd65969c17..b77ac8e1cb 100644 --- a/app/Services/Backups/DeleteBackupService.php +++ b/app/Services/Backups/DeleteBackupService.php @@ -16,7 +16,7 @@ class DeleteBackupService public function __construct( private ConnectionInterface $connection, private BackupManager $manager, - private DaemonBackupRepository $daemonBackupRepository + private DaemonBackupRepository $daemonBackupRepository, ) { } diff --git a/app/Services/Backups/InitiateBackupService.php b/app/Services/Backups/InitiateBackupService.php index 6c4fc683df..c00b46c8a0 100644 --- a/app/Services/Backups/InitiateBackupService.php +++ b/app/Services/Backups/InitiateBackupService.php @@ -28,7 +28,7 @@ public function __construct( private ConnectionInterface $connection, private DaemonBackupRepository $daemonBackupRepository, private DeleteBackupService $deleteBackupService, - private BackupManager $backupManager + private BackupManager $backupManager, ) { } @@ -70,10 +70,10 @@ public function setIgnoredFiles(?array $ignored): self * Initiates the backup process for a server on Wings. * * @throws \Throwable - * @throws \Pterodactyl\Exceptions\Service\Backup\TooManyBackupsException - * @throws \Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException + * @throws TooManyBackupsException + * @throws TooManyRequestsHttpException */ - public function handle(Server $server, string $name = null, bool $override = false): Backup + public function handle(Server $server, ?string $name = null, bool $override = false): Backup { $limit = config('backups.throttles.limit'); $period = config('backups.throttles.period'); @@ -98,7 +98,7 @@ public function handle(Server $server, string $name = null, bool $override = fal // Get the oldest backup the server has that is not "locked" (indicating a backup that should // never be automatically purged). If we find a backup we will delete it and then continue with // this process. If no backup is found that can be used an exception is thrown. - /** @var \Pterodactyl\Models\Backup $oldest */ + /** @var Backup $oldest */ $oldest = $successful->where('is_locked', false)->orderBy('created_at')->first(); if (!$oldest) { throw new TooManyBackupsException($server->backup_limit); @@ -108,7 +108,7 @@ public function handle(Server $server, string $name = null, bool $override = fal } return $this->connection->transaction(function () use ($server, $name) { - /** @var \Pterodactyl\Models\Backup $backup */ + /** @var Backup $backup */ $backup = $this->repository->create([ 'server_id' => $server->id, 'uuid' => Uuid::uuid4()->toString(), diff --git a/app/Services/Databases/DatabaseManagementService.php b/app/Services/Databases/DatabaseManagementService.php index 20de6a78f6..cb868cca6b 100644 --- a/app/Services/Databases/DatabaseManagementService.php +++ b/app/Services/Databases/DatabaseManagementService.php @@ -36,7 +36,7 @@ public function __construct( protected ConnectionInterface $connection, protected DynamicDatabaseConnection $dynamic, protected Encrypter $encrypter, - protected DatabaseRepository $repository + protected DatabaseRepository $repository, ) { } @@ -66,8 +66,8 @@ public function setValidateDatabaseLimit(bool $validate): self * Create a new database that is linked to a specific host. * * @throws \Throwable - * @throws \Pterodactyl\Exceptions\Service\Database\TooManyDatabasesException - * @throws \Pterodactyl\Exceptions\Service\Database\DatabaseClientFeatureNotEnabledException + * @throws TooManyDatabasesException + * @throws DatabaseClientFeatureNotEnabledException */ public function create(Server $server, array $data): Database { @@ -153,7 +153,7 @@ public function delete(Database $database): ?bool * 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. * - * @throws \Pterodactyl\Exceptions\Repository\DuplicateDatabaseNameException + * @throws DuplicateDatabaseNameException * @throws \Throwable */ protected function createModel(array $data): Database diff --git a/app/Services/Databases/DatabasePasswordService.php b/app/Services/Databases/DatabasePasswordService.php index 3862b2393b..66c395df43 100644 --- a/app/Services/Databases/DatabasePasswordService.php +++ b/app/Services/Databases/DatabasePasswordService.php @@ -18,7 +18,7 @@ public function __construct( private ConnectionInterface $connection, private DynamicDatabaseConnection $dynamic, private Encrypter $encrypter, - private DatabaseRepositoryInterface $repository + private DatabaseRepositoryInterface $repository, ) { } diff --git a/app/Services/Databases/Hosts/HostCreationService.php b/app/Services/Databases/Hosts/HostCreationService.php index d33a15856a..0eecd7971f 100644 --- a/app/Services/Databases/Hosts/HostCreationService.php +++ b/app/Services/Databases/Hosts/HostCreationService.php @@ -19,7 +19,7 @@ public function __construct( private DatabaseManager $databaseManager, private DynamicDatabaseConnection $dynamic, private Encrypter $encrypter, - private DatabaseHostRepositoryInterface $repository + private DatabaseHostRepositoryInterface $repository, ) { } diff --git a/app/Services/Databases/Hosts/HostDeletionService.php b/app/Services/Databases/Hosts/HostDeletionService.php index 4a06af8da7..8904121082 100644 --- a/app/Services/Databases/Hosts/HostDeletionService.php +++ b/app/Services/Databases/Hosts/HostDeletionService.php @@ -13,7 +13,7 @@ class HostDeletionService */ public function __construct( private DatabaseRepositoryInterface $databaseRepository, - private DatabaseHostRepositoryInterface $repository + private DatabaseHostRepositoryInterface $repository, ) { } @@ -21,7 +21,7 @@ public function __construct( * Delete a specified host from the Panel if no databases are * attached to it. * - * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException + * @throws HasActiveServersException */ public function handle(int $host): int { diff --git a/app/Services/Databases/Hosts/HostUpdateService.php b/app/Services/Databases/Hosts/HostUpdateService.php index 363deb1b33..e2efd46fca 100644 --- a/app/Services/Databases/Hosts/HostUpdateService.php +++ b/app/Services/Databases/Hosts/HostUpdateService.php @@ -19,7 +19,7 @@ public function __construct( private DatabaseManager $databaseManager, private DynamicDatabaseConnection $dynamic, private Encrypter $encrypter, - private DatabaseHostRepositoryInterface $repository + private DatabaseHostRepositoryInterface $repository, ) { } diff --git a/app/Services/Deployment/AllocationSelectionService.php b/app/Services/Deployment/AllocationSelectionService.php index ae334edd25..7915fc5fe4 100644 --- a/app/Services/Deployment/AllocationSelectionService.php +++ b/app/Services/Deployment/AllocationSelectionService.php @@ -51,7 +51,7 @@ public function setNodes(array $nodes): self * empty, all ports will be considered when finding an allocation. If set, only ports appearing * in the array or range will be used. * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException */ public function setPorts(array $ports): self { @@ -80,7 +80,7 @@ public function setPorts(array $ports): self /** * Return a single allocation that should be used as the default allocation for a server. * - * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableAllocationException + * @throws NoViableAllocationException */ public function handle(): Allocation { diff --git a/app/Services/Deployment/FindViableNodesService.php b/app/Services/Deployment/FindViableNodesService.php index 71c830bf9e..cc76ad7182 100644 --- a/app/Services/Deployment/FindViableNodesService.php +++ b/app/Services/Deployment/FindViableNodesService.php @@ -64,9 +64,9 @@ public function setMemory(int $memory): self * If "null" is provided as the value no pagination will * be used. * - * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException + * @throws NoViableNodeException */ - public function handle(int $perPage = null, int $page = null): LengthAwarePaginator|Collection + public function handle(?int $perPage = null, ?int $page = null): LengthAwarePaginator|Collection { Assert::integer($this->disk, 'Disk space must be an int, got %s'); Assert::integer($this->memory, 'Memory usage must be an int, got %s'); diff --git a/app/Services/Eggs/EggCreationService.php b/app/Services/Eggs/EggCreationService.php index b084b0ccad..7379eae7c9 100644 --- a/app/Services/Eggs/EggCreationService.php +++ b/app/Services/Eggs/EggCreationService.php @@ -22,7 +22,7 @@ public function __construct(private ConfigRepository $config, private EggReposit * Create a new service option and assign it to the given service. * * @throws \Pterodactyl\Exceptions\Model\DataValidationException - * @throws \Pterodactyl\Exceptions\Service\Egg\NoParentConfigurationFoundException + * @throws NoParentConfigurationFoundException */ public function handle(array $data): Egg { diff --git a/app/Services/Eggs/EggDeletionService.php b/app/Services/Eggs/EggDeletionService.php index 7e40133513..50b4e1c6d0 100644 --- a/app/Services/Eggs/EggDeletionService.php +++ b/app/Services/Eggs/EggDeletionService.php @@ -14,15 +14,15 @@ class EggDeletionService */ public function __construct( protected ServerRepositoryInterface $serverRepository, - protected EggRepositoryInterface $repository + protected EggRepositoryInterface $repository, ) { } /** * Delete an Egg from the database if it has no active servers attached to it. * - * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException - * @throws \Pterodactyl\Exceptions\Service\Egg\HasChildrenException + * @throws HasActiveServersException + * @throws HasChildrenException */ public function handle(int $egg): int { diff --git a/app/Services/Eggs/EggParserService.php b/app/Services/Eggs/EggParserService.php index 6d8545bc2c..75add2352b 100644 --- a/app/Services/Eggs/EggParserService.php +++ b/app/Services/Eggs/EggParserService.php @@ -14,7 +14,7 @@ class EggParserService * Takes an uploaded file and parses out the egg configuration from within. * * @throws \JsonException - * @throws \Pterodactyl\Exceptions\Service\InvalidFileUploadException + * @throws InvalidFileUploadException */ public function handle(UploadedFile $file): array { diff --git a/app/Services/Eggs/EggUpdateService.php b/app/Services/Eggs/EggUpdateService.php index 7ca442ba33..64c2755bea 100644 --- a/app/Services/Eggs/EggUpdateService.php +++ b/app/Services/Eggs/EggUpdateService.php @@ -20,7 +20,7 @@ public function __construct(protected EggRepositoryInterface $repository) * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException - * @throws \Pterodactyl\Exceptions\Service\Egg\NoParentConfigurationFoundException + * @throws NoParentConfigurationFoundException */ public function handle(Egg $egg, array $data): void { diff --git a/app/Services/Eggs/Scripts/InstallScriptService.php b/app/Services/Eggs/Scripts/InstallScriptService.php index 3341572363..a6f24f0b12 100644 --- a/app/Services/Eggs/Scripts/InstallScriptService.php +++ b/app/Services/Eggs/Scripts/InstallScriptService.php @@ -20,7 +20,7 @@ public function __construct(protected EggRepositoryInterface $repository) * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException - * @throws \Pterodactyl\Exceptions\Service\Egg\InvalidCopyFromException + * @throws InvalidCopyFromException */ public function handle(Egg $egg, array $data): void { diff --git a/app/Services/Eggs/Sharing/EggImporterService.php b/app/Services/Eggs/Sharing/EggImporterService.php index ecd6eadb6a..997dc9236e 100644 --- a/app/Services/Eggs/Sharing/EggImporterService.php +++ b/app/Services/Eggs/Sharing/EggImporterService.php @@ -26,7 +26,7 @@ public function handle(UploadedFile $file, int $nest): Egg { $parsed = $this->parser->handle($file); - /** @var \Pterodactyl\Models\Nest $nest */ + /** @var Nest $nest */ $nest = Nest::query()->with('eggs', 'eggs.variables')->findOrFail($nest); return $this->connection->transaction(function () use ($nest, $parsed) { diff --git a/app/Services/Eggs/Variables/VariableCreationService.php b/app/Services/Eggs/Variables/VariableCreationService.php index a7e19f6bac..601a3513a8 100644 --- a/app/Services/Eggs/Variables/VariableCreationService.php +++ b/app/Services/Eggs/Variables/VariableCreationService.php @@ -33,7 +33,7 @@ protected function getValidator(): ValidationFactory * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException - * @throws \Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException + * @throws ReservedVariableNameException */ public function handle(int $egg, array $data): EggVariable { diff --git a/app/Services/Eggs/Variables/VariableUpdateService.php b/app/Services/Eggs/Variables/VariableUpdateService.php index ed70b260fe..c3ca303bde 100644 --- a/app/Services/Eggs/Variables/VariableUpdateService.php +++ b/app/Services/Eggs/Variables/VariableUpdateService.php @@ -33,10 +33,10 @@ protected function getValidator(): ValidationFactory /** * Update a specific egg variable. * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException - * @throws \Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException + * @throws ReservedVariableNameException */ public function handle(EggVariable $variable, array $data): mixed { diff --git a/app/Services/Helpers/SoftwareVersionService.php b/app/Services/Helpers/SoftwareVersionService.php index 2122b397b1..a2d30255bc 100644 --- a/app/Services/Helpers/SoftwareVersionService.php +++ b/app/Services/Helpers/SoftwareVersionService.php @@ -2,7 +2,6 @@ namespace Pterodactyl\Services\Helpers; -use Exception; use GuzzleHttp\Client; use Carbon\CarbonImmutable; use Illuminate\Support\Arr; @@ -20,7 +19,7 @@ class SoftwareVersionService */ public function __construct( protected CacheRepository $cache, - protected Client $client + protected Client $client, ) { self::$result = $this->cacheVersionData(); } @@ -95,7 +94,7 @@ protected function cacheVersionData(): array } throw new CdnVersionFetchingException(); - } catch (Exception) { + } catch (\Exception) { return []; } }); diff --git a/app/Services/Locations/LocationDeletionService.php b/app/Services/Locations/LocationDeletionService.php index 5b4b9eba4e..8868418650 100644 --- a/app/Services/Locations/LocationDeletionService.php +++ b/app/Services/Locations/LocationDeletionService.php @@ -15,14 +15,14 @@ class LocationDeletionService */ public function __construct( protected LocationRepositoryInterface $repository, - protected NodeRepositoryInterface $nodeRepository + protected NodeRepositoryInterface $nodeRepository, ) { } /** * Delete an existing location. * - * @throws \Pterodactyl\Exceptions\Service\Location\HasActiveNodesException + * @throws HasActiveNodesException */ public function handle(Location|int $location): ?int { diff --git a/app/Services/Nests/NestCreationService.php b/app/Services/Nests/NestCreationService.php index c3513aefe8..7fbb1eb722 100644 --- a/app/Services/Nests/NestCreationService.php +++ b/app/Services/Nests/NestCreationService.php @@ -21,7 +21,7 @@ public function __construct(private ConfigRepository $config, private NestReposi * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ - public function handle(array $data, string $author = null): Nest + public function handle(array $data, ?string $author = null): Nest { return $this->repository->create([ 'uuid' => Uuid::uuid4()->toString(), diff --git a/app/Services/Nests/NestDeletionService.php b/app/Services/Nests/NestDeletionService.php index 6babf45c3e..bb5271133d 100644 --- a/app/Services/Nests/NestDeletionService.php +++ b/app/Services/Nests/NestDeletionService.php @@ -13,14 +13,14 @@ class NestDeletionService */ public function __construct( protected ServerRepositoryInterface $serverRepository, - protected NestRepositoryInterface $repository + protected NestRepositoryInterface $repository, ) { } /** * Delete a nest from the system only if there are no servers attached to it. * - * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException + * @throws HasActiveServersException */ public function handle(int $nest): int { diff --git a/app/Services/Nodes/NodeDeletionService.php b/app/Services/Nodes/NodeDeletionService.php index adb9a0628a..f7966e009e 100644 --- a/app/Services/Nodes/NodeDeletionService.php +++ b/app/Services/Nodes/NodeDeletionService.php @@ -16,14 +16,14 @@ class NodeDeletionService public function __construct( protected NodeRepositoryInterface $repository, protected ServerRepositoryInterface $serverRepository, - protected Translator $translator + protected Translator $translator, ) { } /** * Delete a node from the panel if no servers are attached to it. * - * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException + * @throws HasActiveServersException */ public function handle(int|Node $node): int { diff --git a/app/Services/Nodes/NodeUpdateService.php b/app/Services/Nodes/NodeUpdateService.php index 28733e35a3..11078af531 100644 --- a/app/Services/Nodes/NodeUpdateService.php +++ b/app/Services/Nodes/NodeUpdateService.php @@ -21,7 +21,7 @@ public function __construct( private ConnectionInterface $connection, private DaemonConfigurationRepository $configurationRepository, private Encrypter $encrypter, - private NodeRepository $repository + private NodeRepository $repository, ) { } @@ -38,7 +38,7 @@ public function handle(Node $node, array $data, bool $resetToken = false): Node } [$updated, $exception] = $this->connection->transaction(function () use ($data, $node) { - /** @var \Pterodactyl\Models\Node $updated */ + /** @var Node $updated */ $updated = $this->repository->withFreshModel()->update($node->id, $data, true, true); try { diff --git a/app/Services/Servers/BuildModificationService.php b/app/Services/Servers/BuildModificationService.php index 05553d7f10..a977f8381b 100644 --- a/app/Services/Servers/BuildModificationService.php +++ b/app/Services/Servers/BuildModificationService.php @@ -20,7 +20,7 @@ class BuildModificationService public function __construct( private ConnectionInterface $connection, private DaemonServerRepository $daemonServerRepository, - private ServerConfigurationStructureService $structureService + private ServerConfigurationStructureService $structureService, ) { } @@ -28,11 +28,11 @@ public function __construct( * Change the build details for a specified server. * * @throws \Throwable - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException */ public function handle(Server $server, array $data): Server { - /** @var \Pterodactyl\Models\Server $server */ + /** @var Server $server */ $server = $this->connection->transaction(function () use ($server, $data) { $this->processAllocations($server, $data); @@ -77,7 +77,7 @@ public function handle(Server $server, array $data): Server /** * Process the allocations being assigned in the data and ensure they are available for a server. * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException */ private function processAllocations(Server $server, array &$data): void { diff --git a/app/Services/Servers/ReinstallServerService.php b/app/Services/Servers/ReinstallServerService.php index 5881d1fc63..1822238288 100644 --- a/app/Services/Servers/ReinstallServerService.php +++ b/app/Services/Servers/ReinstallServerService.php @@ -13,7 +13,7 @@ class ReinstallServerService */ public function __construct( private ConnectionInterface $connection, - private DaemonServerRepository $daemonServerRepository + private DaemonServerRepository $daemonServerRepository, ) { } diff --git a/app/Services/Servers/ServerCreationService.php b/app/Services/Servers/ServerCreationService.php index 2c9b4cf844..6f900b12d5 100644 --- a/app/Services/Servers/ServerCreationService.php +++ b/app/Services/Servers/ServerCreationService.php @@ -32,7 +32,7 @@ public function __construct( private ServerRepository $repository, private ServerDeletionService $serverDeletionService, private ServerVariableRepository $serverVariableRepository, - private VariableValidatorService $validatorService + private VariableValidatorService $validatorService, ) { } @@ -49,7 +49,7 @@ public function __construct( * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableAllocationException */ - public function handle(array $data, DeploymentObject $deployment = null): Server + public function handle(array $data, ?DeploymentObject $deployment = null): Server { // If a deployment object has been passed we need to get the allocation // that the server should use, and assign the node from that allocation. @@ -82,7 +82,7 @@ public function handle(array $data, DeploymentObject $deployment = null): Server // // If that connection fails out we will attempt to perform a cleanup by just // deleting the server itself from the system. - /** @var \Pterodactyl\Models\Server $server */ + /** @var Server $server */ $server = $this->connection->transaction(function () use ($data, $eggVariableData) { // Create the server and assign any additional allocations to it. $server = $this->createModel($data); @@ -115,7 +115,7 @@ public function handle(array $data, DeploymentObject $deployment = null): Server */ private function configureDeployment(array $data, DeploymentObject $deployment): Allocation { - /** @var \Illuminate\Support\Collection $nodes */ + /** @var Collection $nodes */ $nodes = $this->findViableNodesService->setLocations($deployment->getLocations()) ->setDisk(Arr::get($data, 'disk')) ->setMemory(Arr::get($data, 'memory')) @@ -136,7 +136,7 @@ private function createModel(array $data): Server { $uuid = $this->generateUniqueUuidCombo(); - /** @var \Pterodactyl\Models\Server $model */ + /** @var Server $model */ $model = $this->repository->create([ 'external_id' => Arr::get($data, 'external_id'), 'uuid' => $uuid, diff --git a/app/Services/Servers/ServerDeletionService.php b/app/Services/Servers/ServerDeletionService.php index a83c8feb6a..714e226230 100644 --- a/app/Services/Servers/ServerDeletionService.php +++ b/app/Services/Servers/ServerDeletionService.php @@ -20,7 +20,7 @@ class ServerDeletionService public function __construct( private ConnectionInterface $connection, private DaemonServerRepository $daemonServerRepository, - private DatabaseManagementService $databaseManagementService + private DatabaseManagementService $databaseManagementService, ) { } diff --git a/app/Services/Servers/StartupModificationService.php b/app/Services/Servers/StartupModificationService.php index a0a5c4cb77..5397579001 100644 --- a/app/Services/Servers/StartupModificationService.php +++ b/app/Services/Servers/StartupModificationService.php @@ -70,7 +70,7 @@ protected function updateAdministrativeSettings(array $data, Server &$server): v $eggId = Arr::get($data, 'egg_id'); if (is_digit($eggId) && $server->egg_id !== (int) $eggId) { - /** @var \Pterodactyl\Models\Egg $egg */ + /** @var Egg $egg */ $egg = Egg::query()->findOrFail($data['egg_id']); $server = $server->forceFill([ diff --git a/app/Services/Servers/SuspensionService.php b/app/Services/Servers/SuspensionService.php index d11ace22c8..eb9237c5db 100644 --- a/app/Services/Servers/SuspensionService.php +++ b/app/Services/Servers/SuspensionService.php @@ -16,7 +16,7 @@ class SuspensionService * SuspensionService constructor. */ public function __construct( - private DaemonServerRepository $daemonServerRepository + private DaemonServerRepository $daemonServerRepository, ) { } diff --git a/app/Services/Servers/VariableValidatorService.php b/app/Services/Servers/VariableValidatorService.php index a198692653..676a84aba5 100644 --- a/app/Services/Servers/VariableValidatorService.php +++ b/app/Services/Servers/VariableValidatorService.php @@ -23,7 +23,7 @@ public function __construct(private ValidationFactory $validator) /** * Validate all of the passed data against the given service option variables. * - * @throws \Illuminate\Validation\ValidationException + * @throws ValidationException */ public function handle(int $egg, array $fields = []): Collection { diff --git a/app/Services/Subusers/SubuserCreationService.php b/app/Services/Subusers/SubuserCreationService.php index c207b0d071..f77393d63d 100644 --- a/app/Services/Subusers/SubuserCreationService.php +++ b/app/Services/Subusers/SubuserCreationService.php @@ -22,7 +22,7 @@ public function __construct( private ConnectionInterface $connection, private SubuserRepository $subuserRepository, private UserCreationService $userCreationService, - private UserRepositoryInterface $userRepository + private UserRepositoryInterface $userRepository, ) { } @@ -32,8 +32,8 @@ public function __construct( * be created. * * @throws \Pterodactyl\Exceptions\Model\DataValidationException - * @throws \Pterodactyl\Exceptions\Service\Subuser\ServerSubuserExistsException - * @throws \Pterodactyl\Exceptions\Service\Subuser\UserIsServerOwnerException + * @throws ServerSubuserExistsException + * @throws UserIsServerOwnerException * @throws \Throwable */ public function handle(Server $server, string $email, array $permissions): Subuser diff --git a/app/Services/Telemetry/TelemetryCollectionService.php b/app/Services/Telemetry/TelemetryCollectionService.php index c2fd128308..1ece481410 100644 --- a/app/Services/Telemetry/TelemetryCollectionService.php +++ b/app/Services/Telemetry/TelemetryCollectionService.php @@ -2,7 +2,6 @@ namespace Pterodactyl\Services\Telemetry; -use Exception; use Ramsey\Uuid\Uuid; use Illuminate\Support\Arr; use Pterodactyl\Models\Egg; @@ -26,7 +25,7 @@ class TelemetryCollectionService */ public function __construct( private DaemonConfigurationRepository $daemonConfigurationRepository, - private SettingsRepository $settingsRepository + private SettingsRepository $settingsRepository, ) { } @@ -37,7 +36,7 @@ public function __invoke(): void { try { $data = $this->collect(); - } catch (Exception) { + } catch (\Exception) { return; } @@ -60,7 +59,7 @@ public function collect(): array $nodes = Node::all()->map(function ($node) { try { $info = $this->daemonConfigurationRepository->setNode($node)->getSystemInformation(2); - } catch (Exception) { + } catch (\Exception) { return null; } @@ -142,10 +141,10 @@ public function collect(): array 'count' => Egg::count(), // Egg UUIDs are generated randomly on import, so there is not a consistent way to // determine if servers are using default eggs or not. -// 'server_usage' => Egg::all() -// ->flatMap(fn (Egg $egg) => [$egg->uuid => $egg->servers->count()]) -// ->filter(fn (int $count) => $count > 0) -// ->toArray(), + // 'server_usage' => Egg::all() + // ->flatMap(fn (Egg $egg) => [$egg->uuid => $egg->servers->count()]) + // ->filter(fn (int $count) => $count > 0) + // ->toArray(), ], 'locations' => [ @@ -160,10 +159,10 @@ public function collect(): array 'count' => Nest::count(), // Nest UUIDs are generated randomly on import, so there is not a consistent way to // determine if servers are using default eggs or not. -// 'server_usage' => Nest::all() -// ->flatMap(fn (Nest $nest) => [$nest->uuid => $nest->eggs->sum(fn (Egg $egg) => $egg->servers->count())]) -// ->filter(fn (int $count) => $count > 0) -// ->toArray(), + // 'server_usage' => Nest::all() + // ->flatMap(fn (Nest $nest) => [$nest->uuid => $nest->eggs->sum(fn (Egg $egg) => $egg->servers->count())]) + // ->filter(fn (int $count) => $count > 0) + // ->toArray(), ], 'nodes' => [ diff --git a/app/Services/Users/ToggleTwoFactorService.php b/app/Services/Users/ToggleTwoFactorService.php index a91615b1ce..6790b1e3fa 100644 --- a/app/Services/Users/ToggleTwoFactorService.php +++ b/app/Services/Users/ToggleTwoFactorService.php @@ -22,7 +22,7 @@ public function __construct( private Encrypter $encrypter, private Google2FA $google2FA, private RecoveryTokenRepository $recoveryTokenRepository, - private UserRepositoryInterface $repository + private UserRepositoryInterface $repository, ) { } @@ -33,9 +33,9 @@ public function __construct( * @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException * @throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersException * @throws \PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException - * @throws \Pterodactyl\Exceptions\Service\User\TwoFactorAuthenticationTokenInvalid + * @throws TwoFactorAuthenticationTokenInvalid */ - public function handle(User $user, string $token, bool $toggleState = null): array + public function handle(User $user, string $token, ?bool $toggleState = null): array { $secret = $this->encrypter->decrypt($user->totp_secret); diff --git a/app/Services/Users/TwoFactorSetupService.php b/app/Services/Users/TwoFactorSetupService.php index 9ce8322150..c48a99dbdb 100644 --- a/app/Services/Users/TwoFactorSetupService.php +++ b/app/Services/Users/TwoFactorSetupService.php @@ -17,7 +17,7 @@ class TwoFactorSetupService public function __construct( private ConfigRepository $config, private Encrypter $encrypter, - private UserRepositoryInterface $repository + private UserRepositoryInterface $repository, ) { } diff --git a/app/Services/Users/UserCreationService.php b/app/Services/Users/UserCreationService.php index 130ae1a4e2..ed92d7b58a 100644 --- a/app/Services/Users/UserCreationService.php +++ b/app/Services/Users/UserCreationService.php @@ -19,7 +19,7 @@ public function __construct( private ConnectionInterface $connection, private Hasher $hasher, private PasswordBroker $passwordBroker, - private UserRepositoryInterface $repository + private UserRepositoryInterface $repository, ) { } @@ -41,7 +41,7 @@ public function handle(array $data): User $data['password'] = $this->hasher->make(str_random(30)); } - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = $this->repository->create(array_merge($data, [ 'uuid' => Uuid::uuid4()->toString(), ]), true, true); diff --git a/app/Services/Users/UserDeletionService.php b/app/Services/Users/UserDeletionService.php index f7f060cee4..8428d8c804 100644 --- a/app/Services/Users/UserDeletionService.php +++ b/app/Services/Users/UserDeletionService.php @@ -16,14 +16,14 @@ class UserDeletionService public function __construct( protected UserRepositoryInterface $repository, protected ServerRepositoryInterface $serverRepository, - protected Translator $translator + protected Translator $translator, ) { } /** * Delete a user from the panel only if they have no servers attached to their account. * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException */ public function handle(int|User $user): ?bool { diff --git a/app/Traits/Commands/EnvironmentWriterTrait.php b/app/Traits/Commands/EnvironmentWriterTrait.php index 3d1aa08999..533ec2aa32 100644 --- a/app/Traits/Commands/EnvironmentWriterTrait.php +++ b/app/Traits/Commands/EnvironmentWriterTrait.php @@ -23,7 +23,7 @@ public function escapeEnvironmentValue(string $value): string /** * Update the .env file for the application using the passed in values. * - * @throws \Pterodactyl\Exceptions\PterodactylException + * @throws PterodactylException */ public function writeToEnvironment(array $values = []): void { diff --git a/app/Traits/Services/ValidatesValidationRules.php b/app/Traits/Services/ValidatesValidationRules.php index 5456cb0171..115649b0da 100644 --- a/app/Traits/Services/ValidatesValidationRules.php +++ b/app/Traits/Services/ValidatesValidationRules.php @@ -14,7 +14,7 @@ abstract protected function getValidator(): ValidationFactory; * Validate that the rules being provided are valid for Laravel and can * be resolved. * - * @throws \Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException + * @throws BadValidationRuleException */ public function validateRules(array|string $rules): void { diff --git a/app/Transformers/Api/Client/ActivityLogTransformer.php b/app/Transformers/Api/Client/ActivityLogTransformer.php index 57c8ac30ed..43b11c229a 100644 --- a/app/Transformers/Api/Client/ActivityLogTransformer.php +++ b/app/Transformers/Api/Client/ActivityLogTransformer.php @@ -111,7 +111,7 @@ protected function hasAdditionalMetadata(ActivityLog $model): bool * Determines if the user can view the IP address in the output either because they are the * actor that performed the action, or because they are an administrator on the Panel. */ - protected function canViewIP(Model $actor = null): bool + protected function canViewIP(?Model $actor = null): bool { return optional($actor)->is($this->request->user()) || $this->request->user()->root_admin; } diff --git a/app/Transformers/Api/Client/ApiKeyTransformer.php b/app/Transformers/Api/Client/ApiKeyTransformer.php index 92ee1a5c66..ee6efae219 100644 --- a/app/Transformers/Api/Client/ApiKeyTransformer.php +++ b/app/Transformers/Api/Client/ApiKeyTransformer.php @@ -6,9 +6,6 @@ class ApiKeyTransformer extends BaseClientTransformer { - /** - * {@inheritdoc} - */ public function getResourceName(): string { return ApiKey::RESOURCE_NAME; diff --git a/app/Transformers/Api/Client/BaseClientTransformer.php b/app/Transformers/Api/Client/BaseClientTransformer.php index 0388effb08..8e76629f70 100644 --- a/app/Transformers/Api/Client/BaseClientTransformer.php +++ b/app/Transformers/Api/Client/BaseClientTransformer.php @@ -24,16 +24,13 @@ public function getUser(): User * * @noinspection PhpParameterNameChangedDuringInheritanceInspection */ - protected function authorize(string $ability, Server $server = null): bool + protected function authorize(string $ability, ?Server $server = null): bool { Assert::isInstanceOf($server, Server::class); return $this->request->user()->can($ability, [$server]); } - /** - * {@inheritDoc} - */ protected function makeTransformer(string $abstract) { Assert::subclassOf($abstract, self::class); diff --git a/app/Transformers/Api/Client/ScheduleTransformer.php b/app/Transformers/Api/Client/ScheduleTransformer.php index 98c783f45a..e98dc7bc85 100644 --- a/app/Transformers/Api/Client/ScheduleTransformer.php +++ b/app/Transformers/Api/Client/ScheduleTransformer.php @@ -12,9 +12,6 @@ class ScheduleTransformer extends BaseClientTransformer protected array $defaultIncludes = ['tasks']; - /** - * {@inheritdoc} - */ public function getResourceName(): string { return Schedule::RESOURCE_NAME; diff --git a/app/Transformers/Api/Client/ServerTransformer.php b/app/Transformers/Api/Client/ServerTransformer.php index 9f7bce958a..21f31603df 100644 --- a/app/Transformers/Api/Client/ServerTransformer.php +++ b/app/Transformers/Api/Client/ServerTransformer.php @@ -31,7 +31,7 @@ public function getResourceName(): string */ public function transform(Server $server): array { - /** @var \Pterodactyl\Services\Servers\StartupCommandService $service */ + /** @var StartupCommandService $service */ $service = Container::getInstance()->make(StartupCommandService::class); $user = $this->request->user(); diff --git a/app/Transformers/Api/Client/TaskTransformer.php b/app/Transformers/Api/Client/TaskTransformer.php index 52f0e2b5d1..25b9eebc8e 100644 --- a/app/Transformers/Api/Client/TaskTransformer.php +++ b/app/Transformers/Api/Client/TaskTransformer.php @@ -6,9 +6,6 @@ class TaskTransformer extends BaseClientTransformer { - /** - * {@inheritdoc} - */ public function getResourceName(): string { return Task::RESOURCE_NAME; diff --git a/bootstrap/tests.php b/bootstrap/tests.php index 5b54493554..7cab352ecc 100644 --- a/bootstrap/tests.php +++ b/bootstrap/tests.php @@ -9,7 +9,7 @@ $app = require __DIR__ . '/app.php'; -/** @var \Pterodactyl\Console\Kernel $kernel */ +/** @var Pterodactyl\Console\Kernel $kernel */ $kernel = $app->make(Kernel::class); /* diff --git a/config/app.php b/config/app.php index 316bcce99a..7a2570daef 100644 --- a/config/app.php +++ b/config/app.php @@ -13,7 +13,7 @@ 'version' => 'canary', - /* + /* |-------------------------------------------------------------------------- | Application Name |-------------------------------------------------------------------------- @@ -39,7 +39,7 @@ 'env' => env('APP_ENV', 'production'), - /* + /* |-------------------------------------------------------------------------- | Application Debug Mode |-------------------------------------------------------------------------- @@ -95,7 +95,7 @@ 'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'), - /* + /* |-------------------------------------------------------------------------- | Encryption Key |-------------------------------------------------------------------------- diff --git a/config/session.php b/config/session.php index 7884325b54..6b684ceef3 100644 --- a/config/session.php +++ b/config/session.php @@ -3,7 +3,7 @@ use Illuminate\Support\Str; return [ - /* + /* |-------------------------------------------------------------------------- | Default Session Driver |-------------------------------------------------------------------------- @@ -48,7 +48,7 @@ 'encrypt' => env('SESSION_ENCRYPT', true), - /* + /* |-------------------------------------------------------------------------- | Session File Location |-------------------------------------------------------------------------- @@ -131,7 +131,7 @@ Str::slug(env('APP_NAME', 'pterodactyl'), '_') . '_session' ), - /* + /* |-------------------------------------------------------------------------- | Session Cookie Path |-------------------------------------------------------------------------- diff --git a/database/Seeders/EggSeeder.php b/database/Seeders/EggSeeder.php index 234e7b5a43..605c1ad919 100644 --- a/database/Seeders/EggSeeder.php +++ b/database/Seeders/EggSeeder.php @@ -30,7 +30,7 @@ class EggSeeder extends Seeder */ public function __construct( EggImporterService $importerService, - EggUpdateImporterService $updateImporterService + EggUpdateImporterService $updateImporterService, ) { $this->importerService = $importerService; $this->updateImporterService = $updateImporterService; diff --git a/database/Seeders/NestSeeder.php b/database/Seeders/NestSeeder.php index eae7ae21b7..4d2803e285 100644 --- a/database/Seeders/NestSeeder.php +++ b/database/Seeders/NestSeeder.php @@ -9,12 +9,12 @@ class NestSeeder extends Seeder { /** - * @var \Pterodactyl\Services\Nests\NestCreationService + * @var NestCreationService */ private $creationService; /** - * @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface + * @var NestRepositoryInterface */ private $repository; @@ -23,7 +23,7 @@ class NestSeeder extends Seeder */ public function __construct( NestCreationService $creationService, - NestRepositoryInterface $repository + NestRepositoryInterface $repository, ) { $this->creationService = $creationService; $this->repository = $repository; @@ -51,7 +51,7 @@ public function run() * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ - private function createMinecraftNest(array $nest = null) + private function createMinecraftNest(?array $nest = null) { if (is_null($nest)) { $this->creationService->handle([ @@ -66,7 +66,7 @@ private function createMinecraftNest(array $nest = null) * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ - private function createSourceEngineNest(array $nest = null) + private function createSourceEngineNest(?array $nest = null) { if (is_null($nest)) { $this->creationService->handle([ @@ -81,7 +81,7 @@ private function createSourceEngineNest(array $nest = null) * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ - private function createVoiceServersNest(array $nest = null) + private function createVoiceServersNest(?array $nest = null) { if (is_null($nest)) { $this->creationService->handle([ @@ -96,7 +96,7 @@ private function createVoiceServersNest(array $nest = null) * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ - private function createRustNest(array $nest = null) + private function createRustNest(?array $nest = null) { if (is_null($nest)) { $this->creationService->handle([ diff --git a/database/migrations/2017_04_15_125021_UpgradeTaskSystem.php b/database/migrations/2017_04_15_125021_UpgradeTaskSystem.php index f5e48cfea7..68d9492e30 100644 --- a/database/migrations/2017_04_15_125021_UpgradeTaskSystem.php +++ b/database/migrations/2017_04_15_125021_UpgradeTaskSystem.php @@ -36,8 +36,8 @@ public function up(): void public function down(): void { Schema::table('tasks', function (Blueprint $table) { -// $table->dropForeign(['server_id']); -// $table->dropForeign(['user_id']); + // $table->dropForeign(['server_id']); + // $table->dropForeign(['user_id']); $table->renameColumn('server_id', 'server'); $table->dropColumn('user_id'); diff --git a/database/migrations/2018_01_13_142012_SetupTableForKeyEncryption.php b/database/migrations/2018_01_13_142012_SetupTableForKeyEncryption.php index d7e33210d6..f45b5bd85f 100644 --- a/database/migrations/2018_01_13_142012_SetupTableForKeyEncryption.php +++ b/database/migrations/2018_01_13_142012_SetupTableForKeyEncryption.php @@ -9,8 +9,8 @@ class SetupTableForKeyEncryption extends Migration /** * Run the migrations. * - * @throws \Exception - * @throws \Throwable + * @throws Exception + * @throws Throwable */ public function up(): void { @@ -27,8 +27,8 @@ public function up(): void /** * Reverse the migrations. * - * @throws \Exception - * @throws \Throwable + * @throws Exception + * @throws Throwable */ public function down(): void { diff --git a/database/migrations/2018_02_25_160152_remove_default_null_value_on_table.php b/database/migrations/2018_02_25_160152_remove_default_null_value_on_table.php index e432e56dd1..2db2f375ee 100644 --- a/database/migrations/2018_02_25_160152_remove_default_null_value_on_table.php +++ b/database/migrations/2018_02_25_160152_remove_default_null_value_on_table.php @@ -10,8 +10,8 @@ class RemoveDefaultNullValueOnTable extends Migration /** * Run the migrations. * - * @throws \Exception - * @throws \Throwable + * @throws Exception + * @throws Throwable */ public function up(): void { diff --git a/database/migrations/2020_04_10_141024_store_node_tokens_as_encrypted_value.php b/database/migrations/2020_04_10_141024_store_node_tokens_as_encrypted_value.php index a69dafc895..2e750dfa21 100644 --- a/database/migrations/2020_04_10_141024_store_node_tokens_as_encrypted_value.php +++ b/database/migrations/2020_04_10_141024_store_node_tokens_as_encrypted_value.php @@ -13,7 +13,7 @@ class StoreNodeTokensAsEncryptedValue extends Migration /** * Run the migrations. * - * @throws \Exception + * @throws Exception */ public function up(): void { @@ -32,7 +32,7 @@ public function up(): void $table->text('daemon_token')->change(); }); - /** @var \Illuminate\Contracts\Encryption\Encrypter $encrypter */ + /** @var Encrypter $encrypter */ $encrypter = Container::getInstance()->make(Encrypter::class); foreach (DB::select('SELECT id, daemon_token FROM nodes') as $datum) { @@ -56,7 +56,7 @@ public function up(): void public function down(): void { DB::transaction(function () { - /** @var \Illuminate\Contracts\Encryption\Encrypter $encrypter */ + /** @var Encrypter $encrypter */ $encrypter = Container::getInstance()->make(Encrypter::class); foreach (DB::select('SELECT id, daemon_token_id, daemon_token FROM nodes') as $datum) { diff --git a/tests/Assertions/AssertsActivityLogged.php b/tests/Assertions/AssertsActivityLogged.php index 7c3232418c..7bf990d5d3 100644 --- a/tests/Assertions/AssertsActivityLogged.php +++ b/tests/Assertions/AssertsActivityLogged.php @@ -11,7 +11,7 @@ trait AssertsActivityLogged { /** - * @param \Illuminate\Database\Eloquent\Model|array $subjects + * @param Model|array $subjects */ public function assertActivityFor(string $event, ?Model $actor, ...$subjects): void { diff --git a/tests/Integration/Api/Client/AccountControllerTest.php b/tests/Integration/Api/Client/AccountControllerTest.php index 0fe1813a3e..5edac86e70 100644 --- a/tests/Integration/Api/Client/AccountControllerTest.php +++ b/tests/Integration/Api/Client/AccountControllerTest.php @@ -14,7 +14,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase */ public function testAccountDetailsAreReturned() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); $response = $this->actingAs($user)->get('/api/client/account'); @@ -38,7 +38,7 @@ public function testAccountDetailsAreReturned() */ public function testEmailIsUpdated() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); $response = $this->actingAs($user)->putJson('/api/client/account/email', [ @@ -57,7 +57,7 @@ public function testEmailIsUpdated() */ public function testEmailIsNotUpdatedWhenPasswordIsInvalid() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); $response = $this->actingAs($user)->putJson('/api/client/account/email', [ @@ -76,7 +76,7 @@ public function testEmailIsNotUpdatedWhenPasswordIsInvalid() */ public function testEmailIsNotUpdatedWhenNotValid() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); $response = $this->actingAs($user)->putJson('/api/client/account/email', [ @@ -103,7 +103,7 @@ public function testEmailIsNotUpdatedWhenNotValid() */ public function testPasswordIsUpdated() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); $initialHash = $user->password; @@ -129,7 +129,7 @@ public function testPasswordIsUpdated() */ public function testPasswordIsNotUpdatedIfCurrentPasswordIsInvalid() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); $response = $this->actingAs($user)->putJson('/api/client/account/password', [ @@ -172,7 +172,7 @@ public function testErrorIsReturnedForInvalidRequestData() */ public function testErrorIsReturnedIfPasswordIsNotConfirmed() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); $response = $this->actingAs($user)->putJson('/api/client/account/password', [ diff --git a/tests/Integration/Api/Client/ApiKeyControllerTest.php b/tests/Integration/Api/Client/ApiKeyControllerTest.php index fe662caf8f..6017a72b29 100644 --- a/tests/Integration/Api/Client/ApiKeyControllerTest.php +++ b/tests/Integration/Api/Client/ApiKeyControllerTest.php @@ -25,9 +25,9 @@ protected function tearDown(): void */ public function testApiKeysAreReturned() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); - /** @var \Pterodactyl\Models\ApiKey $key */ + /** @var ApiKey $key */ $key = ApiKey::factory()->for($user)->create([ 'key_type' => ApiKey::TYPE_ACCOUNT, ]); @@ -48,7 +48,7 @@ public function testApiKeysAreReturned() #[\PHPUnit\Framework\Attributes\DataProvider('validIPAddressDataProvider')] public function testApiKeyCanBeCreatedForAccount(array $data) { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); // Small subtest to ensure we're always comparing the number of keys to the @@ -66,7 +66,7 @@ public function testApiKeyCanBeCreatedForAccount(array $data) ->assertOk() ->assertJsonPath('object', ApiKey::RESOURCE_NAME); - /** @var \Pterodactyl\Models\ApiKey $key */ + /** @var ApiKey $key */ $key = ApiKey::query()->where('identifier', $response->json('attributes.identifier'))->firstOrFail(); $this->assertJsonTransformedWith($response->json('attributes'), $key); @@ -103,7 +103,7 @@ public function testApiKeyCannotSpecifyMoreThanFiftyIps() */ public function testApiKeyLimitIsApplied() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); ApiKey::factory()->times(25)->for($user)->create([ 'key_type' => ApiKey::TYPE_ACCOUNT, @@ -144,9 +144,9 @@ public function testValidationErrorIsReturnedForBadRequests() ->assertJsonPath('errors.0.detail', 'The description may not be greater than 500 characters.'); $this->postJson('/api/client/account/api-keys', [ - 'description' => 'Foobar', - 'allowed_ips' => ['hodor', '127.0.0.1', 'hodor/24'], - ]) + 'description' => 'Foobar', + 'allowed_ips' => ['hodor', '127.0.0.1', 'hodor/24'], + ]) ->assertUnprocessable() ->assertJsonPath('errors.0.detail', '"hodor" is not a valid IP address or CIDR range.') ->assertJsonPath('errors.0.meta.source_field', 'allowed_ips.0') @@ -159,9 +159,9 @@ public function testValidationErrorIsReturnedForBadRequests() */ public function testApiKeyCanBeDeleted() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); - /** @var \Pterodactyl\Models\ApiKey $key */ + /** @var ApiKey $key */ $key = ApiKey::factory()->for($user)->create([ 'key_type' => ApiKey::TYPE_ACCOUNT, ]); @@ -178,9 +178,9 @@ public function testApiKeyCanBeDeleted() */ public function testNonExistentApiKeyDeletionReturns404Error() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); - /** @var \Pterodactyl\Models\ApiKey $key */ + /** @var ApiKey $key */ $key = ApiKey::factory()->create([ 'user_id' => $user->id, 'key_type' => ApiKey::TYPE_ACCOUNT, @@ -199,11 +199,11 @@ public function testNonExistentApiKeyDeletionReturns404Error() */ public function testApiKeyBelongingToAnotherUserCannotBeDeleted() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); - /** @var \Pterodactyl\Models\User $user2 */ + /** @var User $user2 */ $user2 = User::factory()->create(); - /** @var \Pterodactyl\Models\ApiKey $key */ + /** @var ApiKey $key */ $key = ApiKey::factory()->for($user2)->create([ 'key_type' => ApiKey::TYPE_ACCOUNT, ]); @@ -222,9 +222,9 @@ public function testApiKeyBelongingToAnotherUserCannotBeDeleted() */ public function testApplicationApiKeyCannotBeDeleted() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); - /** @var \Pterodactyl\Models\ApiKey $key */ + /** @var ApiKey $key */ $key = ApiKey::factory()->for($user)->create([ 'key_type' => ApiKey::TYPE_APPLICATION, ]); diff --git a/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php b/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php index 954010c1d0..d7ceb34a22 100644 --- a/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php +++ b/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php @@ -55,7 +55,7 @@ protected function createTestResponse($response, $request) /** * Returns a link to the specific resource using the client API. */ - protected function link(mixed $model, string $append = null): string + protected function link(mixed $model, ?string $append = null): string { switch (get_class($model)) { case Server::class: diff --git a/tests/Integration/Api/Client/ClientControllerTest.php b/tests/Integration/Api/Client/ClientControllerTest.php index dd6e98dc9f..954ca6f53b 100644 --- a/tests/Integration/Api/Client/ClientControllerTest.php +++ b/tests/Integration/Api/Client/ClientControllerTest.php @@ -101,8 +101,8 @@ public function testServersAreFilteredUsingNameAndUuidInformation() */ public function testServersAreFilteredUsingAllocationInformation() { - /** @var \Pterodactyl\Models\User $user */ - /** @var \Pterodactyl\Models\Server $server */ + /** @var User $user */ + /** @var Server $server */ [$user, $server] = $this->generateTestAccount(); $server2 = $this->createServerModel(['user_id' => $user->id, 'node_id' => $server->node_id]); @@ -203,7 +203,7 @@ public function testFilterOnlyOwnerServers() */ public function testPermissionsAreReturned() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); $this->actingAs($user) @@ -308,7 +308,7 @@ public function testNoServersAreReturnedIfAdminFilterIsPassedByRegularUser(strin */ public function testOnlyPrimaryAllocationIsReturnedToSubuser() { - /** @var \Pterodactyl\Models\Server $server */ + /** @var Server $server */ [$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]); $server->allocation->notes = 'Test notes'; $server->allocation->save(); diff --git a/tests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.php b/tests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.php index d50e10190b..f6bd466e63 100644 --- a/tests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.php +++ b/tests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.php @@ -20,7 +20,7 @@ public function testAllocationCanBeDeletedFromServer(array $permission) [$user, $server] = $this->generateTestAccount($permission); $server->update(['allocation_limit' => 2]); - /** @var \Pterodactyl\Models\Allocation $allocation */ + /** @var Allocation $allocation */ $allocation = Allocation::factory()->create([ 'server_id' => $server->id, 'node_id' => $server->node_id, @@ -40,7 +40,7 @@ public function testErrorIsReturnedIfUserDoesNotHavePermission() /** @var \Pterodactyl\Models\Server $server */ [$user, $server] = $this->generateTestAccount([Permission::ACTION_ALLOCATION_CREATE]); - /** @var \Pterodactyl\Models\Allocation $allocation */ + /** @var Allocation $allocation */ $allocation = Allocation::factory()->create([ 'server_id' => $server->id, 'node_id' => $server->node_id, @@ -72,7 +72,7 @@ public function testAllocationCannotBeDeletedIfServerLimitIsNotDefined() { [$user, $server] = $this->generateTestAccount(); - /** @var \Pterodactyl\Models\Allocation $allocation */ + /** @var Allocation $allocation */ $allocation = Allocation::factory()->forServer($server)->create(['notes' => 'Test notes']); $this->actingAs($user)->deleteJson($this->link($allocation)) diff --git a/tests/Integration/Api/Client/Server/Backup/DeleteBackupTest.php b/tests/Integration/Api/Client/Server/Backup/DeleteBackupTest.php index 5c4d53e496..d6aea997d6 100644 --- a/tests/Integration/Api/Client/Server/Backup/DeleteBackupTest.php +++ b/tests/Integration/Api/Client/Server/Backup/DeleteBackupTest.php @@ -43,7 +43,7 @@ public function testBackupCanBeDeleted() [$user, $server] = $this->generateTestAccount([Permission::ACTION_BACKUP_DELETE]); - /** @var \Pterodactyl\Models\Backup $backup */ + /** @var Backup $backup */ $backup = Backup::factory()->create(['server_id' => $server->id]); $this->repository->expects('setServer->delete')->with( diff --git a/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php index 868741e3a8..26ab866e05 100644 --- a/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php @@ -31,7 +31,7 @@ public function testScheduleCanBeCreatedForServer(array $permissions) $this->assertNotNull($id = $response->json('attributes.id')); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::query()->findOrFail($id); $this->assertFalse($schedule->is_active); $this->assertFalse($schedule->is_processing); diff --git a/tests/Integration/Api/Client/Server/Schedule/ExecuteScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/ExecuteScheduleTest.php index cb21fd2d04..eafcf3c05a 100644 --- a/tests/Integration/Api/Client/Server/Schedule/ExecuteScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/ExecuteScheduleTest.php @@ -22,7 +22,7 @@ public function testScheduleIsExecutedRightAway(array $permissions) Bus::fake(); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create([ 'server_id' => $server->id, ]); @@ -32,7 +32,7 @@ public function testScheduleIsExecutedRightAway(array $permissions) $response->assertJsonPath('errors.0.code', 'DisplayException'); $response->assertJsonPath('errors.0.detail', 'Cannot process schedule for task execution: no tasks are registered.'); - /** @var \Pterodactyl\Models\Task $task */ + /** @var Task $task */ $task = Task::factory()->create([ 'schedule_id' => $schedule->id, 'sequence_id' => 1, @@ -57,7 +57,7 @@ public function testUserWithoutScheduleUpdatePermissionCannotExecute() { [$user, $server] = $this->generateTestAccount([Permission::ACTION_SCHEDULE_CREATE]); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create(['server_id' => $server->id]); $this->actingAs($user)->postJson($this->link($schedule, '/execute'))->assertForbidden(); diff --git a/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php b/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php index c88186c5b4..cc5db4139c 100644 --- a/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php @@ -28,9 +28,9 @@ public function testServerSchedulesAreReturned(array $permissions, bool $individ { [$user, $server] = $this->generateTestAccount($permissions); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create(['server_id' => $server->id]); - /** @var \Pterodactyl\Models\Task $task */ + /** @var Task $task */ $task = Task::factory()->create(['schedule_id' => $schedule->id, 'sequence_id' => 1, 'time_offset' => 0]); $response = $this->actingAs($user) diff --git a/tests/Integration/Api/Client/Server/Schedule/UpdateServerScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/UpdateServerScheduleTest.php index c5a70f320b..6b6ad10917 100644 --- a/tests/Integration/Api/Client/Server/Schedule/UpdateServerScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/UpdateServerScheduleTest.php @@ -30,7 +30,7 @@ public function testScheduleCanBeUpdated(array $permissions) { [$user, $server] = $this->generateTestAccount($permissions); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create(['server_id' => $server->id]); $expected = Utilities::getScheduleNextRunDate('5', '*', '*', '*', '*'); @@ -88,7 +88,7 @@ public function testScheduleIsProcessingIsSetToFalseWhenActiveStateChanges() { [$user, $server] = $this->generateTestAccount(); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create([ 'server_id' => $server->id, 'is_active' => true, diff --git a/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php b/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php index 05646495fe..c2d047a2b3 100644 --- a/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php +++ b/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php @@ -18,7 +18,7 @@ public function testTaskCanBeCreated(array $permissions) { [$user, $server] = $this->generateTestAccount($permissions); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create(['server_id' => $server->id]); $this->assertEmpty($schedule->tasks); @@ -30,7 +30,7 @@ public function testTaskCanBeCreated(array $permissions) ]); $response->assertOk(); - /** @var \Pterodactyl\Models\Task $task */ + /** @var Task $task */ $task = Task::query()->findOrFail($response->json('attributes.id')); $this->assertSame($schedule->id, $task->schedule_id); @@ -48,7 +48,7 @@ public function testValidationErrorsAreReturned() { [$user, $server] = $this->generateTestAccount(); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create(['server_id' => $server->id]); $response = $this->actingAs($user)->postJson($this->link($schedule, '/tasks'))->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY); @@ -93,7 +93,7 @@ public function testBackupsCanNotBeTaskedIfLimit0() { [$user, $server] = $this->generateTestAccount(); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create(['server_id' => $server->id]); $this->actingAs($user)->postJson($this->link($schedule, '/tasks'), [ @@ -122,7 +122,7 @@ public function testErrorIsReturnedIfTooManyTasksExistForSchedule() [$user, $server] = $this->generateTestAccount(); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create(['server_id' => $server->id]); Task::factory()->times(2)->create(['schedule_id' => $schedule->id]); @@ -145,7 +145,7 @@ public function testErrorIsReturnedIfScheduleDoesNotBelongToServer() [$user, $server] = $this->generateTestAccount(); $server2 = $this->createServerModel(['owner_id' => $user->id]); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create(['server_id' => $server2->id]); $this->actingAs($user) @@ -161,7 +161,7 @@ public function testErrorIsReturnedIfSubuserDoesNotHaveScheduleUpdatePermissions { [$user, $server] = $this->generateTestAccount([Permission::ACTION_SCHEDULE_CREATE]); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create(['server_id' => $server->id]); $this->actingAs($user) diff --git a/tests/Integration/Api/Client/Server/SettingsControllerTest.php b/tests/Integration/Api/Client/Server/SettingsControllerTest.php index d6b831f335..1497927cd1 100644 --- a/tests/Integration/Api/Client/Server/SettingsControllerTest.php +++ b/tests/Integration/Api/Client/Server/SettingsControllerTest.php @@ -16,7 +16,7 @@ class SettingsControllerTest extends ClientApiIntegrationTestCase #[\PHPUnit\Framework\Attributes\DataProvider('renamePermissionsDataProvider')] public function testServerNameCanBeChanged(array $permissions) { - /** @var \Pterodactyl\Models\Server $server */ + /** @var Server $server */ [$user, $server] = $this->generateTestAccount($permissions); $originalName = $server->name; $originalDescription = $server->description; @@ -71,7 +71,7 @@ public function testSubuserCannotChangeServerNameWithoutPermission() #[\PHPUnit\Framework\Attributes\DataProvider('reinstallPermissionsDataProvider')] public function testServerCanBeReinstalled(array $permissions) { - /** @var \Pterodactyl\Models\Server $server */ + /** @var Server $server */ [$user, $server] = $this->generateTestAccount($permissions); $this->assertTrue($server->isInstalled()); diff --git a/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php b/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php index 512a7721bb..12aef45e88 100644 --- a/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php @@ -31,7 +31,7 @@ public function testSubuserCanBeCreated(array $permissions) $response->assertOk(); - /** @var \Pterodactyl\Models\User $subuser */ + /** @var User $subuser */ $subuser = User::query()->where('email', $email)->firstOrFail(); $response->assertJsonPath('object', Subuser::RESOURCE_NAME); @@ -110,7 +110,7 @@ public function testCreatingSubuserWithSameEmailAsExistingUserWorks() { [$user, $server] = $this->generateTestAccount(); - /** @var \Pterodactyl\Models\User $existing */ + /** @var User $existing */ $existing = User::factory()->create(['email' => $this->faker->email]); $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ diff --git a/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php b/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php index 45753ea6cf..921e79fd12 100644 --- a/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php @@ -28,14 +28,14 @@ public function testCorrectSubuserIsDeletedFromServer() [$user, $server] = $this->generateTestAccount(); - /** @var \Pterodactyl\Models\User $differentUser */ + /** @var User $differentUser */ $differentUser = User::factory()->create(); $real = Uuid::uuid4()->toString(); // Generate a UUID that lines up with a user in the database if it were to be cast to an int. $uuid = $differentUser->id . substr($real, strlen((string) $differentUser->id)); - /** @var \Pterodactyl\Models\User $subuser */ + /** @var User $subuser */ $subuser = User::factory()->create(['uuid' => $uuid]); Subuser::query()->forceCreate([ @@ -51,7 +51,7 @@ public function testCorrectSubuserIsDeletedFromServer() // Try the same test, but this time with a UUID that if cast to an int (shouldn't) line up with // anything in the database. $uuid = '18180000' . substr(Uuid::uuid4()->toString(), 8); - /** @var \Pterodactyl\Models\User $subuser */ + /** @var User $subuser */ $subuser = User::factory()->create(['uuid' => $uuid]); Subuser::query()->forceCreate([ diff --git a/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php b/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php index 7b24b0022f..6d43df3b96 100644 --- a/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php @@ -16,7 +16,7 @@ class SubuserAuthorizationTest extends ClientApiIntegrationTestCase public function testUserCannotAccessResourceBelongingToOtherServers(string $method) { // Generic subuser, the specific resource we're trying to access. - /** @var \Pterodactyl\Models\User $internal */ + /** @var User $internal */ $internal = User::factory()->create(); // The API $user is the owner of $server1. diff --git a/tests/Integration/Api/Client/Server/Subuser/UpdateSubuserTest.php b/tests/Integration/Api/Client/Server/Subuser/UpdateSubuserTest.php index 5990b96188..58e48e2324 100644 --- a/tests/Integration/Api/Client/Server/Subuser/UpdateSubuserTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/UpdateSubuserTest.php @@ -57,7 +57,7 @@ public function testPermissionsAreSavedToAccount() { [$user, $server] = $this->generateTestAccount(); - /** @var \Pterodactyl\Models\Subuser $subuser */ + /** @var Subuser $subuser */ $subuser = Subuser::factory() ->for(User::factory()->create()) ->for($server) diff --git a/tests/Integration/Api/Client/TwoFactorControllerTest.php b/tests/Integration/Api/Client/TwoFactorControllerTest.php index 6cc086fc7e..4110420333 100644 --- a/tests/Integration/Api/Client/TwoFactorControllerTest.php +++ b/tests/Integration/Api/Client/TwoFactorControllerTest.php @@ -17,7 +17,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase */ public function testTwoFactorImageDataIsReturned() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(['use_totp' => false]); $this->assertFalse($user->use_totp); @@ -41,7 +41,7 @@ public function testTwoFactorImageDataIsReturned() */ public function testErrorIsReturnedWhenTwoFactorIsAlreadyEnabled() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(['use_totp' => true]); $response = $this->actingAs($user)->getJson('/api/client/account/two-factor'); @@ -56,7 +56,7 @@ public function testErrorIsReturnedWhenTwoFactorIsAlreadyEnabled() */ public function testValidationErrorIsReturnedIfInvalidDataIsPassedToEnabled2FA() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(['use_totp' => false]); $this->actingAs($user) @@ -73,7 +73,7 @@ public function testValidationErrorIsReturnedIfInvalidDataIsPassedToEnabled2FA() */ public function testTwoFactorCanBeEnabledOnAccount() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(['use_totp' => false]); // Make the initial call to get the account setup for 2FA. @@ -82,7 +82,7 @@ public function testTwoFactorCanBeEnabledOnAccount() $user = $user->refresh(); $this->assertNotNull($user->totp_secret); - /** @var \PragmaRX\Google2FA\Google2FA $service */ + /** @var Google2FA $service */ $service = $this->app->make(Google2FA::class); $secret = decrypt($user->totp_secret); @@ -129,7 +129,7 @@ public function testTwoFactorCanBeDisabledOnAccount() { Carbon::setTestNow(Carbon::now()); - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(['use_totp' => true]); $response = $this->actingAs($user)->deleteJson('/api/client/account/two-factor', [ @@ -160,7 +160,7 @@ public function testNoErrorIsReturnedIfTwoFactorIsNotEnabled() { Carbon::setTestNow(Carbon::now()); - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(['use_totp' => false]); $response = $this->actingAs($user)->deleteJson('/api/client/account/two-factor', [ diff --git a/tests/Integration/Api/Remote/SftpAuthenticationControllerTest.php b/tests/Integration/Api/Remote/SftpAuthenticationControllerTest.php index 7e8f1f208e..c793435d69 100644 --- a/tests/Integration/Api/Remote/SftpAuthenticationControllerTest.php +++ b/tests/Integration/Api/Remote/SftpAuthenticationControllerTest.php @@ -237,7 +237,7 @@ protected function getUsername(bool $long = false): string /** * Sets the authorization header for the rest of the test. */ - protected function setAuthorization(Node $node = null): void + protected function setAuthorization(?Node $node = null): void { $node = $node ?? $this->server->node; diff --git a/tests/Integration/Jobs/Schedule/RunTaskJobTest.php b/tests/Integration/Jobs/Schedule/RunTaskJobTest.php index 44ce77673f..907454a84a 100644 --- a/tests/Integration/Jobs/Schedule/RunTaskJobTest.php +++ b/tests/Integration/Jobs/Schedule/RunTaskJobTest.php @@ -25,14 +25,14 @@ public function testInactiveJobIsNotRun() { $server = $this->createServerModel(); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create([ 'server_id' => $server->id, 'is_processing' => true, 'last_run_at' => null, 'is_active' => false, ]); - /** @var \Pterodactyl\Models\Task $task */ + /** @var Task $task */ $task = Task::factory()->create(['schedule_id' => $schedule->id, 'is_queued' => true]); $job = new RunTaskJob($task); @@ -52,9 +52,9 @@ public function testJobWithInvalidActionThrowsException() { $server = $this->createServerModel(); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create(['server_id' => $server->id]); - /** @var \Pterodactyl\Models\Task $task */ + /** @var Task $task */ $task = Task::factory()->create(['schedule_id' => $schedule->id, 'action' => 'foobar']); $job = new RunTaskJob($task); @@ -69,14 +69,14 @@ public function testJobIsExecuted(bool $isManualRun) { $server = $this->createServerModel(); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create([ 'server_id' => $server->id, 'is_active' => !$isManualRun, 'is_processing' => true, 'last_run_at' => null, ]); - /** @var \Pterodactyl\Models\Task $task */ + /** @var Task $task */ $task = Task::factory()->create([ 'schedule_id' => $schedule->id, 'action' => Task::ACTION_POWER, @@ -108,9 +108,9 @@ public function testExceptionDuringRunIsHandledCorrectly(bool $continueOnFailure { $server = $this->createServerModel(); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create(['server_id' => $server->id]); - /** @var \Pterodactyl\Models\Task $task */ + /** @var Task $task */ $task = Task::factory()->create([ 'schedule_id' => $schedule->id, 'action' => Task::ACTION_POWER, diff --git a/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php b/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php index b6d842da8d..29c91f4633 100644 --- a/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php +++ b/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php @@ -36,13 +36,13 @@ public function testErrorDuringScheduleDataUpdateDoesNotPersistChanges() { $server = $this->createServerModel(); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create([ 'server_id' => $server->id, 'cron_minute' => 'hodor', // this will break the getNextRunDate() function. ]); - /** @var \Pterodactyl\Models\Task $task */ + /** @var Task $task */ $task = Task::factory()->create(['schedule_id' => $schedule->id, 'sequence_id' => 1]); $this->expectException(\InvalidArgumentException::class); @@ -63,10 +63,10 @@ public function testJobCanBeDispatchedWithExpectedInitialDelay(bool $now) $server = $this->createServerModel(); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create(['server_id' => $server->id]); - /** @var \Pterodactyl\Models\Task $task */ + /** @var Task $task */ $task = Task::factory()->create(['schedule_id' => $schedule->id, 'time_offset' => 10, 'sequence_id' => 1]); $this->getService()->handle($schedule, $now); @@ -95,10 +95,10 @@ public function testFirstSequenceTaskIsFound() Bus::fake(); $server = $this->createServerModel(); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create(['server_id' => $server->id]); - /** @var \Pterodactyl\Models\Task $task */ + /** @var Task $task */ $task2 = Task::factory()->create(['schedule_id' => $schedule->id, 'sequence_id' => 4]); $task = Task::factory()->create(['schedule_id' => $schedule->id, 'sequence_id' => 2]); $task3 = Task::factory()->create(['schedule_id' => $schedule->id, 'sequence_id' => 3]); @@ -126,9 +126,9 @@ public function testTaskDispatchedNowIsResetProperlyIfErrorIsEncountered() $this->swap(Dispatcher::class, $dispatcher = \Mockery::mock(Dispatcher::class)); $server = $this->createServerModel(); - /** @var \Pterodactyl\Models\Schedule $schedule */ + /** @var Schedule $schedule */ $schedule = Schedule::factory()->create(['server_id' => $server->id, 'last_run_at' => null]); - /** @var \Pterodactyl\Models\Task $task */ + /** @var Task $task */ $task = Task::factory()->create(['schedule_id' => $schedule->id, 'sequence_id' => 1]); $dispatcher->expects('dispatchNow')->andThrows(new \Exception('Test thrown exception')); diff --git a/tests/Integration/Services/Servers/BuildModificationServiceTest.php b/tests/Integration/Services/Servers/BuildModificationServiceTest.php index f63efee9ef..52d69685c2 100644 --- a/tests/Integration/Services/Servers/BuildModificationServiceTest.php +++ b/tests/Integration/Services/Servers/BuildModificationServiceTest.php @@ -168,7 +168,7 @@ public function testConnectionExceptionIsIgnoredWhenUpdatingServerSettings() public function testNoExceptionIsThrownIfOnlyRemovingAllocation() { $server = $this->createServerModel(); - /** @var \Pterodactyl\Models\Allocation $allocation */ + /** @var Allocation $allocation */ $allocation = Allocation::factory()->create(['node_id' => $server->node_id, 'server_id' => $server->id]); $this->daemonServerRepository->expects('setServer->sync')->andReturnUndefined(); @@ -191,7 +191,7 @@ public function testNoExceptionIsThrownIfOnlyRemovingAllocation() public function testAllocationInBothAddAndRemoveIsAdded() { $server = $this->createServerModel(); - /** @var \Pterodactyl\Models\Allocation $allocation */ + /** @var Allocation $allocation */ $allocation = Allocation::factory()->create(['node_id' => $server->node_id]); $this->daemonServerRepository->expects('setServer->sync')->andReturnUndefined(); @@ -210,9 +210,9 @@ public function testAllocationInBothAddAndRemoveIsAdded() public function testUsingSameAllocationIdMultipleTimesDoesNotError() { $server = $this->createServerModel(); - /** @var \Pterodactyl\Models\Allocation $allocation */ + /** @var Allocation $allocation */ $allocation = Allocation::factory()->create(['node_id' => $server->node_id, 'server_id' => $server->id]); - /** @var \Pterodactyl\Models\Allocation $allocation2 */ + /** @var Allocation $allocation2 */ $allocation2 = Allocation::factory()->create(['node_id' => $server->node_id]); $this->daemonServerRepository->expects('setServer->sync')->andReturnUndefined(); @@ -235,7 +235,7 @@ public function testUsingSameAllocationIdMultipleTimesDoesNotError() public function testThatUpdatesAreRolledBackIfExceptionIsEncountered() { $server = $this->createServerModel(); - /** @var \Pterodactyl\Models\Allocation $allocation */ + /** @var Allocation $allocation */ $allocation = Allocation::factory()->create(['node_id' => $server->node_id]); $this->daemonServerRepository->expects('setServer->sync')->andThrows(new DisplayException('Test')); diff --git a/tests/Integration/Services/Servers/ServerCreationServiceTest.php b/tests/Integration/Services/Servers/ServerCreationServiceTest.php index b6adb9b60d..e840bb30da 100644 --- a/tests/Integration/Services/Servers/ServerCreationServiceTest.php +++ b/tests/Integration/Services/Servers/ServerCreationServiceTest.php @@ -54,13 +54,13 @@ public function setUp(): void */ public function testServerIsCreatedWithDeploymentObject() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); - /** @var \Pterodactyl\Models\Location $location */ + /** @var Location $location */ $location = Location::factory()->create(); - /** @var \Pterodactyl\Models\Node $node */ + /** @var Node $node */ $node = Node::factory()->create([ 'location_id' => $location->id, ]); @@ -156,18 +156,18 @@ public function testServerIsCreatedWithDeploymentObject() */ public function testErrorEncounteredByWingsCausesServerToBeDeleted() { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); - /** @var \Pterodactyl\Models\Location $location */ + /** @var Location $location */ $location = Location::factory()->create(); - /** @var \Pterodactyl\Models\Node $node */ + /** @var Node $node */ $node = Node::factory()->create([ 'location_id' => $location->id, ]); - /** @var \Pterodactyl\Models\Allocation $allocation */ + /** @var Allocation $allocation */ $allocation = Allocation::factory()->create([ 'node_id' => $node->id, ]); diff --git a/tests/Integration/Services/Servers/ServerDeletionServiceTest.php b/tests/Integration/Services/Servers/ServerDeletionServiceTest.php index 676a60416b..1a1446467e 100644 --- a/tests/Integration/Services/Servers/ServerDeletionServiceTest.php +++ b/tests/Integration/Services/Servers/ServerDeletionServiceTest.php @@ -112,7 +112,7 @@ public function testExceptionWhileDeletingStopsProcess() $server = $this->createServerModel(); $host = DatabaseHost::factory()->create(); - /** @var \Pterodactyl\Models\Database $db */ + /** @var Database $db */ $db = Database::factory()->create(['database_host_id' => $host->id, 'server_id' => $server->id]); $server->refresh(); @@ -137,7 +137,7 @@ public function testExceptionWhileDeletingDatabasesDoesNotAbortIfForceDeleted() $server = $this->createServerModel(); $host = DatabaseHost::factory()->create(); - /** @var \Pterodactyl\Models\Database $db */ + /** @var Database $db */ $db = Database::factory()->create(['database_host_id' => $host->id, 'server_id' => $server->id]); $server->refresh(); diff --git a/tests/Integration/Services/Servers/StartupModificationServiceTest.php b/tests/Integration/Services/Servers/StartupModificationServiceTest.php index 0d310a9f11..4f9ae90f0d 100644 --- a/tests/Integration/Services/Servers/StartupModificationServiceTest.php +++ b/tests/Integration/Services/Servers/StartupModificationServiceTest.php @@ -37,7 +37,7 @@ public function testNonAdminCanModifyServerVariables() } catch (\Exception $exception) { $this->assertInstanceOf(ValidationException::class, $exception); - /** @var \Illuminate\Validation\ValidationException $exception */ + /** @var ValidationException $exception */ $errors = $exception->validator->errors()->toArray(); $this->assertCount(1, $errors); diff --git a/tests/Traits/Http/RequestMockHelpers.php b/tests/Traits/Http/RequestMockHelpers.php index aa3607e51a..54cc0bd078 100644 --- a/tests/Traits/Http/RequestMockHelpers.php +++ b/tests/Traits/Http/RequestMockHelpers.php @@ -27,7 +27,7 @@ public function setRequestMockClass(string $class): void /** * Configure the user model that the request mock should return with. */ - public function setRequestUserModel(User $user = null): void + public function setRequestUserModel(?User $user = null): void { $this->request->shouldReceive('user')->andReturn($user); } @@ -37,7 +37,7 @@ public function setRequestUserModel(User $user = null): void */ public function generateRequestUserModel(array $args = []): User { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->make($args); $this->setRequestUserModel($user); @@ -79,7 +79,7 @@ protected function buildRequestMock(): void * * @deprecated */ - protected function setRequestUser(User $user = null): User + protected function setRequestUser(?User $user = null): User { $user = $user instanceof User ? $user : User::factory()->make(); $this->request->shouldReceive('user')->withNoArgs()->andReturn($user); diff --git a/tests/Traits/Integration/CreatesTestModels.php b/tests/Traits/Integration/CreatesTestModels.php index 62245d72b9..a90de9f6cb 100644 --- a/tests/Traits/Integration/CreatesTestModels.php +++ b/tests/Traits/Integration/CreatesTestModels.php @@ -27,25 +27,25 @@ public function createServerModel(array $attributes = []): Server } if (!isset($attributes['owner_id'])) { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); $attributes['owner_id'] = $user->id; } if (!isset($attributes['node_id'])) { if (!isset($attributes['location_id'])) { - /** @var \Pterodactyl\Models\Location $location */ + /** @var Location $location */ $location = Location::factory()->create(); $attributes['location_id'] = $location->id; } - /** @var \Pterodactyl\Models\Node $node */ + /** @var Node $node */ $node = Node::factory()->create(['location_id' => $attributes['location_id']]); $attributes['node_id'] = $node->id; } if (!isset($attributes['allocation_id'])) { - /** @var \Pterodactyl\Models\Allocation $allocation */ + /** @var Allocation $allocation */ $allocation = Allocation::factory()->create(['node_id' => $attributes['node_id']]); $attributes['allocation_id'] = $allocation->id; } @@ -65,7 +65,7 @@ public function createServerModel(array $attributes = []): Server unset($attributes['user_id'], $attributes['location_id']); - /** @var \Pterodactyl\Models\Server $server */ + /** @var Server $server */ $server = Server::factory()->create($attributes); Allocation::query()->where('id', $server->allocation_id)->update(['server_id' => $server->id]); @@ -85,7 +85,7 @@ public function createServerModel(array $attributes = []): Server */ public function generateTestAccount(array $permissions = []): array { - /** @var \Pterodactyl\Models\User $user */ + /** @var User $user */ $user = User::factory()->create(); if (empty($permissions)) { @@ -113,7 +113,7 @@ protected function cloneEggAndVariables(Egg $egg): Egg $model->uuid = Uuid::uuid4()->toString(); $model->push(); - /** @var \Pterodactyl\Models\Egg $model */ + /** @var Egg $model */ $model = $model->fresh(); foreach ($egg->variables as $variable) { @@ -129,7 +129,7 @@ protected function cloneEggAndVariables(Egg $egg): Egg */ private function getBungeecordEgg(): Egg { - /** @var \Pterodactyl\Models\Egg $egg */ + /** @var Egg $egg */ $egg = Egg::query()->where('author', 'support@pterodactyl.io')->where('name', 'Bungeecord')->firstOrFail(); return $egg; diff --git a/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php b/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php index 4007935fe3..f3ff026c3f 100644 --- a/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php +++ b/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php @@ -84,7 +84,7 @@ public function testResponseShouldFailIfTokenIsNotValid() { $this->expectException(AccessDeniedHttpException::class); - /** @var \Pterodactyl\Models\Node $model */ + /** @var Node $model */ $model = Node::factory()->make(); $this->request->expects('route->getName')->withNoArgs()->andReturn('random.route'); @@ -117,7 +117,7 @@ public function testResponseShouldFailIfNodeIsNotFound() */ public function testSuccessfulMiddlewareProcess() { - /** @var \Pterodactyl\Models\Node $model */ + /** @var Node $model */ $model = Node::factory()->make(); $this->request->expects('route->getName')->withNoArgs()->andReturn('random.route');