From 66fd378ac0719b70c953093c4421b65437024e76 Mon Sep 17 00:00:00 2001 From: MohsenEtemadi Date: Thu, 17 Jul 2025 14:30:05 +0330 Subject: [PATCH] [12.x] Refactor Unify DocBlock return types for functions with possible void returns Some functions in Laravel have a return type of mixed, while the function may also work as void. To make this clearer, I changed the Doc Blocks to be more explicit. Although I have seen that in one place in the framework this situation is written as mixed|null, in my opinion it is better to have a consistent style everywhere, meaning either use mixed|void or mixed|null. If this style is not correct, please let me know so I can change it to something else. --- src/Illuminate/Auth/Access/Gate.php | 6 +++--- src/Illuminate/Auth/SessionGuard.php | 2 +- src/Illuminate/Database/Eloquent/Concerns/HasEvents.php | 2 +- src/Illuminate/Http/Request.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Illuminate/Auth/Access/Gate.php b/src/Illuminate/Auth/Access/Gate.php index 361fa2c7a043..91bbf035813a 100644 --- a/src/Illuminate/Auth/Access/Gate.php +++ b/src/Illuminate/Auth/Access/Gate.php @@ -654,7 +654,7 @@ protected function resolveAuthCallback($user, $ability, array $arguments) * Get a policy instance for a given class. * * @param object|string $class - * @return mixed + * @return mixed|void */ public function getPolicyFor($class) { @@ -805,7 +805,7 @@ protected function resolvePolicyCallback($user, $ability, array $arguments, $pol * @param \Illuminate\Contracts\Auth\Authenticatable $user * @param string $ability * @param array $arguments - * @return mixed + * @return mixed|void */ protected function callPolicyBefore($policy, $user, $ability, $arguments) { @@ -825,7 +825,7 @@ protected function callPolicyBefore($policy, $user, $ability, $arguments) * @param string $method * @param \Illuminate\Contracts\Auth\Authenticatable|null $user * @param array $arguments - * @return mixed + * @return mixed|void */ protected function callPolicyMethod($policy, $method, $user, array $arguments) { diff --git a/src/Illuminate/Auth/SessionGuard.php b/src/Illuminate/Auth/SessionGuard.php index 985b0bb4407c..7fa63fa2ff60 100644 --- a/src/Illuminate/Auth/SessionGuard.php +++ b/src/Illuminate/Auth/SessionGuard.php @@ -200,7 +200,7 @@ public function user() * Pull a user from the repository by its "remember me" cookie token. * * @param \Illuminate\Auth\Recaller $recaller - * @return mixed + * @return mixed|void */ protected function userFromRecaller($recaller) { diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php b/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php index fa654de966d4..906c9dd6f8c2 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php @@ -231,7 +231,7 @@ protected function fireModelEvent($event, $halt = true) * * @param string $event * @param string $method - * @return mixed|null + * @return mixed|void */ protected function fireCustomModelEvent($event, $method) { diff --git a/src/Illuminate/Http/Request.php b/src/Illuminate/Http/Request.php index d355cab241d2..45ff43d86554 100644 --- a/src/Illuminate/Http/Request.php +++ b/src/Illuminate/Http/Request.php @@ -530,7 +530,7 @@ public function duplicate(?array $query = null, ?array $request = null, ?array $ * Filter the given array of files, removing any empty values. * * @param mixed $files - * @return mixed + * @return mixed|void */ protected function filterFiles($files) {