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

Ternary whitespace check ? #988

Closed
jrfnl opened this issue Jun 20, 2017 · 0 comments · Fixed by #989
Closed

Ternary whitespace check ? #988

jrfnl opened this issue Jun 20, 2017 · 0 comments · Fixed by #989

Comments

@jrfnl
Copy link
Member

jrfnl commented Jun 20, 2017

Looks like whitespace around ternary operators is currently not checked.

Should it be ?

Upstream this has been added to the WhiteSpace.OperatorSpacing sniff. The WPCS version of this sniff has not been synced with upstream for quite a long time.
Might be worth checking if the WP version can be removed and defer to the upstream version instead.

$a = ($a > 10)?$a:10;

will yield no errors.

I would expect this to error on:

  • no whitespace before "inline then" / ? - expected 1 space
  • no whitespace after "inline then" / ? - expected 1 space
  • no whitespace before "inline else" / : - expected 1 space
  • no whitespace after "inline else" / : - expected 1 space

As a side-note, I'm also missing these notifications:

  • no whitespace after the open parenthesis
  • no whitespace before the closing parenthesis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants