Skip to content

Tokenizer: fix binary cast recognition with inside parentheses whitespace#2215

Merged
gsherwood merged 1 commit intosquizlabs:masterfrom
jrfnl:feature/tokenizer-more-binary-token-fixes
Nov 5, 2018
Merged

Tokenizer: fix binary cast recognition with inside parentheses whitespace#2215
gsherwood merged 1 commit intosquizlabs:masterfrom
jrfnl:feature/tokenizer-more-binary-token-fixes

Conversation

@jrfnl
Copy link
Copy Markdown
Contributor

@jrfnl jrfnl commented Nov 2, 2018

As reported in my last comment on the original issue #1574, the fix to the tokenizer does not take whitespace inside of the binary cast parentheses into account.

This PR fixes this.

It also adds a unit test which will guard against regressions to the Squiz.WhiteSpace.CastSpacing sniff.

As that sniff did not have a fixed file, while it does in actual fact contain a fixer, the .fixed file has also been added.

…pace

As reported in my last comment on the original issue 1574, the fix to the tokenizer does not take whitespace inside of the binary cast parentheses into account.

This PR fixes this.

It also adds a unit test which will guard against regressions to the `Squiz.WhiteSpace.CastSpacing` sniff.

As that sniff did not have a `fixed` file, while it _does_ in actual fact contain a fixer, the `.fixed` file has also been added.
@gsherwood
Copy link
Copy Markdown
Member

Thanks a lot. I guess I've coded my type casts the same for so long that I forgot you could have whitespace in there.

@gsherwood gsherwood added this to the 3.4.0 milestone Nov 5, 2018
@gsherwood gsherwood merged commit c784e4b into squizlabs:master Nov 5, 2018
gsherwood added a commit that referenced this pull request Nov 5, 2018
@jrfnl jrfnl deleted the feature/tokenizer-more-binary-token-fixes branch November 5, 2018 09:08
@jrfnl
Copy link
Copy Markdown
Contributor Author

jrfnl commented Nov 5, 2018

No worries, I just came across it when I was checking the PHPCS-cross-version compatibility with the token for the PHPCompatibility.TypeCasts.NewTypeCasts sniff. (and then had to find a sniff in PHPCS which would show the same issue)

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