From 16da41df8d99d325d05eb86803b0eab0629cde63 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Oct 2025 15:01:52 +0000 Subject: [PATCH 1/3] chore(deps-dev): update rector/rector requirement from 2.2.4 to 2.2.5 Updates the requirements on [rector/rector](https://github.com/rectorphp/rector) to permit the latest version. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/2.2.4...2.2.5) --- updated-dependencies: - dependency-name: rector/rector dependency-version: 2.2.5 dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ff8aee6027c4..e29e5dcd9c33 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "phpunit/phpcov": "^9.0.2 || ^10.0", "phpunit/phpunit": "^10.5.16 || ^11.2", "predis/predis": "^3.0", - "rector/rector": "2.2.4", + "rector/rector": "2.2.5", "shipmonk/phpstan-baseline-per-identifier": "^2.0" }, "replace": { From 379154eb5ac0fb66af5d00a197c3ec57cd73c1d0 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 23 Oct 2025 22:33:54 +0700 Subject: [PATCH 2/3] chore: re-run rector --- system/Router/RouteCollection.php | 2 +- tests/system/AutoReview/FrameworkCodeTest.php | 2 +- tests/system/CommonSingleServiceTest.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 7379d014cc09..feb161bdfc92 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -1574,7 +1574,7 @@ private function checkHostname($hostname): bool // Has multiple hostnames if (is_array($hostname)) { - $hostnameLower = array_map('strtolower', $hostname); + $hostnameLower = array_map(strtolower(...), $hostname); return in_array(strtolower($this->httpHost), $hostnameLower, true); } diff --git a/tests/system/AutoReview/FrameworkCodeTest.php b/tests/system/AutoReview/FrameworkCodeTest.php index 137839b024e5..603f679fbb2d 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); + $this->assertInstanceOf(Group::class, $groupAttribute); return $groupAttribute->name(); }, $attributes), diff --git a/tests/system/CommonSingleServiceTest.php b/tests/system/CommonSingleServiceTest.php index f3e3bb57b40b..014ac12a27fc 100644 --- a/tests/system/CommonSingleServiceTest.php +++ b/tests/system/CommonSingleServiceTest.php @@ -37,7 +37,7 @@ public function testSingleServiceWithNoParamsSupplied(string $service): void $service1 = single_service($service); // @phpstan-ignore codeigniter.unknownServiceMethod $service2 = single_service($service); // @phpstan-ignore codeigniter.unknownServiceMethod - assert($service1 !== null); + $this->assertNotNull($service1); $this->assertInstanceOf($service1::class, $service2); $this->assertNotSame($service1, $service2); @@ -65,7 +65,7 @@ public function testSingleServiceWithAtLeastOneParamSupplied(string $service): v $service1 = single_service($service, ...$params); // @phpstan-ignore codeigniter.unknownServiceMethod $service2 = single_service($service, ...$params); // @phpstan-ignore codeigniter.unknownServiceMethod - assert($service1 !== null); + $this->assertNotNull($service1); $this->assertInstanceOf($service1::class, $service2); $this->assertNotSame($service1, $service2); @@ -120,8 +120,8 @@ public function testSingleServiceWithAllParamsSupplied(): void $cache1 = single_service('cache', null, true); $cache2 = single_service('cache', null, true); - assert($cache1 !== null); - assert($cache2 !== null); + $this->assertNotNull($cache1); + $this->assertNotNull($cache2); // Assert that even passing true as last param this will // not create a shared instance. From 4dbbb00d6f77aa635d8652664c29ec5bd151b132 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 23 Oct 2025 22:36:55 +0700 Subject: [PATCH 3/3] chore: fix run rector --- rector.php | 6 ++++++ tests/system/AutoReview/FrameworkCodeTest.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rector.php b/rector.php index f2aed4ac2969..e5b29eead7ff 100644 --- a/rector.php +++ b/rector.php @@ -36,6 +36,7 @@ use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\RemoveDataProviderParamKeysRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector; +use Rector\PHPUnit\CodeQuality\Rector\FuncCall\AssertFuncCallToPHPUnitAssertRector; use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector; @@ -172,6 +173,11 @@ // needs separate PR for activation to allow more depth review FunctionLikeToFirstClassCallableRector::class, + + AssertFuncCallToPHPUnitAssertRector::class => [ + // use $this inside static closure + __DIR__ . '/tests/system/AutoReview/FrameworkCodeTest.php', + ], ]) // auto import fully qualified class names ->withImportNames(removeUnusedImports: true) diff --git a/tests/system/AutoReview/FrameworkCodeTest.php b/tests/system/AutoReview/FrameworkCodeTest.php index 603f679fbb2d..137839b024e5 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(); - $this->assertInstanceOf(Group::class, $groupAttribute); + assert($groupAttribute instanceof Group); return $groupAttribute->name(); }, $attributes),