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

File::findEndOfStatement() not working when passed a scope opener #1863

Closed
michalbundyra opened this issue Jan 24, 2018 · 2 comments
Closed
Milestone

Comments

@michalbundyra
Copy link
Contributor

while(true) {}
$v = 1;

When $stackPtr is set on while:

$end = $phpcsFile->findEndOfStatement($stackPtr);

then $end is the ; not the }.

Do you think it's a bug or desired behaviour?

@gsherwood
Copy link
Member

That's not desired behaviour, and my first instinct is to say "the end of the statement for scope blocks is always the scope closer" but I'd need to look into it before making a change like that. So I'll put it on 3.3.0 milestone instead of a straight bug-fix release.

@gsherwood gsherwood added this to the 3.3.0 milestone Feb 1, 2018
@gsherwood gsherwood changed the title findEndOfStatement incorrect behaviour? File::findEndOfStatement() not working when passed a scope opener Mar 15, 2018
gsherwood added a commit that referenced this issue Mar 16, 2018
@gsherwood
Copy link
Member

I've fixed this up by doing when I described in my previous comment. Also added some unit tests. Thanks a lot for reporting this.

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