Skip to content

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Jun 23, 2022

Follow up to PR #3546, which changed how the parent keyword in a new parent snippet was tokenized from T_STRING to T_PARENT.

The T_PARENT keyword token, however, was not included in the Tokens::$functionNameTokens array, which was the underlying cause for the bug reported in #3618.

Fixed now.

Tested by adding additional tests to the Generic.WhiteSpace.ArbitraryParenthesesSpacing sniff. These tests passed in PHPCS 3.6.2 and started failing in PHPCS 3.7.0. Once this fix has been merged, the tests will pass again.

Fixes #3618

Follow up to PR 3546, which changed how the `parent` keyword in a `new parent` snippet was tokenized from `T_STRING` to `T_PARENT`.

The `T_PARENT` keyword token, however, was not included in the `Tokens::$functionNameTokens` array, which was the underlying cause for the bug reported in 3618.

Fixed now.

Tested by adding additional tests to the `Generic.WhiteSpace.ArbitraryParenthesesSpacing` sniff. These tests passed in PHPCS 3.6.2 and started failing in PHPCS 3.7.0. Once this fix has been merged, the tests will pass again.
@ondrejmirtes
Copy link

I confirm this fixes the issue for me 👍 Thank you!

gsherwood added a commit that referenced this pull request Jun 27, 2022
@gsherwood gsherwood merged commit 80b4b4e into squizlabs:master Jun 27, 2022
@gsherwood
Copy link
Member

Thanks for tracking this down and fixing it

@gsherwood gsherwood added this to the 3.7.2 milestone Jun 27, 2022
@jrfnl jrfnl deleted the feature/3618-generic-arbitrary-parentheses-bugfix branch June 27, 2022 23:11
@jrfnl
Copy link
Contributor Author

jrfnl commented Jun 27, 2022

You're welcome ;-)

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

Successfully merging this pull request may close these issues.

Generic.WhiteSpace.ArbitraryParenthesesSpacing false positive for return new parent()
3 participants