chore: add phpstan static analysis minimum (#4511)

This commit is contained in:
Lance Pioch 2022-11-28 11:56:03 -05:00 committed by GitHub
parent 3f7e2a565f
commit a1a52754ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
67 changed files with 561 additions and 279 deletions

View file

@ -12,7 +12,10 @@ class LocationFormRequest extends AdminFormRequest
public function rules(): array
{
if ($this->method() === 'PATCH') {
return Location::getRulesForUpdate($this->route()->parameter('location')->id);
/** @var Location $location */
$location = $this->route()->parameter('location');
return Location::getRulesForUpdate($location->id);
}
return Location::getRules();

View file

@ -12,7 +12,10 @@ class MountFormRequest extends AdminFormRequest
public function rules(): array
{
if ($this->method() === 'PATCH') {
return Mount::getRulesForUpdate($this->route()->parameter('mount')->id);
/** @var Mount $mount */
$mount = $this->route()->parameter('mount');
return Mount::getRulesForUpdate($mount->id);
}
return Mount::getRules();

View file

@ -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
{
@ -42,6 +42,7 @@ abstract class ApplicationApiRequest extends FormRequest
return true;
}
/** @var ApiKey $token */
if ($token->key_type === ApiKey::TYPE_ACCOUNT) {
return true;
}
@ -81,6 +82,7 @@ abstract class ApplicationApiRequest extends FormRequest
*/
public function parameter(string $key, string $expect)
{
/** @var ApiKey $value */
$value = $this->route()->parameter($key);
Assert::isInstanceOf($value, $expect);

View file

@ -11,7 +11,9 @@ class UpdateLocationRequest extends StoreLocationRequest
*/
public function rules(): array
{
$locationId = $this->route()->parameter('location')->id;
/** @var Location $location */
$location = $this->route()->parameter('location');
$locationId = $location->id;
return collect(Location::getRulesForUpdate($locationId))->only([
'short',

View file

@ -12,8 +12,9 @@ class UpdateNodeRequest extends StoreNodeRequest
*/
public function rules(array $rules = null): array
{
$node = $this->route()->parameter('node')->id;
/** @var Node $node */
$node = $this->route()->parameter('node');
return parent::rules(Node::getRulesForUpdate($node));
return parent::rules(Node::getRulesForUpdate($node->id));
}
}

View file

@ -21,6 +21,7 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest
*/
public function rules(): array
{
/** @var Server $server */
$server = $this->route()->parameter('server');
return [
@ -67,6 +68,7 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest
*/
public function databaseName(): string
{
/** @var Server $server */
$server = $this->route()->parameter('server');
Assert::isInstanceOf($server, Server::class);

View file

@ -21,6 +21,7 @@ class StoreDatabaseRequest extends ClientApiRequest implements ClientPermissions
public function rules(): array
{
/** @var Server $server */
$server = $this->route()->parameter('server');
Assert::isInstanceOf($server, Server::class);

View file

@ -63,7 +63,6 @@ abstract class SubuserRequest extends ClientApiRequest
// 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 */
$service = $this->container->make(GetUserPermissionsService::class);