Closed schlndh closed 1 year ago
@schlndh Thanks for reporting this. I have confirmed the issue and pulled PR #3792 which should fix this. Testing appreciated.
FYI: the fix for this issue is included in today's PHP_CodeSniffer 3.8.0 release.
As per #3932, development on PHP_CodeSniffer will continue in the PHPCSStandards/PHP_CodeSniffer repository. If you want to stay informed, you may want to start "watching" that repo (or watching releases from that repo).
Describe the bug It seems that normally the
? ... : ...
should be tokenized asT_INLINE_THEN ... T_INLINE_ELSE
, however if there is a match with default branch inside the "then" part then:
remainsT_COLON
, which can break some sniffs (in my case it's this 3rd party sniff).Code sample
This is tokenized as:
To reproduce Steps to reproduce the behavior:
test.php
with the code sample above...phpcs -vvv test.php ...
Expected behavior Tokenize
? ... : ...
asT_INLINE_THEN ... T_INLINE_ELSE
even withmatch (...) {default => ...}
inside then branch.Versions (please complete the following information):