Skip to content

Commit 8f7b411

Browse files
authored
Improve downgrade array spread stability (#341)
* use full downgrade array spread on PHP 8.1 to avoid 2 rules doing almost the same job, ref rectorphp/rector#9448 * bump deps
1 parent 2c4aa18 commit 8f7b411

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
},
99
"require-dev": {
1010
"phpstan/extension-installer": "^1.3",
11-
"phpstan/phpstan": "^2.1.8",
11+
"phpstan/phpstan": "^2.1.30",
1212
"phpstan/phpstan-webmozart-assert": "^2.0",
13-
"phpunit/phpunit": "^11.4",
13+
"phpunit/phpunit": "^11.5",
1414
"rector/rector-src": "dev-main",
1515
"symplify/easy-coding-standard": "^12.3",
1616
"symplify/rule-doc-generator": "^12.2",
17-
"symplify/vendor-patches": "^11.3",
17+
"symplify/vendor-patches": "^11.5",
1818
"tomasvotruba/class-leak": "^1.0",
1919
"tracy/tracy": "^2.10"
2020
},

config/set/downgrade-php74.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Rector\Config\RectorConfig;
66
use Rector\ValueObject\PhpVersion;
7-
use Rector\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector;
87
use Rector\DowngradePhp74\Rector\ArrowFunction\ArrowFunctionToAnonymousFunctionRector;
98
use Rector\DowngradePhp74\Rector\ClassMethod\DowngradeContravariantArgumentTypeRector;
109
use Rector\DowngradePhp74\Rector\ClassMethod\DowngradeCovariantReturnTypeRector;
@@ -29,7 +28,8 @@
2928
DowngradeNullCoalescingOperatorRector::class,
3029
DowngradeNumericLiteralSeparatorRector::class,
3130
DowngradeStripTagsCallWithArrayRector::class,
32-
DowngradeArraySpreadRector::class,
31+
// DowngradeArraySpreadRector::class,
32+
// already handled in PHP 8.1 set
3333
DowngradeArrayMergeCallWithoutArgumentsRector::class,
3434
DowngradeFreadFwriteFalsyToNegationRector::class,
3535
DowngradePreviouslyImplementedInterfaceRector::class,

config/set/downgrade-php81.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
declare(strict_types=1);
44

5+
use Rector\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector;
56
use Rector\DowngradePhp81\Rector\FuncCall\DowngradeHashAlgorithmXxHashRector;
67
use Rector\DowngradePhp81\Rector\LNumber\DowngradeOctalNumberRector;
78
use Rector\DowngradePhp81\Rector\MethodCall\DowngradeIsEnumRector;
89
use Rector\Config\RectorConfig;
910
use Rector\ValueObject\PhpVersion;
10-
use Rector\DowngradePhp81\Rector\Array_\DowngradeArraySpreadStringKeyRector;
1111
use Rector\DowngradePhp81\Rector\ClassConst\DowngradeFinalizePublicClassConstantRector;
1212
use Rector\DowngradePhp81\Rector\FuncCall\DowngradeArrayIsListRector;
1313
use Rector\DowngradePhp81\Rector\FuncCall\DowngradeFirstClassCallableSyntaxRector;
@@ -32,7 +32,8 @@
3232
DowngradeNewInInitializerRector::class,
3333
DowngradePhp81ResourceReturnToObjectRector::class,
3434
DowngradeReadonlyPropertyRector::class,
35-
DowngradeArraySpreadStringKeyRector::class,
35+
DowngradeArraySpreadRector::class,
36+
// DowngradeArraySpreadStringKeyRector::class,
3637
DowngradeArrayIsListRector::class,
3738
DowngradeSetAccessibleReflectionPropertyRector::class,
3839
DowngradeIsEnumRector::class,

rules/DowngradePhp81/Rector/Array_/DowngradeArraySpreadStringKeyRector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
/**
2222
* @changelog https://wiki.php.net/rfc/array_unpacking_string_keys
2323
*
24+
* @api testing if useful
25+
*
2426
* @see \Rector\Tests\DowngradePhp81\Rector\Array_\DowngradeArraySpreadStringKeyRector\DowngradeArraySpreadStringKeyRectorTest
2527
*/
2628
final class DowngradeArraySpreadStringKeyRector extends AbstractRector

0 commit comments

Comments
 (0)