mirror of
https://github.com/flarum/core.git
synced 2025-08-04 23:47:32 +02:00
chore: simplify if else conditions (#3843)
* chore: simplify if else conditions * use nullsafe Co-authored-by: Sami Mazouz <sychocouldy@gmail.com> --------- Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
@@ -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;
|
||||
});
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user