[DeadCode] Skip count() on mixed on RemoveUnusedNonEmptyArrayBeforeForeachRector#5160
[DeadCode] Skip count() on mixed on RemoveUnusedNonEmptyArrayBeforeForeachRector#5160samsonasik merged 1 commit intomainfrom
Conversation
|
Fixed 🎉 /cc @staabm |
|
@staabm while it fixed the issue, could you create a https://3v4l.org/ demo for how it can cause invalid usage without skipping? Otherwise, the patch is useless :) |
|
see https://3v4l.org/bavqQ where we get fatal errors on the |
|
The error is exists on the first place, so removing when no change yet, it already fatal error. In real app, actually, removing |
I don't get your point. IMO we can't change code which fatal errors (so from a runtime perspective will stop execution and will not proceed) with a different code which no longer fatal errors and keeps executing. sure the code not running into fatal errors sounds better but if rector is doing such change it completely changes the code beeing executed and because of procssing is not running into a fatal error anymore it might lead to e.g. other serious problem in code after that, which was never executed before rector did the change |
|
That seems just hiding the real issue then. If the code after that must not be executed, then code should be modified to fix that. The |
|
back to square one: the only thing I am saying is, that rector cannot do a change which fundamentally changes the execution path. of course such a code should be fixed by a human. the |
|
Ok, the rule is named I am merging it then ;) |
Fixes rectorphp/rector#8265