diff --git a/app/Console/Commands/Environment/AppSettingsCommand.php b/app/Console/Commands/Environment/AppSettingsCommand.php index 2746d1a4f..ecb1ac3df 100644 --- a/app/Console/Commands/Environment/AppSettingsCommand.php +++ b/app/Console/Commands/Environment/AppSettingsCommand.php @@ -50,6 +50,11 @@ class AppSettingsCommand extends Command */ protected $config; + /** + * @var \Illuminate\Validation\Factory + */ + protected $validator; + /** * @var string */ diff --git a/app/Events/Server/Installed.php b/app/Events/Server/Installed.php index 81b6963bc..e1e8cf5c6 100644 --- a/app/Events/Server/Installed.php +++ b/app/Events/Server/Installed.php @@ -17,8 +17,6 @@ class Installed extends Event /** * Create a new event instance. - * - * @var \Pterodactyl\Models\Server */ public function __construct(Server $server) { diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index c22198f98..2ebadf4f6 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -36,7 +36,7 @@ class Handler extends ExceptionHandler /** * A list of the exception types that should not be reported. * - * @var array + * @var string[] */ protected $dontReport = [ AuthenticationException::class, @@ -51,7 +51,7 @@ class Handler extends ExceptionHandler /** * A list of the inputs that are never flashed for validation exceptions. * - * @var array + * @var string[] */ protected $dontFlash = [ 'token', diff --git a/app/Http/Controllers/Api/Application/Nodes/NodeController.php b/app/Http/Controllers/Api/Application/Nodes/NodeController.php index 5d9dc5b91..ac4b06a74 100644 --- a/app/Http/Controllers/Api/Application/Nodes/NodeController.php +++ b/app/Http/Controllers/Api/Application/Nodes/NodeController.php @@ -9,7 +9,6 @@ use Spatie\QueryBuilder\QueryBuilder; use Pterodactyl\Services\Nodes\NodeUpdateService; use Pterodactyl\Services\Nodes\NodeCreationService; use Pterodactyl\Services\Nodes\NodeDeletionService; -use Pterodactyl\Contracts\Repository\NodeRepositoryInterface; use Pterodactyl\Transformers\Api\Application\NodeTransformer; use Pterodactyl\Exceptions\Http\QueryValueOutOfRangeHttpException; use Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodeRequest; @@ -21,7 +20,6 @@ use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController; class NodeController extends ApplicationApiController { - private NodeRepositoryInterface $repository; private NodeCreationService $creationService; private NodeDeletionService $deletionService; private NodeUpdateService $updateService; @@ -30,14 +28,12 @@ class NodeController extends ApplicationApiController * NodeController constructor. */ public function __construct( - NodeRepositoryInterface $repository, NodeCreationService $creationService, NodeDeletionService $deletionService, NodeUpdateService $updateService ) { parent::__construct(); - $this->repository = $repository; $this->creationService = $creationService; $this->deletionService = $deletionService; $this->updateService = $updateService; diff --git a/app/Http/Controllers/Api/Application/Servers/DatabaseController.php b/app/Http/Controllers/Api/Application/Servers/DatabaseController.php index b6b71659d..5ea3f28dc 100644 --- a/app/Http/Controllers/Api/Application/Servers/DatabaseController.php +++ b/app/Http/Controllers/Api/Application/Servers/DatabaseController.php @@ -8,7 +8,6 @@ use Pterodactyl\Models\Database; use Illuminate\Http\JsonResponse; use Pterodactyl\Services\Databases\DatabasePasswordService; use Pterodactyl\Services\Databases\DatabaseManagementService; -use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface; use Pterodactyl\Transformers\Api\Application\ServerDatabaseTransformer; use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController; use Pterodactyl\Http\Requests\Api\Application\Servers\Databases\GetServerDatabaseRequest; @@ -20,21 +19,18 @@ class DatabaseController extends ApplicationApiController { private DatabaseManagementService $databaseManagementService; private DatabasePasswordService $databasePasswordService; - private DatabaseRepositoryInterface $repository; /** * DatabaseController constructor. */ public function __construct( DatabaseManagementService $databaseManagementService, - DatabasePasswordService $databasePasswordService, - DatabaseRepositoryInterface $repository + DatabasePasswordService $databasePasswordService ) { parent::__construct(); $this->databaseManagementService = $databaseManagementService; $this->databasePasswordService = $databasePasswordService; - $this->repository = $repository; } /** diff --git a/app/Http/Controllers/Api/Application/Users/UserController.php b/app/Http/Controllers/Api/Application/Users/UserController.php index 44e765d4c..2b0d20508 100644 --- a/app/Http/Controllers/Api/Application/Users/UserController.php +++ b/app/Http/Controllers/Api/Application/Users/UserController.php @@ -9,7 +9,6 @@ use Spatie\QueryBuilder\QueryBuilder; use Pterodactyl\Services\Users\UserUpdateService; use Pterodactyl\Services\Users\UserCreationService; use Pterodactyl\Services\Users\UserDeletionService; -use Pterodactyl\Contracts\Repository\UserRepositoryInterface; use Pterodactyl\Transformers\Api\Application\UserTransformer; use Pterodactyl\Exceptions\Http\QueryValueOutOfRangeHttpException; use Pterodactyl\Http\Requests\Api\Application\Users\GetUserRequest; @@ -21,7 +20,6 @@ use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController; class UserController extends ApplicationApiController { - private UserRepositoryInterface $repository; private UserCreationService $creationService; private UserDeletionService $deletionService; private UserUpdateService $updateService; @@ -30,14 +28,12 @@ class UserController extends ApplicationApiController * UserController constructor. */ public function __construct( - UserRepositoryInterface $repository, UserCreationService $creationService, UserDeletionService $deletionService, UserUpdateService $updateService ) { parent::__construct(); - $this->repository = $repository; $this->creationService = $creationService; $this->deletionService = $deletionService; $this->updateService = $updateService; diff --git a/app/Http/Controllers/Api/Client/ClientController.php b/app/Http/Controllers/Api/Client/ClientController.php index caf99e2f1..b06e17f44 100644 --- a/app/Http/Controllers/Api/Client/ClientController.php +++ b/app/Http/Controllers/Api/Client/ClientController.php @@ -7,24 +7,11 @@ use Pterodactyl\Models\Permission; use Spatie\QueryBuilder\QueryBuilder; use Spatie\QueryBuilder\AllowedFilter; use Pterodactyl\Models\Filters\MultiFieldServerFilter; -use Pterodactyl\Repositories\Eloquent\ServerRepository; use Pterodactyl\Transformers\Api\Client\ServerTransformer; use Pterodactyl\Http\Requests\Api\Client\GetServersRequest; class ClientController extends ClientApiController { - private ServerRepository $repository; - - /** - * ClientController constructor. - */ - public function __construct(ServerRepository $repository) - { - parent::__construct(); - - $this->repository = $repository; - } - /** * Return all of the servers available to the client making the API * request, including servers the user has access to as a subuser. diff --git a/app/Http/Controllers/Api/Client/Servers/DatabaseController.php b/app/Http/Controllers/Api/Client/Servers/DatabaseController.php index 2b5258fbd..6ebfd8ea0 100644 --- a/app/Http/Controllers/Api/Client/Servers/DatabaseController.php +++ b/app/Http/Controllers/Api/Client/Servers/DatabaseController.php @@ -5,7 +5,6 @@ namespace Pterodactyl\Http\Controllers\Api\Client\Servers; use Illuminate\Http\Response; use Pterodactyl\Models\Server; use Pterodactyl\Models\Database; -use Pterodactyl\Repositories\Eloquent\DatabaseRepository; use Pterodactyl\Services\Databases\DatabasePasswordService; use Pterodactyl\Transformers\Api\Client\DatabaseTransformer; use Pterodactyl\Services\Databases\DatabaseManagementService; @@ -19,7 +18,6 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\Databases\RotatePasswordRequest class DatabaseController extends ClientApiController { private DeployServerDatabaseService $deployDatabaseService; - private DatabaseRepository $repository; private DatabaseManagementService $managementService; private DatabasePasswordService $passwordService; @@ -29,13 +27,11 @@ class DatabaseController extends ClientApiController public function __construct( DatabaseManagementService $managementService, DatabasePasswordService $passwordService, - DatabaseRepository $repository, DeployServerDatabaseService $deployDatabaseService ) { parent::__construct(); $this->deployDatabaseService = $deployDatabaseService; - $this->repository = $repository; $this->managementService = $managementService; $this->passwordService = $passwordService; } diff --git a/app/Http/Controllers/Api/Client/Servers/FileController.php b/app/Http/Controllers/Api/Client/Servers/FileController.php index f1bdadc5e..e5ec4ff7c 100644 --- a/app/Http/Controllers/Api/Client/Servers/FileController.php +++ b/app/Http/Controllers/Api/Client/Servers/FileController.php @@ -7,7 +7,6 @@ use Illuminate\Http\Response; use Pterodactyl\Models\Server; use Pterodactyl\Models\AuditLog; use Pterodactyl\Services\Nodes\NodeJWTService; -use Illuminate\Contracts\Routing\ResponseFactory; use Pterodactyl\Repositories\Wings\DaemonFileRepository; use Pterodactyl\Transformers\Daemon\FileObjectTransformer; use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; @@ -26,7 +25,6 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\Files\WriteFileContentRequest; class FileController extends ClientApiController { private DaemonFileRepository $fileRepository; - private ResponseFactory $responseFactory; private NodeJWTService $jwtService; /** @@ -34,13 +32,11 @@ class FileController extends ClientApiController */ public function __construct( DaemonFileRepository $fileRepository, - ResponseFactory $responseFactory, NodeJWTService $jwtService ) { parent::__construct(); $this->fileRepository = $fileRepository; - $this->responseFactory = $responseFactory; $this->jwtService = $jwtService; } diff --git a/app/Http/Controllers/Api/Client/Servers/ServerController.php b/app/Http/Controllers/Api/Client/Servers/ServerController.php index 7c1e17e03..278ca526e 100644 --- a/app/Http/Controllers/Api/Client/Servers/ServerController.php +++ b/app/Http/Controllers/Api/Client/Servers/ServerController.php @@ -3,7 +3,6 @@ namespace Pterodactyl\Http\Controllers\Api\Client\Servers; use Pterodactyl\Models\Server; -use Pterodactyl\Repositories\Eloquent\SubuserRepository; use Pterodactyl\Transformers\Api\Client\ServerTransformer; use Pterodactyl\Services\Servers\GetUserPermissionsService; use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; @@ -11,17 +10,15 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\GetServerRequest; class ServerController extends ClientApiController { - private SubuserRepository $repository; private GetUserPermissionsService $permissionsService; /** * ServerController constructor. */ - public function __construct(GetUserPermissionsService $permissionsService, SubuserRepository $repository) + public function __construct(GetUserPermissionsService $permissionsService) { parent::__construct(); - $this->repository = $repository; $this->permissionsService = $permissionsService; } diff --git a/app/Http/Controllers/Api/Client/Servers/StartupController.php b/app/Http/Controllers/Api/Client/Servers/StartupController.php index f9328264d..aaf592a72 100644 --- a/app/Http/Controllers/Api/Client/Servers/StartupController.php +++ b/app/Http/Controllers/Api/Client/Servers/StartupController.php @@ -4,7 +4,6 @@ namespace Pterodactyl\Http\Controllers\Api\Client\Servers; use Pterodactyl\Models\Server; use Pterodactyl\Services\Servers\StartupCommandService; -use Pterodactyl\Services\Servers\VariableValidatorService; use Pterodactyl\Repositories\Eloquent\ServerVariableRepository; use Pterodactyl\Transformers\Api\Client\EggVariableTransformer; use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; @@ -14,18 +13,16 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\Startup\UpdateStartupVariableRe class StartupController extends ClientApiController { - private VariableValidatorService $service; private ServerVariableRepository $repository; private StartupCommandService $startupCommandService; /** * StartupController constructor. */ - public function __construct(VariableValidatorService $service, StartupCommandService $startupCommandService, ServerVariableRepository $repository) + public function __construct(StartupCommandService $startupCommandService, ServerVariableRepository $repository) { parent::__construct(); - $this->service = $service; $this->repository = $repository; $this->startupCommandService = $startupCommandService; } diff --git a/app/Services/Eggs/EggConfigurationService.php b/app/Services/Eggs/EggConfigurationService.php index ebe119c1f..9af5bf0a9 100644 --- a/app/Services/Eggs/EggConfigurationService.php +++ b/app/Services/Eggs/EggConfigurationService.php @@ -88,7 +88,7 @@ class EggConfigurationService /** * @return array */ - protected function replacePlaceholders(Server $server, object $configs) + protected function replacePlaceholders(Server $server, iterable $configs) { // Get the legacy configuration structure for the server so that we // can property map the egg placeholders to values. @@ -112,6 +112,7 @@ class EggConfigurationService foreach ($this->iterate($data->find, $structure) as $find => $replace) { if (is_object($replace)) { + // @phpstan-ignore-next-line foreach ($replace as $match => $replaceWith) { $append['replace'][] = [ 'match' => $find, @@ -205,7 +206,6 @@ class EggConfigurationService // Replace anything starting with "server." with the value out of the server configuration // array that used to be created for the old daemon. if (Str::startsWith($key, 'server.')) { - // @phpstan-ignore-next-line $plucked = Arr::get($structure, preg_replace('/^server\./', '', $key), ''); $value = str_replace("{{{$key}}}", $plucked, $value); @@ -216,7 +216,6 @@ class EggConfigurationService // variable from the server configuration. $plucked = Arr::get( $structure, - // @phpstan-ignore-next-line preg_replace('/^env\./', 'build.env.', $key), '' ); diff --git a/app/Services/Helpers/AssetHashService.php b/app/Services/Helpers/AssetHashService.php index 4b1bf7e0b..ac77aec4f 100644 --- a/app/Services/Helpers/AssetHashService.php +++ b/app/Services/Helpers/AssetHashService.php @@ -4,7 +4,6 @@ namespace Pterodactyl\Services\Helpers; use Illuminate\Support\Arr; use Illuminate\Filesystem\FilesystemManager; -use Illuminate\Contracts\Foundation\Application; class AssetHashService { @@ -18,11 +17,6 @@ class AssetHashService */ private $filesystem; - /** - * @var \Illuminate\Contracts\Foundation\Application - */ - private $application; - /** * @var array|null */ @@ -31,9 +25,8 @@ class AssetHashService /** * AssetHashService constructor. */ - public function __construct(Application $application, FilesystemManager $filesystem) + public function __construct(FilesystemManager $filesystem) { - $this->application = $application; $this->filesystem = $filesystem->createLocalDriver(['root' => public_path()]); } diff --git a/app/Services/Servers/ServerCreationService.php b/app/Services/Servers/ServerCreationService.php index 48fa8cc33..ad67d7144 100644 --- a/app/Services/Servers/ServerCreationService.php +++ b/app/Services/Servers/ServerCreationService.php @@ -12,7 +12,6 @@ use Illuminate\Support\Collection; use Pterodactyl\Models\Allocation; use Illuminate\Database\ConnectionInterface; use Pterodactyl\Models\Objects\DeploymentObject; -use Pterodactyl\Repositories\Eloquent\EggRepository; use Pterodactyl\Repositories\Eloquent\ServerRepository; use Pterodactyl\Repositories\Wings\DaemonServerRepository; use Pterodactyl\Services\Deployment\FindViableNodesService; @@ -26,12 +25,7 @@ class ServerCreationService * @var \Pterodactyl\Services\Deployment\AllocationSelectionService */ private $allocationSelectionService; - - /** - * @var \Pterodactyl\Services\Servers\ServerConfigurationStructureService - */ - private $configurationStructureService; - + /** * @var \Illuminate\Database\ConnectionInterface */ @@ -47,11 +41,6 @@ class ServerCreationService */ private $validatorService; - /** - * @var \Pterodactyl\Repositories\Eloquent\EggRepository - */ - private $eggRepository; - /** * @var \Pterodactyl\Repositories\Eloquent\ServerRepository */ @@ -74,29 +63,21 @@ class ServerCreationService /** * CreationService constructor. - * - * @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService - * @param \Pterodactyl\Services\Servers\ServerDeletionService $serverDeletionService - * @param \Pterodactyl\Services\Servers\VariableValidatorService $validatorService */ public function __construct( AllocationSelectionService $allocationSelectionService, ConnectionInterface $connection, DaemonServerRepository $daemonServerRepository, - EggRepository $eggRepository, FindViableNodesService $findViableNodesService, - ServerConfigurationStructureService $configurationStructureService, ServerDeletionService $serverDeletionService, ServerRepository $repository, ServerVariableRepository $serverVariableRepository, VariableValidatorService $validatorService ) { $this->allocationSelectionService = $allocationSelectionService; - $this->configurationStructureService = $configurationStructureService; $this->connection = $connection; $this->findViableNodesService = $findViableNodesService; $this->validatorService = $validatorService; - $this->eggRepository = $eggRepository; $this->repository = $repository; $this->serverVariableRepository = $serverVariableRepository; $this->daemonServerRepository = $daemonServerRepository; diff --git a/app/Services/Servers/SuspensionService.php b/app/Services/Servers/SuspensionService.php index 27bc622f5..60bae5415 100644 --- a/app/Services/Servers/SuspensionService.php +++ b/app/Services/Servers/SuspensionService.php @@ -4,7 +4,6 @@ namespace Pterodactyl\Services\Servers; use Webmozart\Assert\Assert; use Pterodactyl\Models\Server; -use Illuminate\Database\ConnectionInterface; use Pterodactyl\Repositories\Wings\DaemonServerRepository; use Symfony\Component\HttpKernel\Exception\ConflictHttpException; @@ -12,12 +11,7 @@ class SuspensionService { public const ACTION_SUSPEND = 'suspend'; public const ACTION_UNSUSPEND = 'unsuspend'; - - /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - + /** * @var \Pterodactyl\Repositories\Wings\DaemonServerRepository */ @@ -26,11 +20,7 @@ class SuspensionService /** * SuspensionService constructor. */ - public function __construct( - ConnectionInterface $connection, - DaemonServerRepository $daemonServerRepository - ) { - $this->connection = $connection; + public function __construct(DaemonServerRepository $daemonServerRepository) { $this->daemonServerRepository = $daemonServerRepository; } diff --git a/app/Transformers/Daemon/FileObjectTransformer.php b/app/Transformers/Daemon/FileObjectTransformer.php index 1ad86dce8..bb308fbf6 100644 --- a/app/Transformers/Daemon/FileObjectTransformer.php +++ b/app/Transformers/Daemon/FileObjectTransformer.php @@ -7,13 +7,6 @@ use Illuminate\Support\Arr; class FileObjectTransformer extends BaseDaemonTransformer { - /** - * An array of files we allow editing in the Panel. - * - * @var array - */ - private $editable = []; - /** * Transform a file object response from the daemon into a standardized response. * diff --git a/composer.json b/composer.json index 99c244f66..6598ff983 100644 --- a/composer.json +++ b/composer.json @@ -54,7 +54,8 @@ "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^5.11.0", "nunomaduro/larastan": "^1.0.3", - "php-mock/php-mock-phpunit": "^2.6", + "php-mock/php-mock-phpunit": "^2.6.0", + "phpstan/phpstan": "^1.4.6", "phpstan/phpstan-webmozart-assert": "^1.0.9", "phpunit/phpunit": "^9.5.13" }, diff --git a/composer.lock b/composer.lock index 7b5cda8c9..a79310d4e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3b6af4c08168510289a6fb0f60c91888", + "content-hash": "4c3e8a8b296bf2d9fc55ccf75c0bec6c", "packages": [ { "name": "aws/aws-crt-php", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index c26650da5..4af299b0c 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,10 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Parameter \\#1 \\$string of function strtoupper expects string, int\\|string given\\.$#" - count: 1 - path: app/Console/Commands/Environment/AppSettingsCommand.php - - message: "#^Parameter \\#2 \\$subject of function preg_match_all expects string, string\\|false\\|null given\\.$#" count: 1 @@ -15,11 +10,6 @@ parameters: count: 1 path: app/Console/Commands/Environment/AppSettingsCommand.php - - - message: "#^Parameter \\#1 \\$string of function strtoupper expects string, int\\|string given\\.$#" - count: 1 - path: app/Console/Commands/Environment/DatabaseSettingsCommand.php - - message: "#^Parameter \\#2 \\$subject of function preg_match_all expects string, string\\|false\\|null given\\.$#" count: 1 @@ -30,11 +20,6 @@ parameters: count: 1 path: app/Console/Commands/Environment/DatabaseSettingsCommand.php - - - message: "#^Parameter \\#1 \\$string of function strtoupper expects string, int\\|string given\\.$#" - count: 1 - path: app/Console/Commands/Environment/EmailSettingsCommand.php - - message: "#^Parameter \\#1 \\$value of function studly_case expects string, array\\|bool\\|string given\\.$#" count: 1 @@ -56,12 +41,12 @@ parameters: path: app/Console/Commands/Server/BulkPowerActionCommand.php - - message: "#^Parameter \\#2 \\$string of function explode expects string, array\\|bool\\|string given\\.$#" + message: "#^Parameter \\#2 \\$string of function explode expects string, array\\|string\\|true given\\.$#" count: 2 path: app/Console/Commands/Server/BulkPowerActionCommand.php - - message: "#^Binary operation \"\\.\" between 'download/v' and array\\|bool\\|string\\|null results in an error\\.$#" + message: "#^Binary operation \"\\.\" between 'download/v' and non\\-empty\\-array\\|non\\-empty\\-string\\|true results in an error\\.$#" count: 1 path: app/Console/Commands/UpgradeCommand.php @@ -71,7 +56,7 @@ parameters: path: app/Console/Commands/UpgradeCommand.php - - message: "#^Method Pterodactyl\\\\Console\\\\Commands\\\\UpgradeCommand\\:\\:getUrl\\(\\) should return string but returns array\\|bool\\|string\\|null\\.$#" + message: "#^Method Pterodactyl\\\\Console\\\\Commands\\\\UpgradeCommand\\:\\:getUrl\\(\\) should return string but returns array\\|string\\|true\\.$#" count: 1 path: app/Console/Commands/UpgradeCommand.php @@ -86,17 +71,7 @@ parameters: path: app/Console/Commands/UpgradeCommand.php - - message: "#^Binary operation \"\\.\" between array\\|string and '\\.' results in an error\\.$#" - count: 1 - path: app/Exceptions/Handler.php - - - - message: "#^Possibly invalid array key type array\\|string\\.$#" - count: 1 - path: app/Exceptions/Handler.php - - - - message: "#^Unable to resolve the template type TReturn in call to method Illuminate\\\\Support\\\\Collection\\\\>\\:\\:flatMap\\(\\)$#" + message: "#^Unable to resolve the template type TReturn in call to method Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\),array\\\\>\\:\\:flatMap\\(\\)$#" count: 1 path: app/Exceptions/Handler.php @@ -105,11 +80,6 @@ parameters: count: 1 path: app/Extensions/Backups/BackupManager.php - - - message: "#^Parameter \\#1 \\$message of static method Illuminate\\\\Log\\\\Logger\\:\\:info\\(\\) expects string, string\\|false given\\.$#" - count: 2 - path: app/Http/Controllers/Api/Application/Eggs/EggController.php - - message: "#^Parameter \\#2 \\$content of method Pterodactyl\\\\Services\\\\Eggs\\\\Sharing\\\\EggImporterService\\:\\:handleContent\\(\\) expects string, resource\\|string given\\.$#" count: 1 @@ -125,56 +95,326 @@ parameters: count: 1 path: app/Http/Controllers/Api/Client/Servers/FileController.php + - + message: "#^Access to an undefined property Pterodactyl\\\\Models\\\\EggVariable\\:\\:\\$server_value\\.$#" + count: 1 + path: app/Http/Controllers/Api/Client/Servers/StartupController.php + + - + message: "#^Property Pterodactyl\\\\Http\\\\Controllers\\\\Api\\\\Remote\\\\Backups\\\\BackupRemoteUploadController\\:\\:\\$repository is never read, only written\\.$#" + count: 1 + path: app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php + + - + message: "#^Property Pterodactyl\\\\Http\\\\Controllers\\\\Api\\\\Remote\\\\Servers\\\\ServerTransferController\\:\\:\\$configurationStructureService is never read, only written\\.$#" + count: 1 + path: app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php + + - + message: "#^Offset 'server' on array\\{username\\: string, server\\: non\\-empty\\-string\\} on left side of \\?\\? always exists and is not nullable\\.$#" + count: 1 + path: app/Http/Controllers/Api/Remote/SftpAuthenticationController.php + + - + message: "#^Cannot call method named\\(\\) on object\\|string\\.$#" + count: 2 + path: app/Http/Controllers/Auth/AbstractLoginController.php + + - + message: "#^Expression on left side of \\?\\? is not nullable\\.$#" + count: 1 + path: app/Http/Controllers/Auth/LoginCheckpointController.php + + - + message: "#^Variable \\$user might not be defined\\.$#" + count: 1 + path: app/Http/Controllers/Auth/LoginCheckpointController.php + - message: "#^Parameter \\#1 \\$string of function md5 expects string, string\\|false given\\.$#" count: 1 path: app/Http/Controllers/Base/LocaleController.php - - message: "#^Parameter \\#1 \\$key of method Illuminate\\\\Routing\\\\Router\\:\\:bind\\(\\) expects string, int\\|string given\\.$#" + message: "#^Parameter \\#1 \\$route of method Illuminate\\\\Contracts\\\\Routing\\\\Registrar\\:\\:substituteImplicitBindings\\(\\) expects Illuminate\\\\Routing\\\\Route, object\\|string\\|null given\\.$#" count: 1 path: app/Http/Middleware/Api/Application/SubstituteApplicationApiBindings.php + - + message: "#^Result of && is always false\\.$#" + count: 1 + path: app/Http/Middleware/Api/Application/SubstituteApplicationApiBindings.php + + - + message: "#^Variable \\$route in empty\\(\\) is never defined\\.$#" + count: 1 + path: app/Http/Middleware/Api/Application/SubstituteApplicationApiBindings.php + + - + message: "#^Property Pterodactyl\\\\Http\\\\Middleware\\\\Api\\\\Client\\\\Server\\\\AuthenticateServerAccess\\:\\:\\$repository is never read, only written\\.$#" + count: 1 + path: app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php + + - + message: "#^Cannot call method parameters\\(\\) on object\\|string\\.$#" + count: 1 + path: app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php + + - + message: "#^Parameter \\#1 \\$route of method Illuminate\\\\Contracts\\\\Routing\\\\Registrar\\:\\:substituteBindings\\(\\) expects Illuminate\\\\Routing\\\\Route, object\\|string\\|null given\\.$#" + count: 1 + path: app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php + + - + message: "#^Result of && is always false\\.$#" + count: 1 + path: app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php + + - + message: "#^Variable \\$route in empty\\(\\) is never defined\\.$#" + count: 1 + path: app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php + + - + message: "#^Cannot call method getName\\(\\) on object\\|string\\.$#" + count: 1 + path: app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php + - message: "#^Parameter \\#1 \\$json of function json_decode expects string, resource\\|string given\\.$#" count: 1 path: app/Http/Middleware/Api/IsValidJson.php + - + message: "#^Cannot call method parameters\\(\\) on object\\|string\\.$#" + count: 1 + path: app/Http/Middleware/Api/PreventUnboundModels.php + + - + message: "#^Cannot call method signatureParameters\\(\\) on object\\|string\\.$#" + count: 1 + path: app/Http/Middleware/Api/PreventUnboundModels.php + + - + message: "#^Cannot call method getName\\(\\) on object\\|string\\.$#" + count: 1 + path: app/Http/Middleware/RequireTwoFactorAuthentication.php + - message: "#^Parameter \\#1 \\$array of function array_get expects array\\|ArrayAccess, array\\\\|false given\\.$#" count: 1 path: app/Http/Middleware/VerifyReCaptcha.php - - message: "#^Parameter \\#1 \\$value of function snake_case expects string, int\\|string given\\.$#" - count: 1 - path: app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php - - - - message: "#^Method Pterodactyl\\\\Jobs\\\\Schedule\\\\RunTaskJob\\:\\:__construct\\(\\) has parameter \\$manualRun with no typehint specified\\.$#" + message: "#^Method Pterodactyl\\\\Jobs\\\\Schedule\\\\RunTaskJob\\:\\:__construct\\(\\) has parameter \\$manualRun with no type specified\\.$#" count: 1 path: app/Jobs/Schedule/RunTaskJob.php - - message: "#^Parameter \\#2 \\$column of static method Illuminate\\\\Validation\\\\Rule\\:\\:unique\\(\\) expects string, int\\|string given\\.$#" + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\AdminRole\\:\\:\\$fillable is not covariant with PHPDoc type array\\ of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$fillable\\.$#" count: 1 - path: app/Models/Model.php + path: app/Models/AdminRole.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\Allocation\\:\\:\\$guarded is not covariant with PHPDoc type array\\\\|bool of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$guarded\\.$#" + count: 1 + path: app/Models/Allocation.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\Database\\:\\:\\$fillable is not covariant with PHPDoc type array\\ of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$fillable\\.$#" + count: 1 + path: app/Models/Database.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\DatabaseHost\\:\\:\\$fillable is not covariant with PHPDoc type array\\ of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$fillable\\.$#" + count: 1 + path: app/Models/DatabaseHost.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\Egg\\:\\:\\$fillable is not covariant with PHPDoc type array\\ of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$fillable\\.$#" + count: 1 + path: app/Models/Egg.php + + - + message: "#^PHPDoc type null of property Pterodactyl\\\\Models\\\\EggMount\\:\\:\\$primaryKey is not covariant with PHPDoc type string of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$primaryKey\\.$#" + count: 1 + path: app/Models/EggMount.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\EggVariable\\:\\:\\$guarded is not covariant with PHPDoc type array\\\\|bool of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$guarded\\.$#" + count: 1 + path: app/Models/EggVariable.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\Location\\:\\:\\$guarded is not covariant with PHPDoc type array\\\\|bool of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$guarded\\.$#" + count: 1 + path: app/Models/Location.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\Mount\\:\\:\\$guarded is not covariant with PHPDoc type array\\\\|bool of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$guarded\\.$#" + count: 1 + path: app/Models/Mount.php + + - + message: "#^PHPDoc type null of property Pterodactyl\\\\Models\\\\MountNode\\:\\:\\$primaryKey is not covariant with PHPDoc type string of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$primaryKey\\.$#" + count: 1 + path: app/Models/MountNode.php + + - + message: "#^PHPDoc type null of property Pterodactyl\\\\Models\\\\MountServer\\:\\:\\$primaryKey is not covariant with PHPDoc type string of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$primaryKey\\.$#" + count: 1 + path: app/Models/MountServer.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\Nest\\:\\:\\$fillable is not covariant with PHPDoc type array\\ of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$fillable\\.$#" + count: 1 + path: app/Models/Nest.php - message: "#^Method Pterodactyl\\\\Models\\\\Node\\:\\:getJsonConfiguration\\(\\) should return string but returns string\\|false\\.$#" count: 1 path: app/Models/Node.php + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\Node\\:\\:\\$fillable is not covariant with PHPDoc type array\\ of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$fillable\\.$#" + count: 1 + path: app/Models/Node.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\Permission\\:\\:\\$guarded is not covariant with PHPDoc type array\\\\|bool of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$guarded\\.$#" + count: 1 + path: app/Models/Permission.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\Schedule\\:\\:\\$fillable is not covariant with PHPDoc type array\\ of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$fillable\\.$#" + count: 1 + path: app/Models/Schedule.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\Server\\:\\:\\$guarded is not covariant with PHPDoc type array\\\\|bool of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$guarded\\.$#" + count: 1 + path: app/Models/Server.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\ServerTransfer\\:\\:\\$guarded is not covariant with PHPDoc type array\\\\|bool of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$guarded\\.$#" + count: 1 + path: app/Models/ServerTransfer.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\Setting\\:\\:\\$fillable is not covariant with PHPDoc type array\\ of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$fillable\\.$#" + count: 1 + path: app/Models/Setting.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\Subuser\\:\\:\\$guarded is not covariant with PHPDoc type array\\\\|bool of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$guarded\\.$#" + count: 1 + path: app/Models/Subuser.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\Task\\:\\:\\$fillable is not covariant with PHPDoc type array\\ of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$fillable\\.$#" + count: 1 + path: app/Models/Task.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\TaskLog\\:\\:\\$guarded is not covariant with PHPDoc type array\\\\|bool of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$guarded\\.$#" + count: 1 + path: app/Models/TaskLog.php + + - + message: "#^PHPDoc type array of property Pterodactyl\\\\Models\\\\User\\:\\:\\$fillable is not covariant with PHPDoc type array\\ of overridden property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$fillable\\.$#" + count: 1 + path: app/Models/User.php + + - + message: "#^Access to an undefined property object\\:\\:\\$name\\.$#" + count: 1 + path: app/Notifications/AddedToServer.php + + - + message: "#^Access to an undefined property object\\:\\:\\$uuidShort\\.$#" + count: 1 + path: app/Notifications/AddedToServer.php + + - + message: "#^Access to an undefined property object\\:\\:\\$name\\.$#" + count: 1 + path: app/Notifications/RemovedFromServer.php + + - + message: "#^Property Pterodactyl\\\\Observers\\\\UserObserver\\:\\:\\$uuid has no type specified\\.$#" + count: 1 + path: app/Observers/UserObserver.php + + - + message: "#^Cannot access offset 'config' on Illuminate\\\\Contracts\\\\Foundation\\\\Application\\.$#" + count: 1 + path: app/Providers/HashidsServiceProvider.php + + - + message: "#^Cannot call method named\\(\\) on object\\|string\\.$#" + count: 1 + path: app/Providers/RouteServiceProvider.php + - message: "#^Method Pterodactyl\\\\Repositories\\\\Eloquent\\\\EloquentRepository\\:\\:updateOrCreate\\(\\) should return Illuminate\\\\Database\\\\Eloquent\\\\Model but returns bool\\|Illuminate\\\\Database\\\\Eloquent\\\\Model\\.$#" count: 1 path: app/Repositories/Eloquent/EloquentRepository.php - - message: "#^Parameter \\#1 \\.\\.\\.\\$model of method Pterodactyl\\\\Repositories\\\\Repository\\:\\:initializeModel\\(\\) expects class\\-string\\, mixed given\\.$#" + message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$sum_disk\\.$#" + count: 2 + path: app/Repositories/Eloquent/NodeRepository.php + + - + message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$sum_memory\\.$#" + count: 2 + path: app/Repositories/Eloquent/NodeRepository.php + + - + message: "#^Method Pterodactyl\\\\Repositories\\\\Eloquent\\\\NodeRepository\\:\\:getNodeWithResourceUsage\\(\\) should return Pterodactyl\\\\Models\\\\Node but returns Illuminate\\\\Database\\\\Eloquent\\\\Model\\|null\\.$#" + count: 1 + path: app/Repositories/Eloquent/NodeRepository.php + + - + message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$value\\.$#" + count: 1 + path: app/Repositories/Eloquent/SettingsRepository.php + + - + message: "#^Method Pterodactyl\\\\Repositories\\\\Eloquent\\\\SubuserRepository\\:\\:getWithPermissionsUsingUserAndServer\\(\\) should return Pterodactyl\\\\Models\\\\Subuser but returns Illuminate\\\\Database\\\\Eloquent\\\\Model\\.$#" + count: 1 + path: app/Repositories/Eloquent/SubuserRepository.php + + - + message: "#^Method Pterodactyl\\\\Repositories\\\\Eloquent\\\\TaskRepository\\:\\:getNextTask\\(\\) should return Pterodactyl\\\\Models\\\\Task\\|null but returns Illuminate\\\\Database\\\\Eloquent\\\\Model\\|null\\.$#" + count: 1 + path: app/Repositories/Eloquent/TaskRepository.php + + - + message: "#^Parameter \\#1 \\.\\.\\.\\$model of method Pterodactyl\\\\Repositories\\\\Repository\\:\\:initializeModel\\(\\) expects class\\-string\\, object\\|string given\\.$#" count: 1 path: app/Repositories/Repository.php + - + message: "#^Expression on left side of \\?\\? is not nullable\\.$#" + count: 1 + path: app/Repositories/Wings/DaemonFileRepository.php + + - + message: "#^Dead catch \\- Exception is never thrown in the try block\\.$#" + count: 1 + path: app/Services/Databases/DatabaseManagementService.php + + - + message: "#^Argument of an invalid type iterable\\|object supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: app/Services/Eggs/EggConfigurationService.php + + - + message: "#^Cannot clone non\\-object variable \\$data of type iterable\\|object\\.$#" + count: 1 + path: app/Services/Eggs/EggConfigurationService.php + - message: "#^Parameter \\#2 \\$content of method Pterodactyl\\\\Services\\\\Eggs\\\\Sharing\\\\EggImporterService\\:\\:handleContent\\(\\) expects string, string\\|false given\\.$#" count: 1 @@ -185,16 +425,6 @@ parameters: count: 1 path: app/Services/Eggs/Sharing/EggUpdateImporterService.php - - - message: "#^Parameter \\#1 \\$value of static method Illuminate\\\\Support\\\\Str\\:\\:snake\\(\\) expects string, array\\|string given\\.$#" - count: 1 - path: app/Services/Eggs/Variables/VariableCreationService.php - - - - message: "#^Parameter \\#1 \\$value of static method Illuminate\\\\Support\\\\Str\\:\\:snake\\(\\) expects string, array\\|string given\\.$#" - count: 1 - path: app/Services/Eggs/Variables/VariableUpdateService.php - - message: "#^Parameter \\#1 \\$string of function substr expects string, string\\|false given\\.$#" count: 1 @@ -205,21 +435,6 @@ parameters: count: 1 path: app/Services/Helpers/SoftwareVersionService.php - - - message: "#^Parameter \\#1 \\$id of method Lcobucci\\\\JWT\\\\Builder\\:\\:identifiedBy\\(\\) expects string, string\\|false given\\.$#" - count: 1 - path: app/Services/Nodes/NodeJWTService.php - - - - message: "#^Parameter \\#1 \\$name of method Lcobucci\\\\JWT\\\\Builder\\:\\:withClaim\\(\\) expects string, int\\|string given\\.$#" - count: 1 - path: app/Services/Nodes/NodeJWTService.php - - - - message: "#^Parameter \\#1 \\$key of method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:setAttribute\\(\\) expects string, int\\|string given\\.$#" - count: 1 - path: app/Services/Servers/ServerConfigurationStructureService.php - - message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Collection\\\\|Pterodactyl\\\\Models\\\\Allocation\\:\\:\\$node_id\\.$#" count: 1 @@ -235,11 +450,6 @@ parameters: count: 1 path: app/Services/Subusers/SubuserCreationService.php - - - message: "#^Parameter \\#1 \\$string of function urlencode expects string, array\\|string\\|null given\\.$#" - count: 1 - path: app/Services/Users/TwoFactorSetupService.php - - message: "#^Cannot call method getResourceName\\(\\) on \\(callable&class\\-string\\)\\|\\(callable&object\\)\\|League\\\\Fractal\\\\TransformerAbstract\\.$#" count: 2 diff --git a/phpstan.neon b/phpstan.neon index 3fb3a5bb3..7c03ca607 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -9,7 +9,8 @@ parameters: - database/Seeders level: 7 ignoreErrors: - - '#Unsafe usage of new static#' - - '#has no return typehint specified.#' - - '#has no typehint specified.#' + - "#Unsafe usage of new static#" + - "#has no return type specified\\.#" + # Just ignore this entirey, causes a lot of noise for minimal gain on the requests. + - "#^Cannot call method parameter\\(\\) on object\\|string\\.$#" checkMissingIterableValueType: false