diff --git a/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php b/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php index 6294716aa012..f73db6e75fa0 100644 --- a/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php +++ b/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php @@ -46,9 +46,7 @@ public function broker($name = null) { $name = $name ?: $this->getDefaultDriver(); - return isset($this->brokers[$name]) - ? $this->brokers[$name] - : $this->brokers[$name] = $this->resolve($name); + return $this->brokers[$name] ?? ($this->brokers[$name] = $this->resolve($name)); } /** diff --git a/src/Illuminate/Container/Container.php b/src/Illuminate/Container/Container.php index 55ed75ec06da..a5df25d49097 100755 --- a/src/Illuminate/Container/Container.php +++ b/src/Illuminate/Container/Container.php @@ -546,11 +546,7 @@ protected function rebound($abstract) */ protected function getReboundCallbacks($abstract) { - if (isset($this->reboundCallbacks[$abstract])) { - return $this->reboundCallbacks[$abstract]; - } - - return []; + return $this->reboundCallbacks[$abstract] ?? []; } /** @@ -1122,11 +1118,7 @@ protected function getExtenders($abstract) { $abstract = $this->getAlias($abstract); - if (isset($this->extenders[$abstract])) { - return $this->extenders[$abstract]; - } - - return []; + return $this->extenders[$abstract] ?? []; } /** diff --git a/src/Illuminate/Database/Query/Grammars/Grammar.php b/src/Illuminate/Database/Query/Grammars/Grammar.php index 51d10042e776..2bccbaa63472 100755 --- a/src/Illuminate/Database/Query/Grammars/Grammar.php +++ b/src/Illuminate/Database/Query/Grammars/Grammar.php @@ -733,9 +733,7 @@ protected function compileOrders(Builder $query, $orders) protected function compileOrdersToArray(Builder $query, $orders) { return array_map(function ($order) { - return ! isset($order['sql']) - ? $this->wrap($order['column']).' '.$order['direction'] - : $order['sql']; + return $order['sql'] ?? $this->wrap($order['column']).' '.$order['direction']; }, $orders); } diff --git a/src/Illuminate/Queue/Console/ListFailedCommand.php b/src/Illuminate/Queue/Console/ListFailedCommand.php index 1c218ea03de6..c8fbbd1b8684 100644 --- a/src/Illuminate/Queue/Console/ListFailedCommand.php +++ b/src/Illuminate/Queue/Console/ListFailedCommand.php @@ -98,11 +98,7 @@ protected function matchJobName($payload) { preg_match('/"([^"]+)"/', $payload['data']['command'], $matches); - if (isset($matches[1])) { - return $matches[1]; - } - - return $payload['job'] ?? null; + return $matches[1] ?? $payload['job'] ?? null; } /** diff --git a/src/Illuminate/Support/Testing/Fakes/NotificationFake.php b/src/Illuminate/Support/Testing/Fakes/NotificationFake.php index e0f098159832..49fc548dbb24 100644 --- a/src/Illuminate/Support/Testing/Fakes/NotificationFake.php +++ b/src/Illuminate/Support/Testing/Fakes/NotificationFake.php @@ -173,11 +173,7 @@ public function hasSent($notifiable, $notification) */ protected function notificationsFor($notifiable, $notification) { - if (isset($this->notifications[get_class($notifiable)][$notifiable->getKey()][$notification])) { - return $this->notifications[get_class($notifiable)][$notifiable->getKey()][$notification]; - } - - return []; + return $this->notifications[get_class($notifiable)][$notifiable->getKey()][$notification] ?? []; } /** diff --git a/src/Illuminate/Translation/ArrayLoader.php b/src/Illuminate/Translation/ArrayLoader.php index 47482d45fec6..9dae1db58c81 100644 --- a/src/Illuminate/Translation/ArrayLoader.php +++ b/src/Illuminate/Translation/ArrayLoader.php @@ -25,11 +25,7 @@ public function load($locale, $group, $namespace = null) { $namespace = $namespace ?: '*'; - if (isset($this->messages[$namespace][$locale][$group])) { - return $this->messages[$namespace][$locale][$group]; - } - - return []; + return $this->messages[$namespace][$locale][$group] ?? []; } /** diff --git a/src/Illuminate/Translation/Translator.php b/src/Illuminate/Translation/Translator.php index 190f3bbcf2c5..823106f2c259 100755 --- a/src/Illuminate/Translation/Translator.php +++ b/src/Illuminate/Translation/Translator.php @@ -131,11 +131,7 @@ public function get($key, array $replace = [], $locale = null, $fallback = true) // If the line doesn't exist, we will return back the key which was requested as // that will be quick to spot in the UI if language keys are wrong or missing // from the application's language files. Otherwise we can return the line. - if (isset($line)) { - return $line; - } - - return $key; + return $line ?? $key; } /** diff --git a/src/Illuminate/View/Concerns/ManagesLayouts.php b/src/Illuminate/View/Concerns/ManagesLayouts.php index c1ef8714b50e..fdd6b891ed74 100644 --- a/src/Illuminate/View/Concerns/ManagesLayouts.php +++ b/src/Illuminate/View/Concerns/ManagesLayouts.php @@ -146,11 +146,7 @@ protected function extendSection($section, $content) */ public function yieldContent($section, $default = '') { - $sectionContent = $default instanceof View ? $default : e($default); - - if (isset($this->sections[$section])) { - $sectionContent = $this->sections[$section]; - } + $sectionContent = $this->sections[$section] ?? ($default instanceof View ? $default : e($default)); $sectionContent = str_replace('@@parent', '--parent--holder--', $sectionContent);