Skip to content

Change T_GOTO_LABEL to not include colon #3161

Closed
@gsherwood

Description

@gsherwood

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.

So a: becomes:

T_GOTO_LABEL => a
T_COLON => :

Instead of:

T_GOTO_LABEL => a:

And a /*comment here*/ : becomes:

T_GOTO_LABEL => a
T_WHITESPACE => ·
T_COMMENT => /*comment·here*/
T_WHITESPACE => ·
T_COLON => :

Instead of:

T_STRING => a
T_WHITESPACE => ·
T_COMMENT => /*comment·here*/
T_WHITESPACE => ·
T_COLON => :

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions