From a7a10115baab6b8d2e5de775eca5ad0fd254efca Mon Sep 17 00:00:00 2001 From: rotimi Date: Tue, 13 Apr 2021 21:33:01 -0600 Subject: [PATCH] Rector tweaks --- ...enericPermissionableEntitiesCollection.php | 23 +++++++++---------- src/GenericPermissionsCollection.php | 19 ++++++++------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/GenericPermissionableEntitiesCollection.php b/src/GenericPermissionableEntitiesCollection.php index 0b8582a..7c76032 100644 --- a/src/GenericPermissionableEntitiesCollection.php +++ b/src/GenericPermissionableEntitiesCollection.php @@ -46,11 +46,11 @@ public function has(PermissionableEntityInterface $entity): bool { * Adds an instance of PermissionableEntityInterface to an instance of this class * * @param PermissionableEntityInterface $permissionEntity - * @psalm-suppress MethodSignatureMismatch * + * @noRector \Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector * @return $this */ - public function add(PermissionableEntityInterface $permissionEntity): self { + public function add(PermissionableEntityInterface $permissionEntity): PermissionableEntitiesCollectionInterface { if( !$this->has($permissionEntity) ) { @@ -87,11 +87,11 @@ public function getKey(PermissionableEntityInterface $entity) { * Removes an instance of PermissionableEntityInterface from an instance of this class. * * @param PermissionableEntityInterface $permissionEntity - * @psalm-suppress MethodSignatureMismatch * + * @noRector \Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector * @return $this */ - public function remove(PermissionableEntityInterface $permissionEntity): self { + public function remove(PermissionableEntityInterface $permissionEntity): PermissionableEntitiesCollectionInterface { $key = $this->getKey($permissionEntity); @@ -105,11 +105,10 @@ public function remove(PermissionableEntityInterface $permissionEntity): self { /** * Remove all items in the collection and return $this * - * @psalm-suppress MethodSignatureMismatch - * + * @noRector \Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector * @return $this */ - public function removeAll(): self { + public function removeAll(): PermissionableEntitiesCollectionInterface { $this->storage = []; @@ -121,10 +120,11 @@ public function removeAll(): self { * * @param PermissionableEntityInterface $permissionEntity * @param string $key specified key for $permissionEntity in the collection - * @psalm-suppress MethodSignatureMismatch + * + * @noRector \Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector * @return $this */ - public function put(PermissionableEntityInterface $permissionEntity, string $key): self { + public function put(PermissionableEntityInterface $permissionEntity, string $key): PermissionableEntitiesCollectionInterface { $this->storage[$key] = $permissionEntity; @@ -160,11 +160,10 @@ public function get(string $key): ?PermissionableEntityInterface { * considered to be respectively less than, equal to, * or greater than the second. * - * @psalm-suppress MethodSignatureMismatch - * + * @noRector \Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector * @return $this */ - public function sort(callable $comparator = null): self { + public function sort(callable $comparator = null): PermissionableEntitiesCollectionInterface { if( $comparator === null ) { diff --git a/src/GenericPermissionsCollection.php b/src/GenericPermissionsCollection.php index a7ea906..e3125f7 100644 --- a/src/GenericPermissionsCollection.php +++ b/src/GenericPermissionsCollection.php @@ -92,11 +92,11 @@ public function isAllowed(string $action, string $resource, callable $additional * Adds an instance of PermissionInterface to an instance of this class. * * @param PermissionInterface $permission - * @psalm-suppress MethodSignatureMismatch * + * @noRector \Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector * @return $this */ - public function add(PermissionInterface $permission): self { + public function add(PermissionInterface $permission): PermissionsCollectionInterface { if( !$this->hasPermission($permission) ) { @@ -134,11 +134,11 @@ public function getKey(PermissionInterface $permission) { * Removes an instance of PermissionInterface from an instance of this class. * * @param PermissionInterface $permission - * @psalm-suppress MethodSignatureMismatch * + * @noRector \Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector * @return $this */ - public function remove(PermissionInterface $permission): self { + public function remove(PermissionInterface $permission): PermissionsCollectionInterface { $key = $this->getKey($permission); @@ -150,11 +150,11 @@ public function remove(PermissionInterface $permission): self { /** * Remove all items in the collection and return $this - * @psalm-suppress MethodSignatureMismatch * + * @noRector \Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector * @return $this */ - public function removeAll(): self { + public function removeAll(): PermissionsCollectionInterface { $this->storage = []; @@ -166,11 +166,11 @@ public function removeAll(): self { * * @param PermissionInterface $permission * @param string $key specified key for $permission in the collection - * @psalm-suppress MethodSignatureMismatch * + * @noRector \Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector * @return $this */ - public function put(PermissionInterface $permission, string $key): self { + public function put(PermissionInterface $permission, string $key): PermissionsCollectionInterface { $this->storage[$key] = $permission; @@ -209,10 +209,9 @@ public function get(string $key): ?PermissionInterface { * considered to be respectively less than, equal to, * or greater than the second. * - * @noRector + * @noRector \Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector * @return $this * @noinspection PhpDocSignatureInspection - * @psalm-suppress MethodSignatureMismatch */ public function sort(callable $comparator = null): PermissionsCollectionInterface {