You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Generic.CodeAnalysis.ForLoopShouldBeWhileLoop sniff is used to detect for loops that can be simplified to while loops. Currently, the sniff is triggered only when it finds a for loop that only has the second expression (for (;$test;) {).
While working on #226, I noticed that for loops without any expression (for (;;)) do not trigger this sniff. It is not clear whether this was an intentional decision when the sniff was created or if it was missed.
Per @jrfnl suggestion, I'm opening this issue to gather opinions on whether or not the ForLoopShouldBeWhileLoop sniff should be changed to throw a warning when it finds for loops without any expression. I'm inclined to think that we should change it, but I don't have a strong opinion on this.
I intend to create a pull request to implement this feature.
The text was updated successfully, but these errors were encountered:
The Generic.CodeAnalysis.ForLoopShouldBeWhileLoop sniff is used to detect
for
loops that can be simplified towhile
loops. Currently, the sniff is triggered only when it finds afor
loop that only has the second expression (for (;$test;) {
).While working on #226, I noticed that
for
loops without any expression (for (;;)
) do not trigger this sniff. It is not clear whether this was an intentional decision when the sniff was created or if it was missed.Per @jrfnl suggestion, I'm opening this issue to gather opinions on whether or not the ForLoopShouldBeWhileLoop sniff should be changed to throw a warning when it finds
for
loops without any expression. I'm inclined to think that we should change it, but I don't have a strong opinion on this.The text was updated successfully, but these errors were encountered: