From 066003d27e5c89cfe2ef8688518d52f377e234c2 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Mon, 23 Feb 2026 04:01:11 +0800 Subject: [PATCH 1/3] remove skipped rules that no longer applies --- rector.php | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/rector.php b/rector.php index 29755dc2647a..75a244a32b48 100644 --- a/rector.php +++ b/rector.php @@ -22,9 +22,7 @@ use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector; use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector; use Rector\Config\RectorConfig; -use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedConstructorParamRector; use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector; -use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector; use Rector\DeadCode\Rector\MethodCall\RemoveNullArgOnNullDefaultParamRector; use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector; use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector; @@ -99,26 +97,11 @@ __DIR__ . '/tests/_support/Test/TestForReflectionHelper.php', ], - RemoveUnusedConstructorParamRector::class => [ - // there are deprecated parameters - __DIR__ . '/system/Debug/Exceptions.php', - // @TODO remove if deprecated $httpVerb is removed - __DIR__ . '/system/Router/AutoRouterImproved.php', - // @TODO remove if deprecated $config is removed - __DIR__ . '/system/HTTP/Request.php', - __DIR__ . '/system/HTTP/Response.php', - ], - // Exclude test file because `is_cli()` is mocked and Rector might remove needed parameters. RemoveExtraParametersRector::class => [ __DIR__ . '/tests/system/Debug/ToolbarTest.php', ], - // check on constant compare - UnwrapFutureCompatibleIfPhpVersionRector::class => [ - __DIR__ . '/system/Autoloader/Autoloader.php', - ], - UnderscoreToCamelCaseVariableNameRector::class => [ // session handlers have the gc() method with underscored parameter `$max_lifetime` __DIR__ . '/system/Session/Handlers', @@ -137,6 +120,10 @@ __DIR__ . '/tests/system/Debug/ExceptionsTest.php', ], + DeclareStrictTypesTestsRector::class => [ + __DIR__ . '/tests/system/Debug/ExceptionsTest.php', + ], + // use mt_rand instead of random_int on purpose on non-cryptographically random RandomFunctionRector::class, @@ -153,10 +140,6 @@ ], ReturnNeverTypeRector::class => [ - __DIR__ . '/system/Cache/Handlers/BaseHandler.php', - __DIR__ . '/system/Cache/Handlers/MemcachedHandler.php', - __DIR__ . '/system/Cache/Handlers/WincacheHandler.php', - __DIR__ . '/system/CodeIgniter.php', __DIR__ . '/system/Database/MySQLi/Utils.php', __DIR__ . '/system/Database/OCI8/Utils.php', __DIR__ . '/system/Database/Postgre/Utils.php', @@ -164,8 +147,6 @@ __DIR__ . '/system/Database/SQLite3/Utils.php', __DIR__ . '/system/HTTP/DownloadResponse.php', __DIR__ . '/system/HTTP/SiteURI.php', - __DIR__ . '/system/Helpers/kint_helper.php', - __DIR__ . '/tests/_support/Autoloader/FatalLocator.php', ], // Unnecessary (string) is inserted @@ -184,10 +165,6 @@ // some tests extended by other tests FinalizeTestCaseClassRector::class, - DeclareStrictTypesTestsRector::class => [ - __DIR__ . '/tests/system/Debug/ExceptionsTest.php', - ], - RemoveNullArgOnNullDefaultParamRector::class => [ // skip form query usage, easier to read __DIR__ . '/system/Model.php', From 88668a014dd0c43a89763d9f07919289a2462c82 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Mon, 23 Feb 2026 04:07:39 +0800 Subject: [PATCH 2/3] do not skip `AssertFuncCallToPHPUnitAssertRector` --- rector.php | 6 ------ tests/system/AutoReview/FrameworkCodeTest.php | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/rector.php b/rector.php index 75a244a32b48..5e842f6d23dc 100644 --- a/rector.php +++ b/rector.php @@ -34,7 +34,6 @@ use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector; use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector; -use Rector\PHPUnit\CodeQuality\Rector\FuncCall\AssertFuncCallToPHPUnitAssertRector; use Rector\PHPUnit\CodeQuality\Rector\StmtsAwareInterface\DeclareStrictTypesTestsRector; use Rector\Privatization\Rector\Class_\FinalizeTestCaseClassRector; use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; @@ -157,11 +156,6 @@ // possibly isset() on purpose, on updated Config classes property accross versions IssetOnPropertyObjectToPropertyExistsRector::class, - AssertFuncCallToPHPUnitAssertRector::class => [ - // use $this inside static closure - __DIR__ . '/tests/system/AutoReview/FrameworkCodeTest.php', - ], - // some tests extended by other tests FinalizeTestCaseClassRector::class, diff --git a/tests/system/AutoReview/FrameworkCodeTest.php b/tests/system/AutoReview/FrameworkCodeTest.php index 137839b024e5..4e59afd0f8c5 100644 --- a/tests/system/AutoReview/FrameworkCodeTest.php +++ b/tests/system/AutoReview/FrameworkCodeTest.php @@ -62,7 +62,7 @@ public function testEachTestClassHasCorrectGroupAttributeName(string $class): vo $unrecognizedGroups = array_diff( array_map(static function (ReflectionAttribute $attribute): string { $groupAttribute = $attribute->newInstance(); - assert($groupAttribute instanceof Group); + self::assertInstanceOf(Group::class, $groupAttribute); return $groupAttribute->name(); }, $attributes), From 14bab7977b155452f4581961945e79ee67560554 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Mon, 23 Feb 2026 04:08:32 +0800 Subject: [PATCH 3/3] do not skip `StaticCallOnNonStaticToInstanceCallRector` --- rector.php | 5 ----- tests/_support/Config/Services.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/rector.php b/rector.php index 5e842f6d23dc..646353de5a10 100644 --- a/rector.php +++ b/rector.php @@ -29,7 +29,6 @@ use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector; use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector; use Rector\Php70\Rector\FuncCall\RandomFunctionRector; -use Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector; use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector; use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector; use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; @@ -165,10 +164,6 @@ __DIR__ . '/tests/system/Database', __DIR__ . '/tests/system/Models', ], - - StaticCallOnNonStaticToInstanceCallRector::class => [ - __DIR__ . '/tests/_support/Config/Services.php', - ], ]) // auto import fully qualified class names ->withImportNames(removeUnusedImports: true) diff --git a/tests/_support/Config/Services.php b/tests/_support/Config/Services.php index 3cb7c53388c3..ccd683e6b5cf 100644 --- a/tests/_support/Config/Services.php +++ b/tests/_support/Config/Services.php @@ -45,7 +45,7 @@ public static function uri(?string $uri = null, bool $getShared = true): URI if ($uri === null) { $appConfig = config(App::class); - $factory = new SiteURIFactory($appConfig, Services::superglobals()); + $factory = new SiteURIFactory($appConfig, static::superglobals()); return $factory->createFromGlobals(); }