From 4351b5a1acc9e9c2ce076ca009a0c67b60bf88fd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:49:05 +0000 Subject: [PATCH 1/3] chore(deps-dev): update rector/rector requirement from 2.2.5 to 2.2.6 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.5...2.2.6) --- updated-dependencies: - dependency-name: rector/rector dependency-version: 2.2.6 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 e29e5dcd9c33..7e1248632c07 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.5", + "rector/rector": "2.2.6", "shipmonk/phpstan-baseline-per-identifier": "^2.0" }, "replace": { From 0e1753df26230e3fc24055c2e0cf3a00a4651712 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 27 Oct 2025 22:54:59 +0700 Subject: [PATCH 2/3] chore: apply rector --- rector.php | 5 +++++ tests/system/Autoloader/FileLocatorTest.php | 4 ++-- .../Live/TransactionDBDebugTrueTest.php | 2 +- tests/system/Debug/ExceptionsTest.php | 2 ++ tests/system/HTTP/CURLRequestTest.php | 4 ++-- tests/system/Validation/RulesTest.php | 6 +++--- .../StrictRules/CreditCardRulesTest.php | 6 +++--- .../StrictRules/DatabaseRelatedRulesTest.php | 6 +++--- .../Validation/StrictRules/FileRulesTest.php | 6 +++--- tests/system/Validation/ValidationTest.php | 18 +++++++++--------- 10 files changed, 33 insertions(+), 26 deletions(-) diff --git a/rector.php b/rector.php index e5b29eead7ff..54921a61c66d 100644 --- a/rector.php +++ b/rector.php @@ -37,6 +37,7 @@ 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\Class_\FinalizeTestCaseClassRector; use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector; @@ -178,6 +179,10 @@ // use $this inside static closure __DIR__ . '/tests/system/AutoReview/FrameworkCodeTest.php', ], + + FinalizeTestCaseClassRector::class => [ + __DIR__ . '/tests/system/Validation/FormatRulesTest.php', + ], ]) // auto import fully qualified class names ->withImportNames(removeUnusedImports: true) diff --git a/tests/system/Autoloader/FileLocatorTest.php b/tests/system/Autoloader/FileLocatorTest.php index fc7925724add..4c7d01db9e00 100644 --- a/tests/system/Autoloader/FileLocatorTest.php +++ b/tests/system/Autoloader/FileLocatorTest.php @@ -25,12 +25,12 @@ * @no-final */ #[Group('Others')] -class FileLocatorTest extends CIUnitTestCase +final class FileLocatorTest extends CIUnitTestCase { /** * @var FileLocator|FileLocatorCached */ - protected FileLocatorInterface $locator; + private FileLocatorInterface $locator; protected function setUp(): void { diff --git a/tests/system/Database/Live/TransactionDBDebugTrueTest.php b/tests/system/Database/Live/TransactionDBDebugTrueTest.php index cbfa6a1ff289..725cbb3f7443 100644 --- a/tests/system/Database/Live/TransactionDBDebugTrueTest.php +++ b/tests/system/Database/Live/TransactionDBDebugTrueTest.php @@ -26,7 +26,7 @@ * @no-final */ #[Group('DatabaseLive')] -class TransactionDBDebugTrueTest extends CIUnitTestCase +final class TransactionDBDebugTrueTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Debug/ExceptionsTest.php b/tests/system/Debug/ExceptionsTest.php index 6ce2fda06c88..f0684a97b6f6 100644 --- a/tests/system/Debug/ExceptionsTest.php +++ b/tests/system/Debug/ExceptionsTest.php @@ -1,5 +1,7 @@ |string>> */ - protected array $config = [ + private array $config = [ 'ruleSets' => [ Rules::class, FormatRules::class, diff --git a/tests/system/Validation/StrictRules/CreditCardRulesTest.php b/tests/system/Validation/StrictRules/CreditCardRulesTest.php index a1bc09aa6c0f..e3aff094c394 100644 --- a/tests/system/Validation/StrictRules/CreditCardRulesTest.php +++ b/tests/system/Validation/StrictRules/CreditCardRulesTest.php @@ -25,14 +25,14 @@ * @no-final */ #[Group('Others')] -class CreditCardRulesTest extends CIUnitTestCase +final class CreditCardRulesTest extends CIUnitTestCase { - protected Validation $validation; + private Validation $validation; /** * @var array|string>> */ - protected array $config = [ + private array $config = [ 'ruleSets' => [ Rules::class, FormatRules::class, diff --git a/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php b/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php index 43e25d8e7a8a..936a53050b7c 100644 --- a/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php +++ b/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php @@ -28,11 +28,11 @@ * @no-final */ #[Group('DatabaseLive')] -class DatabaseRelatedRulesTest extends CIUnitTestCase +final class DatabaseRelatedRulesTest extends CIUnitTestCase { use DatabaseTestTrait; - protected Validation $validation; + private Validation $validation; /** * @var array{ @@ -41,7 +41,7 @@ class DatabaseRelatedRulesTest extends CIUnitTestCase * groupA_errors: array>, * } */ - protected array $config = [ + private array $config = [ 'ruleSets' => [ Rules::class, FormatRules::class, diff --git a/tests/system/Validation/StrictRules/FileRulesTest.php b/tests/system/Validation/StrictRules/FileRulesTest.php index 5bb259b254ea..a98da092b666 100644 --- a/tests/system/Validation/StrictRules/FileRulesTest.php +++ b/tests/system/Validation/StrictRules/FileRulesTest.php @@ -25,14 +25,14 @@ * @no-final */ #[Group('Others')] -class FileRulesTest extends CIUnitTestCase +final class FileRulesTest extends CIUnitTestCase { - protected Validation $validation; + private Validation $validation; /** * @var array|string>> */ - protected array $config = [ + private array $config = [ 'ruleSets' => [ Rules::class, FormatRules::class, diff --git a/tests/system/Validation/ValidationTest.php b/tests/system/Validation/ValidationTest.php index b015ab50f363..b945f3e4f847 100644 --- a/tests/system/Validation/ValidationTest.php +++ b/tests/system/Validation/ValidationTest.php @@ -33,14 +33,14 @@ * @no-final */ #[Group('Others')] -class ValidationTest extends CIUnitTestCase +final class ValidationTest extends CIUnitTestCase { - protected Validation $validation; + private Validation $validation; /** * @var array|string>|string>|string> */ - protected static array $config = [ + private static array $config = [ 'ruleSets' => [ Rules::class, FormatRules::class, @@ -82,7 +82,7 @@ class ValidationTest extends CIUnitTestCase protected function setUp(): void { parent::setUp(); - $this->validation = new Validation((object) static::$config, service('renderer')); + $this->validation = new Validation((object) self::$config, service('renderer')); $this->validation->reset(); } @@ -227,7 +227,7 @@ public static function provideSetRuleRulesFormat(): iterable yield 'fail-deep-object' => [ false, - new Validation((object) static::$config, service('renderer')), + new Validation((object) self::$config, service('renderer')), ]; yield 'pass-multiple-string' => [ @@ -1007,10 +1007,10 @@ public function testShowBadTemplate(): void public function testNoRuleSetsSetup(): void { try { - $rulesets = static::$config['ruleSets']; + $rulesets = self::$config['ruleSets']; - static::$config['ruleSets'] = null; - (new Validation((object) static::$config, service('renderer'))) + self::$config['ruleSets'] = null; + (new Validation((object) self::$config, service('renderer'))) ->reset() ->run(['foo' => '']); @@ -1018,7 +1018,7 @@ public function testNoRuleSetsSetup(): void } catch (Throwable $e) { $this->assertInstanceOf(ValidationException::class, $e); } finally { - static::$config['ruleSets'] = $rulesets; + self::$config['ruleSets'] = $rulesets; } } From f1ec1312e34841837e856195e703701ddb942d8c Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 27 Oct 2025 23:06:00 +0700 Subject: [PATCH 3/3] skip FinalizeTestCaseClassRector and DeclareStrictTypesTestsRector config --- rector.php | 8 ++++++-- tests/system/Autoloader/FileLocatorTest.php | 4 ++-- .../Live/TransactionDBDebugTrueTest.php | 2 +- tests/system/Debug/ExceptionsTest.php | 2 -- tests/system/HTTP/CURLRequestTest.php | 4 ++-- tests/system/Validation/RulesTest.php | 6 +++--- .../StrictRules/CreditCardRulesTest.php | 6 +++--- .../StrictRules/DatabaseRelatedRulesTest.php | 6 +++--- .../Validation/StrictRules/FileRulesTest.php | 6 +++--- tests/system/Validation/ValidationTest.php | 18 +++++++++--------- 10 files changed, 32 insertions(+), 30 deletions(-) diff --git a/rector.php b/rector.php index 54921a61c66d..92740a3cc945 100644 --- a/rector.php +++ b/rector.php @@ -37,6 +37,7 @@ use Rector\PHPUnit\CodeQuality\Rector\Class_\RemoveDataProviderParamKeysRector; 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; use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; @@ -180,8 +181,11 @@ __DIR__ . '/tests/system/AutoReview/FrameworkCodeTest.php', ], - FinalizeTestCaseClassRector::class => [ - __DIR__ . '/tests/system/Validation/FormatRulesTest.php', + // some tests extended by other tests + FinalizeTestCaseClassRector::class, + + DeclareStrictTypesTestsRector::class => [ + __DIR__ . '/tests/system/Debug/ExceptionsTest.php', ], ]) // auto import fully qualified class names diff --git a/tests/system/Autoloader/FileLocatorTest.php b/tests/system/Autoloader/FileLocatorTest.php index 4c7d01db9e00..fc7925724add 100644 --- a/tests/system/Autoloader/FileLocatorTest.php +++ b/tests/system/Autoloader/FileLocatorTest.php @@ -25,12 +25,12 @@ * @no-final */ #[Group('Others')] -final class FileLocatorTest extends CIUnitTestCase +class FileLocatorTest extends CIUnitTestCase { /** * @var FileLocator|FileLocatorCached */ - private FileLocatorInterface $locator; + protected FileLocatorInterface $locator; protected function setUp(): void { diff --git a/tests/system/Database/Live/TransactionDBDebugTrueTest.php b/tests/system/Database/Live/TransactionDBDebugTrueTest.php index 725cbb3f7443..cbfa6a1ff289 100644 --- a/tests/system/Database/Live/TransactionDBDebugTrueTest.php +++ b/tests/system/Database/Live/TransactionDBDebugTrueTest.php @@ -26,7 +26,7 @@ * @no-final */ #[Group('DatabaseLive')] -final class TransactionDBDebugTrueTest extends CIUnitTestCase +class TransactionDBDebugTrueTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Debug/ExceptionsTest.php b/tests/system/Debug/ExceptionsTest.php index f0684a97b6f6..6ce2fda06c88 100644 --- a/tests/system/Debug/ExceptionsTest.php +++ b/tests/system/Debug/ExceptionsTest.php @@ -1,7 +1,5 @@ |string>> */ - private array $config = [ + protected array $config = [ 'ruleSets' => [ Rules::class, FormatRules::class, diff --git a/tests/system/Validation/StrictRules/CreditCardRulesTest.php b/tests/system/Validation/StrictRules/CreditCardRulesTest.php index e3aff094c394..a1bc09aa6c0f 100644 --- a/tests/system/Validation/StrictRules/CreditCardRulesTest.php +++ b/tests/system/Validation/StrictRules/CreditCardRulesTest.php @@ -25,14 +25,14 @@ * @no-final */ #[Group('Others')] -final class CreditCardRulesTest extends CIUnitTestCase +class CreditCardRulesTest extends CIUnitTestCase { - private Validation $validation; + protected Validation $validation; /** * @var array|string>> */ - private array $config = [ + protected array $config = [ 'ruleSets' => [ Rules::class, FormatRules::class, diff --git a/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php b/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php index 936a53050b7c..43e25d8e7a8a 100644 --- a/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php +++ b/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php @@ -28,11 +28,11 @@ * @no-final */ #[Group('DatabaseLive')] -final class DatabaseRelatedRulesTest extends CIUnitTestCase +class DatabaseRelatedRulesTest extends CIUnitTestCase { use DatabaseTestTrait; - private Validation $validation; + protected Validation $validation; /** * @var array{ @@ -41,7 +41,7 @@ final class DatabaseRelatedRulesTest extends CIUnitTestCase * groupA_errors: array>, * } */ - private array $config = [ + protected array $config = [ 'ruleSets' => [ Rules::class, FormatRules::class, diff --git a/tests/system/Validation/StrictRules/FileRulesTest.php b/tests/system/Validation/StrictRules/FileRulesTest.php index a98da092b666..5bb259b254ea 100644 --- a/tests/system/Validation/StrictRules/FileRulesTest.php +++ b/tests/system/Validation/StrictRules/FileRulesTest.php @@ -25,14 +25,14 @@ * @no-final */ #[Group('Others')] -final class FileRulesTest extends CIUnitTestCase +class FileRulesTest extends CIUnitTestCase { - private Validation $validation; + protected Validation $validation; /** * @var array|string>> */ - private array $config = [ + protected array $config = [ 'ruleSets' => [ Rules::class, FormatRules::class, diff --git a/tests/system/Validation/ValidationTest.php b/tests/system/Validation/ValidationTest.php index b945f3e4f847..b015ab50f363 100644 --- a/tests/system/Validation/ValidationTest.php +++ b/tests/system/Validation/ValidationTest.php @@ -33,14 +33,14 @@ * @no-final */ #[Group('Others')] -final class ValidationTest extends CIUnitTestCase +class ValidationTest extends CIUnitTestCase { - private Validation $validation; + protected Validation $validation; /** * @var array|string>|string>|string> */ - private static array $config = [ + protected static array $config = [ 'ruleSets' => [ Rules::class, FormatRules::class, @@ -82,7 +82,7 @@ final class ValidationTest extends CIUnitTestCase protected function setUp(): void { parent::setUp(); - $this->validation = new Validation((object) self::$config, service('renderer')); + $this->validation = new Validation((object) static::$config, service('renderer')); $this->validation->reset(); } @@ -227,7 +227,7 @@ public static function provideSetRuleRulesFormat(): iterable yield 'fail-deep-object' => [ false, - new Validation((object) self::$config, service('renderer')), + new Validation((object) static::$config, service('renderer')), ]; yield 'pass-multiple-string' => [ @@ -1007,10 +1007,10 @@ public function testShowBadTemplate(): void public function testNoRuleSetsSetup(): void { try { - $rulesets = self::$config['ruleSets']; + $rulesets = static::$config['ruleSets']; - self::$config['ruleSets'] = null; - (new Validation((object) self::$config, service('renderer'))) + static::$config['ruleSets'] = null; + (new Validation((object) static::$config, service('renderer'))) ->reset() ->run(['foo' => '']); @@ -1018,7 +1018,7 @@ public function testNoRuleSetsSetup(): void } catch (Throwable $e) { $this->assertInstanceOf(ValidationException::class, $e); } finally { - self::$config['ruleSets'] = $rulesets; + static::$config['ruleSets'] = $rulesets; } }