Skip to content

Commit b39a756

Browse files
authored
[12.x] Improve PHPDoc blocks for array of arguments in Gate (#56426)
* Improve PHPDoc blocks for array of arguments * StyleCI * Add generics
1 parent 7ce337e commit b39a756

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/Illuminate/Auth/Access/Gate.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
use function Illuminate\Support\enum_value;
2020

21+
/**
22+
* @template TClass of object
23+
*/
2124
class Gate implements GateContract
2225
{
2326
use HandlesAuthorization;
@@ -326,7 +329,7 @@ public function after(callable $callback)
326329
* Determine if all of the given abilities should be granted for the current user.
327330
*
328331
* @param iterable|\UnitEnum|string $ability
329-
* @param mixed $arguments
332+
* @param array{class-string<TClass>|TClass, ...} $arguments
330333
* @return bool
331334
*/
332335
public function allows($ability, $arguments = [])
@@ -338,7 +341,7 @@ public function allows($ability, $arguments = [])
338341
* Determine if any of the given abilities should be denied for the current user.
339342
*
340343
* @param iterable|\UnitEnum|string $ability
341-
* @param mixed $arguments
344+
* @param array{class-string<TClass>|TClass, ...} $arguments
342345
* @return bool
343346
*/
344347
public function denies($ability, $arguments = [])
@@ -350,7 +353,7 @@ public function denies($ability, $arguments = [])
350353
* Determine if all of the given abilities should be granted for the current user.
351354
*
352355
* @param iterable|\UnitEnum|string $abilities
353-
* @param mixed $arguments
356+
* @param array{class-string<TClass>|TClass, ...} $arguments
354357
* @return bool
355358
*/
356359
public function check($abilities, $arguments = [])
@@ -364,7 +367,7 @@ public function check($abilities, $arguments = [])
364367
* Determine if any one of the given abilities should be granted for the current user.
365368
*
366369
* @param iterable|\UnitEnum|string $abilities
367-
* @param mixed $arguments
370+
* @param array{class-string<TClass>|TClass, ...} $arguments
368371
* @return bool
369372
*/
370373
public function any($abilities, $arguments = [])
@@ -376,7 +379,7 @@ public function any($abilities, $arguments = [])
376379
* Determine if all of the given abilities should be denied for the current user.
377380
*
378381
* @param iterable|\UnitEnum|string $abilities
379-
* @param mixed $arguments
382+
* @param array{class-string<TClass>|TClass, ...} $arguments
380383
* @return bool
381384
*/
382385
public function none($abilities, $arguments = [])
@@ -388,7 +391,7 @@ public function none($abilities, $arguments = [])
388391
* Determine if the given ability should be granted for the current user.
389392
*
390393
* @param \UnitEnum|string $ability
391-
* @param mixed $arguments
394+
* @param array{class-string<TClass>|TClass, ...} $arguments
392395
* @return \Illuminate\Auth\Access\Response
393396
*
394397
* @throws \Illuminate\Auth\Access\AuthorizationException
@@ -402,7 +405,7 @@ public function authorize($ability, $arguments = [])
402405
* Inspect the user for the given ability.
403406
*
404407
* @param \UnitEnum|string $ability
405-
* @param array|mixed $arguments
408+
* @param array{class-string<TClass>|TClass, ...} $arguments
406409
* @return \Illuminate\Auth\Access\Response
407410
*/
408411
public function inspect($ability, $arguments = [])
@@ -426,7 +429,7 @@ public function inspect($ability, $arguments = [])
426429
* Get the raw result from the authorization callback.
427430
*
428431
* @param string $ability
429-
* @param array|mixed $arguments
432+
* @param array{class-string<TClass>|TClass, ...} $arguments
430433
* @return mixed
431434
*
432435
* @throws \Illuminate\Auth\Access\AuthorizationException

0 commit comments

Comments
 (0)