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

Do not align equal sign with the body of an elseif statement #6338

Conversation

florisluiten
Copy link

With #6112 a change was introduced, which caused issues on our code base with assignments within else-statements. This pull request fixes one of these issues.

The binary operator on one line, should not be aligned to the next line if the binary operator is inside an statement. For example:

<?php
if ($statement) {
    $string = 'Some thing'; // This line should not be aligned with the next
} elseif (($error = file_get_contents($file)) !== false) {
    throw Exception();
}

Line three has an assignment. Currently, it will be aligned to the assignment on line three, which imo is not correct.

PS: I noticed in the contribution guidelines that fixes should be created on the lowest possible branch. However, I only see the master branch, is this a typo perhaps?

While it is debatable that using an assignment in an if-statement is considered to be a good code style, it makes no sense to align the equal sign from another block with it. So ignore the elseif statement bodies.
@florisluiten
Copy link
Author

Never mind, it was already fixed upstream :)

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

Successfully merging this pull request may close these issues.

None yet

1 participant