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

multi-line if statements indent incorrectly #19

Open
createthis opened this issue Jan 8, 2018 · 0 comments
Open

multi-line if statements indent incorrectly #19

createthis opened this issue Jan 8, 2018 · 0 comments

Comments

@createthis
Copy link

createthis commented Jan 8, 2018

Example:

  if ((1) ||
      (2) ||
        (3)
     ) {
       echo 'foo';
     }

The above is bad because visually it looks like we're still inside the if statement as the indent has changed.

It's also a little messed up in the case of the ) { inline on the third line:

if ((1) ||
    (2) ||
      (3)) {
  echo 'foo';
}

but it gets worse with two lines inside the if:

if (1 ||
    2 ||
      3) {
  echo 'foo';
echo 'bar';
}

and finally, with the bracket on a new line:

if ((1) ||
    (2) ||
      (3))
  {
    echo 'foo';
  }

I would expect these to indent as so:

if ((1) ||
    (2) ||
    (3)
) {
  echo 'foo';
}

if ((1) ||
    (2) ||
    (3)) {
  echo 'foo';
}

if (1 ||
    2 ||
    3) {
  echo 'foo';
  echo 'bar';
}

if ((1) ||
    (2) ||
      (3))
{
  echo 'foo';
}

or like this (possibly configurable):

if ((1) ||
  (2) ||
  (3)
) {
  echo 'foo';
}

if ((1) ||
  (2) ||
  (3)) {
  echo 'foo';
}

if (1 ||
  2 ||
  3) {
  echo 'foo';
  echo 'bar';
}

if ((1) ||
  (2) ||
  (3))
{
  echo 'foo';
}
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

1 participant