From 41a046d330cd78f7086760f2262d675b6446536d Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 6 Feb 2026 15:13:30 +0100 Subject: [PATCH] [config] split off 12.5 set, just to improve readability --- config/sets/phpunit120.php | 9 --------- config/sets/phpunit125.php | 19 +++++++++++++++++++ src/Enum/PHPUnitAttribute.php | 1 + src/Set/SetProvider/PHPUnitSetProvider.php | 6 ++++++ 4 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 config/sets/phpunit125.php diff --git a/config/sets/phpunit120.php b/config/sets/phpunit120.php index 11982aa9..1a2c7d94 100644 --- a/config/sets/phpunit120.php +++ b/config/sets/phpunit120.php @@ -5,9 +5,6 @@ use Rector\Config\RectorConfig; use Rector\PHPUnit\PHPUnit120\Rector\CallLike\CreateStubInCoalesceArgRector; use Rector\PHPUnit\PHPUnit120\Rector\CallLike\CreateStubOverCreateMockArgRector; -use Rector\PHPUnit\PHPUnit120\Rector\Class_\AllowMockObjectsForDataProviderRector; -use Rector\PHPUnit\PHPUnit120\Rector\Class_\AllowMockObjectsWhereParentClassRector; -use Rector\PHPUnit\PHPUnit120\Rector\Class_\AllowMockObjectsWithoutExpectationsAttributeRector; use Rector\PHPUnit\PHPUnit120\Rector\Class_\AssertIsTypeMethodCallRector; use Rector\PHPUnit\PHPUnit120\Rector\Class_\PropertyCreateMockToCreateStubRector; use Rector\PHPUnit\PHPUnit120\Rector\Class_\RemoveOverrideFinalConstructTestCaseRector; @@ -23,11 +20,5 @@ CreateStubInCoalesceArgRector::class, ExpressionCreateMockToCreateStubRector::class, PropertyCreateMockToCreateStubRector::class, - AllowMockObjectsWhereParentClassRector::class, - AllowMockObjectsForDataProviderRector::class, - - // experimental, from PHPUnit 12.5.2 - // @see https://github.com/sebastianbergmann/phpunit/commit/24c208d6a340c3071f28a9b5cce02b9377adfd43 - AllowMockObjectsWithoutExpectationsAttributeRector::class, ]); }; diff --git a/config/sets/phpunit125.php b/config/sets/phpunit125.php new file mode 100644 index 00000000..6adf9123 --- /dev/null +++ b/config/sets/phpunit125.php @@ -0,0 +1,19 @@ +rules([ + AllowMockObjectsWhereParentClassRector::class, + AllowMockObjectsForDataProviderRector::class, + + // experimental, from PHPUnit 12.5.2 + // @see https://github.com/sebastianbergmann/phpunit/commit/24c208d6a340c3071f28a9b5cce02b9377adfd43 + AllowMockObjectsWithoutExpectationsAttributeRector::class, + ]); +}; diff --git a/src/Enum/PHPUnitAttribute.php b/src/Enum/PHPUnitAttribute.php index 3273256c..9517d29c 100644 --- a/src/Enum/PHPUnitAttribute.php +++ b/src/Enum/PHPUnitAttribute.php @@ -25,6 +25,7 @@ final class PHPUnitAttribute public const string TEST = 'PHPUnit\Framework\Attributes\Test'; /** + * Since PHPUnit 12.5.2 * @see https://github.com/sebastianbergmann/phpunit/commit/24c208d6a340c3071f28a9b5cce02b9377adfd43 */ public const string ALLOW_MOCK_OBJECTS_WITHOUT_EXPECTATIONS = 'PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations'; diff --git a/src/Set/SetProvider/PHPUnitSetProvider.php b/src/Set/SetProvider/PHPUnitSetProvider.php index d945b70d..ff2fa232 100644 --- a/src/Set/SetProvider/PHPUnitSetProvider.php +++ b/src/Set/SetProvider/PHPUnitSetProvider.php @@ -75,6 +75,12 @@ public function provide(): array '12.0', __DIR__ . '/../../../config/sets/phpunit120.php' ), + new ComposerTriggeredSet( + SetGroup::PHPUNIT, + 'phpunit/phpunit', + '12.5', + __DIR__ . '/../../../config/sets/phpunit125.php' + ), new Set(SetGroup::PHPUNIT, 'Code Quality', __DIR__ . '/../../../config/sets/phpunit-code-quality.php'),