diff --git a/rules/php-74/src/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector.php b/rules/php-74/src/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector.php index 240b5be45ca3..11c5c5ec2815 100644 --- a/rules/php-74/src/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector.php +++ b/rules/php-74/src/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector.php @@ -100,8 +100,12 @@ private function refactorArray(FuncCall $funcCall): ?Array_ $array = new Array_(); foreach ($funcCall->args as $arg) { - $value = $arg->value; + // cannot handle unpacked arguments + if ($arg->unpack) { + return null; + } + $value = $arg->value; if ($this->shouldSkipArrayForInvalidTypeOrKeys($value)) { return null; } diff --git a/rules/php-74/tests/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector/Fixture/skip_spread_array_merge.php.inc b/rules/php-74/tests/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector/Fixture/skip_spread_array_merge.php.inc new file mode 100644 index 000000000000..3a7a09391c15 --- /dev/null +++ b/rules/php-74/tests/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector/Fixture/skip_spread_array_merge.php.inc @@ -0,0 +1,20 @@ +