You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The colon after a goto label does not have to be the very next token; there can be whitespace and comments between them. PHP_CodeSniffer will not tokenize the label correctly unless the colon immediately follows the label.
To fix this, T_GOTO_LABEL should be changed to include the label only, and exclude the colon.
When addressing this change, I believe there is a related bug, which should also be looked into and fixed: the use of context sensitive keywords as goto labels.
As things are, the context sensitive keywords layer in the tokenizer does not retokenize context sensitive keywords to T_STRING when these are used as a goto label.
While this will always be a parse error, I still believe the keywords should be retokenized to T_STRING for consistency. In the same way as context sensitive keywords used as the name of a class or (global) function are retokenized to T_STRING, even though those usages would also result in a parse error.
Repost from squizlabs/PHP_CodeSniffer#3161 by @gsherwood:
The text was updated successfully, but these errors were encountered: