From ebcffb884208ecf3f17acdba28e131e8f5347d3a Mon Sep 17 00:00:00 2001 From: Samuel Levy Date: Fri, 1 Sep 2023 16:38:51 +1000 Subject: [PATCH] Removed some excess stuff from composer/phpstan --- composer.json | 1 - .../Spatie/Permissions/Exceptions.stub | 16 --- phpstan-stubs/Spatie/Permissions/Models.stub | 120 ------------------ .../LaravelAdjacencyList/Eloquent.stub | 76 ----------- .../LaravelAdjacencyList/Relations.stub | 48 ------- phpstan.neon | 9 -- 6 files changed, 270 deletions(-) delete mode 100644 phpstan-stubs/Spatie/Permissions/Exceptions.stub delete mode 100644 phpstan-stubs/Spatie/Permissions/Models.stub delete mode 100644 phpstan-stubs/Staudenmeir/LaravelAdjacencyList/Eloquent.stub delete mode 100644 phpstan-stubs/Staudenmeir/LaravelAdjacencyList/Relations.stub diff --git a/composer.json b/composer.json index e5f10dd..742e914 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,6 @@ "laravel/pint": "^1.12", "squizlabs/php_codesniffer": "^3.7", "nunomaduro/larastan": "^2.6", - "archtechx/enums": "^0.3.2", "orchestra/testbench": "^8.10" } } diff --git a/phpstan-stubs/Spatie/Permissions/Exceptions.stub b/phpstan-stubs/Spatie/Permissions/Exceptions.stub deleted file mode 100644 index 1c1a120..0000000 --- a/phpstan-stubs/Spatie/Permissions/Exceptions.stub +++ /dev/null @@ -1,16 +0,0 @@ - $roles - * @property-read int|null $roles_count - */ -abstract class Permission extends Model -{ - /** - * A permission can be applied to roles. - * - * @return BelongsToMany - */ - public function roles(): BelongsToMany; - - /** - * Find a permission by its name. - * - * @param string $name - * @param string|null $guardName - * @return Permission - * - * @throws PermissionDoesNotExist - */ - public static function findByName(string $name, $guardName): self; - - /** - * Find a permission by its id. - * - * @param int $id - * @param string|null $guardName - * @return Permission - * - * @throws PermissionDoesNotExist - */ - public static function findById(int $id, $guardName): self; - - /** - * Find or Create a permission by its name and guard name. - * - * @param string $name - * @param string|null $guardName - * @return Permission - */ - public static function findOrCreate(string $name, $guardName): self; -} - - -/** - * @property int $id - * @property string $name - * @property string $guard_name - * @property Carbon|null $created_at - * @property Carbon|null $updated_at - * @property-read Collection $permissions - * @property-read int|null $permissions_count - */ -abstract class Role extends Model -{ - /** - * A role may be given various permissions. - * - * @return BelongsToMany - */ - public function permissions(): BelongsToMany; - - /** - * Find a role by its name and guard name. - * - * @param string $name - * @param string|null $guardName - * @return Role - * - * @throws RoleDoesNotExist - */ - public static function findByName(string $name, $guardName): self; - - /** - * Find a role by its id and guard name. - * - * @param int $id - * @param string|null $guardName - * @return Role - * - * @throws RoleDoesNotExist - */ - public static function findById(int $id, $guardName): self; - - /** - * Find or create a role by its name and guard name. - * - * @param string $name - * @param string|null $guardName - * @return Role - */ - public static function findOrCreate(string $name, $guardName): self; - - /** - * Determine if the user may perform the given permission. - * - * @param string|Permission $permission - * @return bool - */ - public function hasPermissionTo($permission): bool; -} \ No newline at end of file diff --git a/phpstan-stubs/Staudenmeir/LaravelAdjacencyList/Eloquent.stub b/phpstan-stubs/Staudenmeir/LaravelAdjacencyList/Eloquent.stub deleted file mode 100644 index 7152996..0000000 --- a/phpstan-stubs/Staudenmeir/LaravelAdjacencyList/Eloquent.stub +++ /dev/null @@ -1,76 +0,0 @@ - - */ -abstract class Collection extends BaseCollection { - /** - * @param string $childrenRelation - * @return Collection - */ - abstract public function toTree($childrenRelation = 'children'); -} - -/** - * @property-read int|null $depth - * @property-read string|null $path - * @property-read Collection $ancestors - * @property-read int|null $ancestors_count - * @property-read Collection $children - * @property-read int|null $children_count - * @property-read Collection $descendants - * @property-read int|null $descendants_count - * @property-read Collection $siblings - * @property-read int|null $siblings_count - * @property-read static|null $parent - * @property-read static|null $rootAncestor - * @method static Builder ancestors() - * @method static Builder children() - * @method static Builder descendants() - * @method static Builder siblings() - * @method static Builder breadthFirst() - * @method static Builder depthFirst() - * @method static Builder getExpressionGrammar() - * @method static Builder hasChildren() - * @method static Builder hasParent() - * @method static Builder isLeaf() - * @method static Builder isRoot() - * @method static Builder newModelQuery() - * @method static Builder newQuery() - * @method static Builder query() - * @method static Builder tree($maxDepth = null) - * @method static Builder treeOf(callable $constraint, $maxDepth = null) - * @method static Builder whereDepth($operator, $value = null) - * @method static Builder withGlobalScopes(array $scopes) - * @mixin \Eloquent - */ -trait HasRecursiveRelationships {} diff --git a/phpstan-stubs/Staudenmeir/LaravelAdjacencyList/Relations.stub b/phpstan-stubs/Staudenmeir/LaravelAdjacencyList/Relations.stub deleted file mode 100644 index bbc49d5..0000000 --- a/phpstan-stubs/Staudenmeir/LaravelAdjacencyList/Relations.stub +++ /dev/null @@ -1,48 +0,0 @@ - - * @mixin Builder - */ -class Ancestors extends HasMany {} - -/** - * @template TRelatedModel of Model - * - * @extends HasMany - * @mixin Builder - */ -class Descendants extends HasMany {} - -/** - * @template TRelatedModel of Model - * - * @extends Descendants - * @mixin Builder - */ -class Bloodline extends Descendants {} - -/** - * @template TRelatedModel of Model - * - * @extends HasMany - * @mixin Builder - */ -class Siblings extends HasMany {} - -/** - * @template TRelatedModel of Model - * - * @extends HasOne - * @mixin Builder - */ -class RootAncestor extends HasOne {} diff --git a/phpstan.neon b/phpstan.neon index aa578ef..3bf76ca 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,14 +1,9 @@ includes: - ./vendor/nunomaduro/larastan/extension.neon - - ./vendor/archtechx/enums/extension.neon parameters: paths: - src - stubFiles: - - phpstan-stubs/Spatie/Permissions/Models.stub - - phpstan-stubs/Spatie/Permissions/Exceptions.stub - - phpstan-stubs/Staudenmeir/LaravelAdjacencyList/Relations.stub # The level 9 is the highest level level: 6 @@ -16,8 +11,4 @@ parameters: checkMissingIterableValueType: false checkGenericClassInNonGenericObjectType: false - # Handle some custom returns that PHP stan can't cope with - earlyTerminatingMethodCalls: - App\Actions\Fortify\AttemptToAuthenticate: - - throwFailedAuthenticationException