mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-24 11:44:14 +01:00
Merge pull request #3130 from rectorphp/fix-array-merge
Fix missing array key in ArrayMergeOfNonArraysToSimpleArrayRector
This commit is contained in:
commit
79f7fd52a2
@ -83,7 +83,7 @@ PHP
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($nestedArrayItem->items as $nestedArrayItemItem) {
|
foreach ($nestedArrayItem->items as $nestedArrayItemItem) {
|
||||||
$array->items[] = new ArrayItem($nestedArrayItemItem->value);
|
$array->items[] = new ArrayItem($nestedArrayItemItem->value, $nestedArrayItemItem->key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Rector\CodeQuality\Tests\Rector\FuncCall\ArrayMergeOfNonArraysToSimpleArrayRector\Fixture;
|
||||||
|
|
||||||
|
class WithKeys
|
||||||
|
{
|
||||||
|
public function go()
|
||||||
|
{
|
||||||
|
$type = 't';
|
||||||
|
$query = 'q';
|
||||||
|
|
||||||
|
$res = array_merge(['results' => []], ['query' => $query, 'type' => $type]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
-----
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Rector\CodeQuality\Tests\Rector\FuncCall\ArrayMergeOfNonArraysToSimpleArrayRector\Fixture;
|
||||||
|
|
||||||
|
class WithKeys
|
||||||
|
{
|
||||||
|
public function go()
|
||||||
|
{
|
||||||
|
$type = 't';
|
||||||
|
$query = 'q';
|
||||||
|
|
||||||
|
$res = ['results' => [], 'query' => $query, 'type' => $type];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user