squizlabs / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
10.67k stars 1.48k forks source link

Name of typed enum tokenized as T_GOTO_LABEL #3534

Closed jrfnl closed 2 years ago

jrfnl commented 2 years ago

Follow up on #3478.

When an enum would be backed by a type and the colon would directly follow the name of the enum, the name would be incorrectly tokenized (including the colon) as T_GOTO_LABEL.

Discovered while reviewing #3482

Also related to #3161

/cc @kukulich


Tests/BackfillEnum: update token calculations

... after the bugfix for T_GOTO_LABEL.

Also added a minor tweak to one test case to make sure that spacing around the type colon is handled correctly.

jrfnl commented 2 years ago

@gsherwood Could this PR please be milestoned to 3.7.0 ?

gsherwood commented 2 years ago

Thanks for finding and fixing this.