From d98651c651e14bc0077e67cb036adde82a85bf62 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 21 Nov 2024 22:02:44 +0800 Subject: [PATCH] [10.x] PHP 8.4 Code Compatibility (#53612) * [10.x] PHP 8.4 Code Compatibility Signed-off-by: Mior Muhammad Zaki * Apply fixes from StyleCI * wip Signed-off-by: Mior Muhammad Zaki --------- Signed-off-by: Mior Muhammad Zaki Co-authored-by: StyleCI Bot --- Access/AuthorizationException.php | 2 +- Access/Gate.php | 4 ++-- Passwords/PasswordBroker.php | 2 +- RequestGuard.php | 2 +- SessionGuard.php | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Access/AuthorizationException.php b/Access/AuthorizationException.php index 17101b4d0..1454bde2a 100644 --- a/Access/AuthorizationException.php +++ b/Access/AuthorizationException.php @@ -29,7 +29,7 @@ class AuthorizationException extends Exception * @param \Throwable|null $previous * @return void */ - public function __construct($message = null, $code = null, Throwable $previous = null) + public function __construct($message = null, $code = null, ?Throwable $previous = null) { parent::__construct($message ?? 'This action is unauthorized.', 0, $previous); diff --git a/Access/Gate.php b/Access/Gate.php index 1f0a72007..2f0c6c6c1 100644 --- a/Access/Gate.php +++ b/Access/Gate.php @@ -100,7 +100,7 @@ public function __construct(Container $container, array $policies = [], array $beforeCallbacks = [], array $afterCallbacks = [], - callable $guessPolicyNamesUsingCallback = null) + ?callable $guessPolicyNamesUsingCallback = null) { $this->policies = $policies; $this->container = $container; @@ -224,7 +224,7 @@ public function define($ability, $callback) * @param array|null $abilities * @return $this */ - public function resource($name, $class, array $abilities = null) + public function resource($name, $class, ?array $abilities = null) { $abilities = $abilities ?: [ 'viewAny' => 'viewAny', diff --git a/Passwords/PasswordBroker.php b/Passwords/PasswordBroker.php index a0d1d194b..eb213c498 100755 --- a/Passwords/PasswordBroker.php +++ b/Passwords/PasswordBroker.php @@ -45,7 +45,7 @@ public function __construct(TokenRepositoryInterface $tokens, UserProvider $user * @param \Closure|null $callback * @return string */ - public function sendResetLink(array $credentials, Closure $callback = null) + public function sendResetLink(array $credentials, ?Closure $callback = null) { // First we will check to see if we found a user at the given credentials and // if we did not we will redirect back to this current URI with a piece of diff --git a/RequestGuard.php b/RequestGuard.php index d0af83cb4..7c1dfdc55 100644 --- a/RequestGuard.php +++ b/RequestGuard.php @@ -33,7 +33,7 @@ class RequestGuard implements Guard * @param \Illuminate\Contracts\Auth\UserProvider|null $provider * @return void */ - public function __construct(callable $callback, Request $request, UserProvider $provider = null) + public function __construct(callable $callback, Request $request, ?UserProvider $provider = null) { $this->request = $request; $this->callback = $callback; diff --git a/SessionGuard.php b/SessionGuard.php index b475dbc6c..d7f487204 100644 --- a/SessionGuard.php +++ b/SessionGuard.php @@ -123,8 +123,8 @@ class SessionGuard implements StatefulGuard, SupportsBasicAuth public function __construct($name, UserProvider $provider, Session $session, - Request $request = null, - Timebox $timebox = null) + ?Request $request = null, + ?Timebox $timebox = null) { $this->name = $name; $this->session = $session;