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

3.x: Squiz/EmbeddedPHP sniff - prevent fixer conflict #1554

Merged

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Jul 11, 2017

The Squiz.PHP.EmbeddedPhp sniff will create a fixer conflict with itself when it encounters a // comment just before the PHP close tag.

The tokenizer will tokenize whitespace at the end of a // comment as part of the T_COMMENT token, so the fixer just keeps adding more spaces between the T_COMMENT and the T_CLOSE_TAG which in the next fixer round is then tokenized again as being part of the T_COMMENT resulting in the loop.

The `Squiz.PHP.EmbeddedPhp` sniff will create a fixer conflict with itself when it encounters a `//` comment just before the PHP close tag.

The tokenizer will tokenize whitespace at the end of a `//` comment as part of the `T_COMMENT` token, so the fixer just keeps adding more spaces between the `T_COMMENT` and the `T_CLOSE_TAG` which in the next fixer round is then tokenized again as being part of the `T_COMMENT` resulting in the loop.
@gsherwood gsherwood merged commit f1db2ba into squizlabs:master Jul 12, 2017
@jrfnl jrfnl deleted the feature/3.x-fixer-conflict-squiz-embeddedphp branch July 12, 2017 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants