-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Remove unnecessary else #6714
Remove unnecessary else #6714
Conversation
lib/Doctrine/ORM/Query/SqlWalker.php
Outdated
@@ -751,7 +751,8 @@ public function walkSelectClause($selectClause) | |||
foreach ($class->associationMappings as $assoc) { | |||
if ( ! ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE)) { | |||
continue; | |||
} else if ( !$addMetaColumns && !isset($assoc['id'])) { | |||
} | |||
if ( !$addMetaColumns && !isset($assoc['id'])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an empty line between logical blocks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ocramius thanks, done!
lib/Doctrine/ORM/Query/SqlWalker.php
Outdated
} else if ( !$addMetaColumns && !isset($assoc['id'])) { | ||
} | ||
|
||
if ( !$addMetaColumns && !isset($assoc['id'])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guiajlopes according to our CS we need spaces before AND after the negation operator, so this should be:
if ( ! $addMetaColumns && ! isset($assoc['id'])) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to turn this into a single IF
with an OR
instead? Like:
if ( ! ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE)
|| ( ! $addMetaColumns && ! isset($assoc['id']))) {
I mean, both are fine... just wondering 😜
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lcobucci thanks for your review, make sense to turn in the same if statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @guiajlopes
Just a small improvement in the code since the else is unnecessary on this case