From ea4198a1dcb8dcaf5037f7f1f9cb5d9dc2e1a58e Mon Sep 17 00:00:00 2001 From: miladev95 <35612406+miladev95@users.noreply.github.com> Date: Mon, 6 Nov 2023 00:11:15 +0330 Subject: [PATCH] authenticate method refactored to use null coalescing operator (#48917) --- src/Illuminate/Auth/GuardHelpers.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Illuminate/Auth/GuardHelpers.php b/src/Illuminate/Auth/GuardHelpers.php index 21094bf8a82b..9cdf69776c2e 100644 --- a/src/Illuminate/Auth/GuardHelpers.php +++ b/src/Illuminate/Auth/GuardHelpers.php @@ -33,11 +33,7 @@ trait GuardHelpers */ public function authenticate() { - if (! is_null($user = $this->user())) { - return $user; - } - - throw new AuthenticationException; + return $this->user() ?? throw new AuthenticationException; } /**