From e04ea57ede8b00b77ff0bbda778dafba2a6aed96 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) --- GuardHelpers.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/GuardHelpers.php b/GuardHelpers.php index 21094bf8..9cdf6977 100644 --- a/GuardHelpers.php +++ b/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; } /**