Closed jrfnl closed 1 year ago
@jrfnl Thank you. I tried patching my phpcs with changes from this PR. It did fix the issue that I reported in the context where I encountered it. No new issues popped up in that project. I tried the same in a much larger project and I didn't encounter any new issues either.
Thank you for testing and confirming the fix @schlndh !
FYI: this fix 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).
This fixes the mis-identification of a
T_DEFAULT
token within a (not yet retokenized)match
structure as aswitch
default
token, which resulted in aT_COLON
token incorrectly not being retokenized toT_INLINE_ELSE
.As a complete test file for ternary tokenization does not exist (yet), I've added a unit test to the
Squiz.Objects.ObjectInstantiation
sniff. The code in the test would cause a false positive for theObjectInstantiation
sniff without this fix.Fixes #3789