Skip to content

Commit f228374

Browse files
update Authorizable contract parameter names (#33866)
There's a parameter mismatch found by Psalm in my new Laravel project. Base User class is using trait `Illuminate\Contracts\Auth\Access\Gate\Authorizable` with method `can` with signature `iterable|string $abilities`; interface is defined as `string $ability`. Different parameter naming could be a problem for named parameters in PHP 8.0. Inconsistent type hints could be a problem for mocking/extending/testing/whatever. Error from Psalm: ``` ERROR: ParamNameMismatch - app/User.php:10:7 - Argument 1 of Illuminate\Foundation\Auth\Access\Authorizable::can has wrong name $abilities, expecting $ability as defined by Illuminate\Contracts\Auth\Access\Authorizable::can (see https://psalm.dev/230) ```
1 parent 3172e07 commit f228374

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Illuminate/Contracts/Auth/Access/Authorizable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ interface Authorizable
77
/**
88
* Determine if the entity has a given ability.
99
*
10-
* @param string $ability
10+
* @param iterable|string $abilities
1111
* @param array|mixed $arguments
1212
* @return bool
1313
*/
14-
public function can($ability, $arguments = []);
14+
public function can($abilities, $arguments = []);
1515
}

0 commit comments

Comments
 (0)