Skip to content

Commit

Permalink
Rector tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
rotimi authored and rotimi committed Apr 14, 2021
1 parent af664c0 commit a7a1011
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
23 changes: 11 additions & 12 deletions src/GenericPermissionableEntitiesCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) ) {

Expand Down Expand Up @@ -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);

Expand All @@ -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 = [];

Expand All @@ -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;

Expand Down Expand Up @@ -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 ) {

Expand Down
19 changes: 9 additions & 10 deletions src/GenericPermissionsCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) ) {

Expand Down Expand Up @@ -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);

Expand All @@ -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 = [];

Expand All @@ -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;

Expand Down Expand Up @@ -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 {

Expand Down

0 comments on commit a7a1011

Please sign in to comment.