diff --git a/.gitattributes b/.gitattributes index de04ad191549..f1ed82db1653 100644 --- a/.gitattributes +++ b/.gitattributes @@ -28,6 +28,7 @@ rector.php export-ignore phpunit.xml.dist export-ignore phpstan-baseline.neon.dist export-ignore phpstan.neon.dist export-ignore +phpstan-bootstrap.php export-ignore .php-cs-fixer.dist.php export-ignore .php-cs-fixer.no-header.php export-ignore .php-cs-fixer.user-guide.php export-ignore diff --git a/composer.json b/composer.json index a6ac3e8730f8..e630b890bdc0 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "phpstan/phpstan": "^1.7.1", "phpunit/phpunit": "^9.1", "predis/predis": "^1.1", - "rector/rector": "0.13.0" + "rector/rector": "0.13.2" }, "suggest": { "ext-fileinfo": "Improves mime type detection for files" diff --git a/phpstan-bootstrap.php b/phpstan-bootstrap.php new file mode 100644 index 000000000000..99acf96227fe --- /dev/null +++ b/phpstan-bootstrap.php @@ -0,0 +1,7 @@ + [ // private method called via getPrivateMethodInvoker __DIR__ . '/tests/system/Test/ReflectionHelperTest.php', diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index 4e4d49ea0045..18e8d9eaaf2e 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -29,6 +29,7 @@ use CodeIgniter\Router\Router; use Config\App; use Config\Cache; +use Config\Kint as KintConfig; use Config\Services; use Exception; use Kint; @@ -258,7 +259,7 @@ protected function initializeKint() /** * Config\Kint */ - $config = config('Config\Kint'); + $config = config(KintConfig::class); Kint::$depth_limit = $config->maxDepth; Kint::$display_called_from = $config->displayCalledFrom; diff --git a/system/Test/Mock/MockLogger.php b/system/Test/Mock/MockLogger.php index 97c3e89dfb22..6d6cdb9c9c7a 100644 --- a/system/Test/Mock/MockLogger.php +++ b/system/Test/Mock/MockLogger.php @@ -11,6 +11,8 @@ namespace CodeIgniter\Test\Mock; +use Tests\Support\Log\Handlers\TestHandler; + class MockLogger { /* @@ -81,7 +83,7 @@ class MockLogger */ public $handlers = [ // File Handler - 'Tests\Support\Log\Handlers\TestHandler' => [ + TestHandler::class => [ // The log levels that this handler will handle. 'handles' => [ 'critical', diff --git a/system/Test/bootstrap.php b/system/Test/bootstrap.php index 2a0447ab2194..0b4ab7531176 100644 --- a/system/Test/bootstrap.php +++ b/system/Test/bootstrap.php @@ -11,10 +11,10 @@ use CodeIgniter\Config\DotEnv; use CodeIgniter\Router\RouteCollection; -use CodeIgniter\Services; use Config\Autoload; use Config\Modules; use Config\Paths; +use Config\Services; error_reporting(E_ALL); ini_set('display_errors', '1'); @@ -78,7 +78,7 @@ // Use Config\Services as CodeIgniter\Services if (! class_exists('CodeIgniter\Services', false)) { - class_alias('Config\Services', 'CodeIgniter\Services'); + class_alias(Services::class, 'CodeIgniter\Services'); } // Initialize and register the loader with the SPL autoloader stack. diff --git a/system/bootstrap.php b/system/bootstrap.php index fec0e5c14b02..863bb327a93a 100644 --- a/system/bootstrap.php +++ b/system/bootstrap.php @@ -89,7 +89,7 @@ * files can use the path constants. */ -if (! class_exists('Config\Autoload', false)) { +if (! class_exists(Autoload::class, false)) { require_once SYSTEMPATH . 'Config/AutoloadConfig.php'; require_once APPPATH . 'Config/Autoload.php'; require_once SYSTEMPATH . 'Modules/Modules.php'; @@ -103,7 +103,7 @@ // Use Config\Services as CodeIgniter\Services if (! class_exists('CodeIgniter\Services', false)) { - class_alias('Config\Services', 'CodeIgniter\Services'); + class_alias(Services::class, 'CodeIgniter\Services'); } // Initialize and register the loader with the SPL autoloader stack.