diff --git a/app/Views/errors/cli/error_exception.php b/app/Views/errors/cli/error_exception.php
index 98d83b0ed3a6..9f47d25141d2 100644
--- a/app/Views/errors/cli/error_exception.php
+++ b/app/Views/errors/cli/error_exception.php
@@ -3,7 +3,7 @@
use CodeIgniter\CLI\CLI;
// The main Exception
-CLI::write('[' . get_class($exception) . ']', 'light_gray', 'red');
+CLI::write('[' . $exception::class . ']', 'light_gray', 'red');
CLI::write($message);
CLI::write('at ' . CLI::color(clean_path($exception->getFile()) . ':' . $exception->getLine(), 'green'));
CLI::newLine();
@@ -14,7 +14,7 @@
$last = $prevException;
CLI::write(' Caused by:');
- CLI::write(' [' . get_class($prevException) . ']', 'red');
+ CLI::write(' [' . $prevException::class . ']', 'red');
CLI::write(' ' . $prevException->getMessage());
CLI::write(' at ' . CLI::color(clean_path($prevException->getFile()) . ':' . $prevException->getLine(), 'green'));
CLI::newLine();
@@ -50,20 +50,11 @@
$function .= $padClass . $error['function'];
}
- $args = implode(', ', array_map(static function ($value) {
- switch (true) {
- case is_object($value):
- return 'Object(' . get_class($value) . ')';
-
- case is_array($value):
- return count($value) ? '[...]' : '[]';
-
- case $value === null:
- return 'null'; // return the lowercased version
-
- default:
- return var_export($value, true);
- }
+ $args = implode(', ', array_map(static fn ($value) => match (true) {
+ is_object($value) => 'Object(' . $value::class . ')',
+ is_array($value) => count($value) ? '[...]' : '[]',
+ $value === null => 'null', // return the lowercased version
+ default => var_export($value, true),
}, array_values($error['args'] ?? [])));
$function .= '(' . $args . ')';
diff --git a/app/Views/errors/html/error_exception.php b/app/Views/errors/html/error_exception.php
index b58e6bd76382..44d749892473 100644
--- a/app/Views/errors/html/error_exception.php
+++ b/app/Views/errors/html/error_exception.php
@@ -61,10 +61,10 @@
Caused by:
- = esc(get_class($prevException)), esc($prevException->getCode() ? ' #' . $prevException->getCode() : '') ?>
+ = esc($prevException::class), esc($prevException->getCode() ? ' #' . $prevException->getCode() : '') ?>
= nl2br(esc($prevException->getMessage())) ?>
- getMessage())) ?>"
+ getMessage())) ?>"
rel="noreferrer" target="_blank">search →
= esc(clean_path($prevException->getFile()) . ':' . $prevException->getLine()) ?>
@@ -121,7 +121,7 @@
getParameters();
}
diff --git a/phpstan-baseline.php b/phpstan-baseline.php
index d433aabf725e..9d658e715aad 100644
--- a/phpstan-baseline.php
+++ b/phpstan-baseline.php
@@ -1341,11 +1341,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php',
];
-$ignoreErrors[] = [
- 'message' => '#^Method CodeIgniter\\\\Commands\\\\Utilities\\\\Routes\\\\AutoRouterImproved\\\\AutoRouteCollector\\:\\:__construct\\(\\) has parameter \\$protectedControllers with no value type specified in iterable type array\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php',
-];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Commands\\\\Utilities\\\\Routes\\\\AutoRouterImproved\\\\AutoRouteCollector\\:\\:addFilters\\(\\) has no return type specified\\.$#',
'count' => 1,
@@ -1361,16 +1356,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php',
];
-$ignoreErrors[] = [
- 'message' => '#^Property CodeIgniter\\\\Commands\\\\Utilities\\\\Routes\\\\AutoRouterImproved\\\\AutoRouteCollector\\:\\:\\$httpMethods type has no value type specified in iterable type array\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Method CodeIgniter\\\\Commands\\\\Utilities\\\\Routes\\\\AutoRouterImproved\\\\ControllerMethodReader\\:\\:__construct\\(\\) has parameter \\$httpMethods with no value type specified in iterable type array\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReader.php',
-];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Commands\\\\Utilities\\\\Routes\\\\AutoRouterImproved\\\\ControllerMethodReader\\:\\:getParameters\\(\\) return type has no value type specified in iterable type array\\.$#',
'count' => 1,
@@ -7561,11 +7546,6 @@
'count' => 1,
'path' => __DIR__ . '/system/RESTful/ResourceController.php',
];
-$ignoreErrors[] = [
- 'message' => '#^Method CodeIgniter\\\\Router\\\\AutoRouter\\:\\:__construct\\(\\) has parameter \\$cliRoutes with no value type specified in iterable type array\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/system/Router/AutoRouter.php',
-];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\AutoRouter\\:\\:getRoute\\(\\) return type has no value type specified in iterable type array\\.$#',
'count' => 1,
@@ -11841,11 +11821,6 @@
'count' => 1,
'path' => __DIR__ . '/tests/system/CommonSingleServiceTest.php',
];
-$ignoreErrors[] = [
- 'message' => '#^Parameter \\#1 \\$expected of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) expects class\\-string\\