[ForeachItemsAssignToEmptyArrayToAssignRector] apply on code it should not#2587
Conversation
|
Could add fix as well? |
|
Again, I might be able to - provided some context. What is this rector rule really about ? What are all the edge cases that might be broken, except the two I had in my code base ? What's the vision for it and how to implement it ? I know nothing of it right now, and as I only have a small amount of time to dedicate to OSS, the better the explanation the greater the chances I can contribute efficiently. :) |
|
Allright :) I'll try my best. Ask whatever you need to know. The rule is about removing foreach of array, that does basically assign of array: class SomeClass
{
public function run($items)
{
$items2 = [];
- foreach ($items as $item) {
- $items2[] = $item;
- }
+ $items2 = $items;
}
}Everything else should be skipped - those edge-cases you've detected. I'll put comment there |
09636e8 to
0a64874
Compare
|
All good! :) Thanks for the help. |
|
Great job, thanks 👍 |
rectorphp/rector-src@d180768 [Core] Apply auto fallback to use Scope from File when Node both doesnot has parent Node and Scope (#2587)
No description provided.