We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b6569e1 commit d2d205fCopy full SHA for d2d205f
rules/DowngradePhp74/Rector/Array_/DowngradeArraySpreadRector.php
@@ -194,15 +194,22 @@ private function refactorArrayConstValue(Array_ $array): ?Array_
194
195
$constants = $classLike->getConstants();
196
197
+ $hasChangedOnCurrentIteration = false;
198
foreach ($constants as $constant) {
199
$const = $constant->consts[0];
200
201
if ($const->name->toString() === $name->toString() && $const->value instanceof Array_) {
202
$newArray->items = array_merge($newArray->items, $const->value->items);
203
204
$hasChanged = true;
205
+ $hasChangedOnCurrentIteration = true;
206
}
207
208
+
209
+ if (! $hasChangedOnCurrentIteration) {
210
+ $newArray->items[] = $item;
211
+ }
212
213
214
215
if ($hasChanged) {
0 commit comments