diff --git a/phpstan-baseline.php b/phpstan-baseline.php index cac41a7dbfdb..8a3e75dfb0ce 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -3031,11 +3031,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Router/RouteCollection.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/system/Router/RouteCollection.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:add\\(\\) has parameter \\$to with no signature specified for Closure\\.$#', 'count' => 1, diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 34629920cc1c..8a23264058cb 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -302,7 +302,8 @@ public function __construct(FileLocator $locator, Modules $moduleConfig, Routing // Normalize the path string in routeFiles array. foreach ($this->routeFiles as $routeKey => $routesFile) { - $this->routeFiles[$routeKey] = realpath($routesFile) ?: $routesFile; + $realpath = realpath($routesFile); + $this->routeFiles[$routeKey] = ($realpath === false) ? $routesFile : $realpath; } } @@ -1699,7 +1700,7 @@ public function resetRoutes() */ protected function loadRoutesOptions(?string $verb = null): array { - $verb = $verb ?: $this->getHTTPVerb(); + $verb ??= $this->getHTTPVerb(); $options = $this->routesOptions[$verb] ?? [];