Fix for
0..n-1 iteration to foreach
#7286
Replies: 2 comments
-
It's also not equivalent:
|
Beta Was this translation helpful? Give feedback.
-
After @TimWolla's comment and additional thinking about it, I am not sure if it's worth the hassle. Fixer is not a complete SCA tool and lack of code context may be a problem here. Such fixer would be risky by definition and since we don't have mechanism for ignoring parts of the code, it could be problematic for some codebases and end up as disabled via config. With IDE regex search and replace you can use Things that should be taken into consideration within such fixer:
That's why I think we should close this feature request, especially that it did not get attention from other people. But I am going to convert this into discussion, because it should be created there in the first place. |
Beta Was this translation helpful? Give feedback.
-
Feature request
In legacy codes I find very often code patterns like:
which should be converted to:
the later code is much more readable and faster.
$i =>
part can be removed if$i
is not used in the script further.Beta Was this translation helpful? Give feedback.
All reactions