Skip to content

Suggestion: remove warnings/errors for detected parse errors (PHPCS 4) #2455

Closed
@jrfnl

Description

@jrfnl

Most sniffs will just bow out during live coding/when they encounter parse errors.

There are however a number of sniffs which will either throw an exception or a CS warning/error when a parse error is encountered.

In my opinion, a linter should be used to check for parse errors, preferably before running PHPCS over code as the results of PHPCS will be unreliable anyway when code contains parse errors (we can't account for every situation).

For those people who are uncomfortable running a linter themselves, PHPCS offers the Generic.PHP.Syntax sniff which will run the linter for them.

With all that in mind, I would like to suggest removing all parse error related warnings/errors/exceptions from sniff code within PHPCS (not from the Tokenizer classes!) in PHPCS 4.0.0 in favour of just silently bowing out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions