-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[5.4] else unnecessary in this snippet #19475
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
Conversation
|
@geekcom Tests is failing now.. |
| $this->items[$key] = $value; | ||
| } | ||
|
|
||
| $this->items[$key] = $value; |
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.
this is always going to be executed now
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.
@geekcom: you could've only done that shortening if you were breaking the path of execution (using guard clauses for instance). I wouldn't recommend that though, since it alters type signature in this case.
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.
ok, let's see what happens with this PR.
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.
you broke the functionality of at least 1 method for no reason at all ... what do you think is going to happen? :)
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.
humm, that's make sense, so sorry
|
In short, there is nothing 'unnecessary or redundant' about this else. |
| usort($items, function () { | ||
| return rand(-1, 1); | ||
| }); | ||
|
|
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.
again ... this is now always going to be executed
elsecondition within that method of yours is either unnecessary or redundant.