Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Rector\Php74\Tests\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector\Fixture;

use stdClass;

class SkipSpreadyArrayMerge
{
public function run()
{
$values = [
[new stdClass()],
[new stdClass]
];

$items = array_merge(...$values);

return array_merge($items, ...$values);
}
}