From 4450b1200a1c9fab6685c4016d59c40d68c3160e Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 22 Oct 2025 12:21:25 +0200 Subject: [PATCH 1/2] use full downgrade array spread on PHP 8.1 to avoid 2 rules doing almost the same job, ref https://github.com/rectorphp/rector/issues/9448 --- config/set/downgrade-php74.php | 3 ++- config/set/downgrade-php81.php | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config/set/downgrade-php74.php b/config/set/downgrade-php74.php index a1ade47e..46a68c48 100644 --- a/config/set/downgrade-php74.php +++ b/config/set/downgrade-php74.php @@ -29,7 +29,8 @@ DowngradeNullCoalescingOperatorRector::class, DowngradeNumericLiteralSeparatorRector::class, DowngradeStripTagsCallWithArrayRector::class, - DowngradeArraySpreadRector::class, + // DowngradeArraySpreadRector::class, + // already handled in PHP 8.1 set DowngradeArrayMergeCallWithoutArgumentsRector::class, DowngradeFreadFwriteFalsyToNegationRector::class, DowngradePreviouslyImplementedInterfaceRector::class, diff --git a/config/set/downgrade-php81.php b/config/set/downgrade-php81.php index e868660a..2014e9d9 100644 --- a/config/set/downgrade-php81.php +++ b/config/set/downgrade-php81.php @@ -2,6 +2,7 @@ declare(strict_types=1); +use Rector\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector; use Rector\DowngradePhp81\Rector\FuncCall\DowngradeHashAlgorithmXxHashRector; use Rector\DowngradePhp81\Rector\LNumber\DowngradeOctalNumberRector; use Rector\DowngradePhp81\Rector\MethodCall\DowngradeIsEnumRector; @@ -32,7 +33,8 @@ DowngradeNewInInitializerRector::class, DowngradePhp81ResourceReturnToObjectRector::class, DowngradeReadonlyPropertyRector::class, - DowngradeArraySpreadStringKeyRector::class, + DowngradeArraySpreadRector::class, + // DowngradeArraySpreadStringKeyRector::class, DowngradeArrayIsListRector::class, DowngradeSetAccessibleReflectionPropertyRector::class, DowngradeIsEnumRector::class, From f79dfe3e1aa87b774466a6f16d52aa56e3b6822f Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 22 Oct 2025 12:24:39 +0200 Subject: [PATCH 2/2] bump deps --- composer.json | 6 +++--- config/set/downgrade-php74.php | 1 - config/set/downgrade-php81.php | 1 - .../Rector/Array_/DowngradeArraySpreadStringKeyRector.php | 2 ++ 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index fa9eb0ee..fc59966c 100644 --- a/composer.json +++ b/composer.json @@ -8,13 +8,13 @@ }, "require-dev": { "phpstan/extension-installer": "^1.3", - "phpstan/phpstan": "^2.1.8", + "phpstan/phpstan": "^2.1.30", "phpstan/phpstan-webmozart-assert": "^2.0", - "phpunit/phpunit": "^11.4", + "phpunit/phpunit": "^11.5", "rector/rector-src": "dev-main", "symplify/easy-coding-standard": "^12.3", "symplify/rule-doc-generator": "^12.2", - "symplify/vendor-patches": "^11.3", + "symplify/vendor-patches": "^11.5", "tomasvotruba/class-leak": "^1.0", "tracy/tracy": "^2.10" }, diff --git a/config/set/downgrade-php74.php b/config/set/downgrade-php74.php index 46a68c48..23868307 100644 --- a/config/set/downgrade-php74.php +++ b/config/set/downgrade-php74.php @@ -4,7 +4,6 @@ use Rector\Config\RectorConfig; use Rector\ValueObject\PhpVersion; -use Rector\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector; use Rector\DowngradePhp74\Rector\ArrowFunction\ArrowFunctionToAnonymousFunctionRector; use Rector\DowngradePhp74\Rector\ClassMethod\DowngradeContravariantArgumentTypeRector; use Rector\DowngradePhp74\Rector\ClassMethod\DowngradeCovariantReturnTypeRector; diff --git a/config/set/downgrade-php81.php b/config/set/downgrade-php81.php index 2014e9d9..c045b53c 100644 --- a/config/set/downgrade-php81.php +++ b/config/set/downgrade-php81.php @@ -8,7 +8,6 @@ use Rector\DowngradePhp81\Rector\MethodCall\DowngradeIsEnumRector; use Rector\Config\RectorConfig; use Rector\ValueObject\PhpVersion; -use Rector\DowngradePhp81\Rector\Array_\DowngradeArraySpreadStringKeyRector; use Rector\DowngradePhp81\Rector\ClassConst\DowngradeFinalizePublicClassConstantRector; use Rector\DowngradePhp81\Rector\FuncCall\DowngradeArrayIsListRector; use Rector\DowngradePhp81\Rector\FuncCall\DowngradeFirstClassCallableSyntaxRector; diff --git a/rules/DowngradePhp81/Rector/Array_/DowngradeArraySpreadStringKeyRector.php b/rules/DowngradePhp81/Rector/Array_/DowngradeArraySpreadStringKeyRector.php index 1a42a3a8..e27d6e43 100644 --- a/rules/DowngradePhp81/Rector/Array_/DowngradeArraySpreadStringKeyRector.php +++ b/rules/DowngradePhp81/Rector/Array_/DowngradeArraySpreadStringKeyRector.php @@ -21,6 +21,8 @@ /** * @changelog https://wiki.php.net/rfc/array_unpacking_string_keys * + * @api testing if useful + * * @see \Rector\Tests\DowngradePhp81\Rector\Array_\DowngradeArraySpreadStringKeyRector\DowngradeArraySpreadStringKeyRectorTest */ final class DowngradeArraySpreadStringKeyRector extends AbstractRector