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

Empty statement sniff ? #975

Closed
jrfnl opened this Issue Jun 17, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@jrfnl
Contributor

jrfnl commented Jun 17, 2017

Example code:

function_call( $something );;

Fixed as:

function_call( $something );
;

Expected fix:

function_call( $something );

Should we add a sniff for this typo which won't cause a parse error ?

Came across this at least once so far when visually reviewing the core auto-fixes though can't find the relevant file ATM.

@JDGrimes

This comment has been minimized.

Show comment
Hide comment
@JDGrimes

JDGrimes Jun 17, 2017

Contributor

#465 is kind of related.

I found a request for something similar to this upstream: squizlabs/PHP_CodeSniffer#1119

The Squiz.WhiteSpace.SemicolonSpacing sniff will complain about the semicolon, I think, but it won't auto-fix.

Contributor

JDGrimes commented Jun 17, 2017

#465 is kind of related.

I found a request for something similar to this upstream: squizlabs/PHP_CodeSniffer#1119

The Squiz.WhiteSpace.SemicolonSpacing sniff will complain about the semicolon, I think, but it won't auto-fix.

@jrfnl

This comment has been minimized.

Show comment
Hide comment
@jrfnl

jrfnl Jun 17, 2017

Contributor

@JDGrimes Thanks for finding that upstream issue! I did recall seeing something about this before but couldn't recall where.

Considering there is an upstream feature request for this, I suggest creating a new sniff which in due time can be pulled upstream (would not be accepted in PHPCS 2.x anymore anyhow).

Regarding #465, while loosely related, it is a distinctly separate issue as the logic needed to detect this would be completely different.

Contributor

jrfnl commented Jun 17, 2017

@JDGrimes Thanks for finding that upstream issue! I did recall seeing something about this before but couldn't recall where.

Considering there is an upstream feature request for this, I suggest creating a new sniff which in due time can be pulled upstream (would not be accepted in PHPCS 2.x anymore anyhow).

Regarding #465, while loosely related, it is a distinctly separate issue as the logic needed to detect this would be completely different.

@jrfnl

This comment has been minimized.

Show comment
Hide comment
@jrfnl

jrfnl Jun 17, 2017

Contributor

N.B.: when upstreaming the feature, it would make sense to merge it into the Generic.CodeAnalysis.EmptyStatement sniff which currently checks for empty control structures.

Contributor

jrfnl commented Jun 17, 2017

N.B.: when upstreaming the feature, it would make sense to merge it into the Generic.CodeAnalysis.EmptyStatement sniff which currently checks for empty control structures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment