Skip to content

Commit 9a127bb

Browse files
authored
Use clone over empty nodes and setAttributes() (#303)
1 parent 64c9794 commit 9a127bb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rules/DowngradePhp74/Rector/Array_/DowngradeArraySpreadRector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ private function refactorArrayConstValue(Array_ $array): ?Array_
173173
{
174174
$hasChanged = false;
175175

176-
$newArray = new Array_();
177-
$newArray->setAttributes($array->getAttributes());
176+
$newArray = clone $array;
177+
$newArray->items = [];
178178

179179
foreach ($array->items as $item) {
180180
$newArray->items[] = $item;

0 commit comments

Comments
 (0)