diff --git a/extensions/mentions/src/Formatter/UnparseUserMentions.php b/extensions/mentions/src/Formatter/UnparseUserMentions.php index b7fe68dd9..fc56df2ba 100644 --- a/extensions/mentions/src/Formatter/UnparseUserMentions.php +++ b/extensions/mentions/src/Formatter/UnparseUserMentions.php @@ -38,11 +38,7 @@ class UnparseUserMentions ? $context->mentionsUsers->find($attributes['id']) : User::find($attributes['id']); - if ($user) { - $attributes['displayname'] = $user->display_name; - } else { - $attributes['displayname'] = $this->translator->trans('core.lib.username.deleted_text'); - } + $attributes['displayname'] = $user?->display_name ?? $this->translator->trans('core.lib.username.deleted_text'); if (strpos($attributes['displayname'], '"#') !== false) { $attributes['displayname'] = preg_replace('/"#[a-z]{0,3}[0-9]+/', '_', $attributes['displayname']); diff --git a/extensions/nicknames/src/SaveNicknameToDatabase.php b/extensions/nicknames/src/SaveNicknameToDatabase.php index 8695c8814..4a2cdb593 100644 --- a/extensions/nicknames/src/SaveNicknameToDatabase.php +++ b/extensions/nicknames/src/SaveNicknameToDatabase.php @@ -34,11 +34,7 @@ class SaveNicknameToDatabase // If the user sets their nickname back to the username // set the nickname to null so that it just falls back to the username - if ($user->username === $nickname) { - $user->nickname = null; - } else { - $user->nickname = $nickname; - } + $user->nickname = $user->username === $nickname ? null : $nickname; } } } diff --git a/framework/core/src/Extend/LanguagePack.php b/framework/core/src/Extend/LanguagePack.php index 18bdc1044..5626c35d9 100644 --- a/framework/core/src/Extend/LanguagePack.php +++ b/framework/core/src/Extend/LanguagePack.php @@ -115,7 +115,7 @@ class LanguagePack implements ExtenderInterface, LifecycleInterface /** @var ExtensionManager|null $extensions */ static $extensions; - $extensions = $extensions ?? $container->make(ExtensionManager::class); + $extensions ??= $container->make(ExtensionManager::class); return $extensions->isEnabled($slug); } diff --git a/framework/core/src/Formatter/Formatter.php b/framework/core/src/Formatter/Formatter.php index 4f9e0ed12..fb71c954a 100644 --- a/framework/core/src/Formatter/Formatter.php +++ b/framework/core/src/Formatter/Formatter.php @@ -199,7 +199,7 @@ class Formatter protected function configureDefaultsOnLinks(string $xml): string { return Utils::replaceAttributes($xml, 'URL', function ($attributes) { - $attributes['rel'] = $attributes['rel'] ?? 'ugc nofollow'; + $attributes['rel'] ??= 'ugc nofollow'; return $attributes; }); diff --git a/framework/core/src/Http/RouteHandlerFactory.php b/framework/core/src/Http/RouteHandlerFactory.php index eef4d5db8..f09e4b7bf 100644 --- a/framework/core/src/Http/RouteHandlerFactory.php +++ b/framework/core/src/Http/RouteHandlerFactory.php @@ -62,11 +62,9 @@ class RouteHandlerFactory private function resolveController(callable|string $controller): Handler { - if (is_callable($controller)) { - $controller = $this->container->call($controller); - } else { - $controller = $this->container->make($controller); - } + $controller = is_callable($controller) + ? $this->container->call($controller) + : $this->container->make($controller); if (! $controller instanceof Handler) { throw new InvalidArgumentException('Controller must be an instance of '.Handler::class);