Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jrfnl opened this issue Mar 23, 2019 · 3 comments
Closed

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

jrfnl opened this issue Mar 23, 2019 · 3 comments
Milestone

Comments

@jrfnl
Copy link
Contributor

jrfnl commented Mar 23, 2019

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.

@gsherwood
Copy link
Member

Good idea

@gsherwood
Copy link
Member

I think they're all gone now.

@jrfnl
Copy link
Contributor Author

jrfnl commented Jan 31, 2020

Great news!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants