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

Alternative control structure syntax not always recognized as scoped #1503

Closed
jrfnl opened this issue Jun 10, 2017 · 2 comments
Closed

Alternative control structure syntax not always recognized as scoped #1503

jrfnl opened this issue Jun 10, 2017 · 2 comments
Milestone

Comments

@jrfnl
Copy link
Contributor

jrfnl commented Jun 10, 2017

Going out of PHP breaks recognition of scope for alternative control structure syntax.

In the below code sample, the continue in the first example has the T_FOR token as a condition in the tokens array, while the continue in the second example does not.

for ($x=0;$x<5;$x++):
  if ($x) continue;
endfor;

for ($x=0;$x<5;$x++):
  if ($x) continue ?> <?php
endfor;

This bug exists in both the PHPCS 2.x as well as the PHPCS 3.x branches.

@gsherwood gsherwood changed the title Tokenizer bug: alternative control structure syntax not always recognized as scoped. Alternative control structure syntax not always recognized as scoped Jun 29, 2017
@gsherwood gsherwood added this to the 3.0.2 milestone Jun 29, 2017
gsherwood added a commit that referenced this issue Jun 29, 2017
@gsherwood
Copy link
Member

Fixed in master, but I'd only want to back-port a tokenizer change if it's been there for a while.

Thanks for the report.

@jrfnl
Copy link
Contributor Author

jrfnl commented Jun 29, 2017

@gsherwood Thanks for fixing this! A backport at some point ("after a while") would be appreciated too!

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