Skip to content
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.InlineControlStructureSniff breaks with a comment between body and condition in do while loops #1577

Closed
ht-bs opened this issue Jul 27, 2017 · 1 comment

Comments

@ht-bs
Copy link
Contributor

ht-bs commented Jul 27, 2017

A comment between the body and condition in do while loops, as illustrated below, breaks the Generic.InlineControlStructureSniff by producing the following error:

Inline control structures are not allowed (Generic.ControlStructures.InlineControlStructure.NotAllowed)

do
{
}
// Comment
while (true);

Is this intended behavior? If not, a fix would be to replace the search for anything but a T_WHITESPACE token, with a search for anything but Tokens::$emptyTokens in line 86:
https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Generic/Sniffs/ControlStructures/InlineControlStructureSniff.php#L86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants