Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CodeQuality] Handle array destructuring of unpack on ArrayMergeOfNon…
…ArraysToSimpleArrayRector (#5682) * add failing test when using array deconstruction for ArrayMergeOfNonArraysToSimpleArrayRector * Test auto commit after update github actions (#5676) * Test auto commit after update github actions * [ci-review] Rector Rectify --------- Co-authored-by: GitHub Action <actions@github.com> * handle unpack * handle unpack * handle unpack * handle unpack --------- Co-authored-by: Kévin Grenier <kgrenier@campings.com> Co-authored-by: GitHub Action <actions@github.com>
- Loading branch information
1 parent
2846b01
commit 1cd83be
Showing
2 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
...or/FuncCall/ArrayMergeOfNonArraysToSimpleArrayRector/Fixture/destructuring_arrays.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\FuncCall\ArrayMergeOfNonArraysToSimpleArrayRector\Fixture; | ||
|
||
class DestructuringArrays | ||
{ | ||
public function go() | ||
{ | ||
$values = array_merge( | ||
[ | ||
['foo' => 'bar'], | ||
...$this->deconstructable(), | ||
] | ||
); | ||
|
||
return $values; | ||
} | ||
|
||
private function deconstructable() | ||
{ | ||
return ['rector']; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\FuncCall\ArrayMergeOfNonArraysToSimpleArrayRector\Fixture; | ||
|
||
class DestructuringArrays | ||
{ | ||
public function go() | ||
{ | ||
$values = [['foo' => 'bar'], ...$this->deconstructable()]; | ||
|
||
return $values; | ||
} | ||
|
||
private function deconstructable() | ||
{ | ||
return ['rector']; | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters