-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic/InlineControlStructures: sniff does not allow while without body #2822
Comments
100% agree.
I think the sniff should ignore them. Happy to change the tests to align with this change. |
@gsherwood Thanks for the response. PR #2827 should fix it in that case. |
Just realized that for ($i = 1, $j = 0; $i <= 10; $j += $i, print $i, $i++); |
A
while
control structure without body is perfectly valid PHP but gets flagged by theGeneric.ControlStructures.InlineControlStructures
sniff.See: https://3v4l.org/RXNqL
As far as I can see, the sniff is intended to find inline control structures with a body, but without braces and fix those. An inline control structure without a body should be outside the scope of this sniff.
I've got a fix ready for this, but found that a number of existing unit test would start failing (line 42, 43, 226, 228 and 230).
@gsherwood With that in mind, I'd like second opinion on how the sniff should handle
while
structures without body.As an alternative to the fix I've got prepared, I could create a fix which would maintain the existing behaviour, but would give
while
structures without a body a different error code.Opinions ?
The text was updated successfully, but these errors were encountered: