-
Notifications
You must be signed in to change notification settings - Fork 11.7k
get and has method else removed #24029
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
|
this is not redundant. this changes execution since the |
nunomaduro
left a comment
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.
I believe the code is more readable with your proposal. I have requested some changed tho. 👍
| $array = $array[$segment]; | ||
| } else { | ||
| return value($default); | ||
| if (!static::accessible($array) && !static::exists($array, $segment)) { |
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.
I believe you made a mistake here. The code you are looking for is:
if (! static::accessible($array) || ! static::exists($array, $segment)) {
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.
Uh... I missed to turn the and to an or!
| $subKeyArray = $subKeyArray[$segment]; | ||
| } else { | ||
| return false; | ||
| if (!static::accessible($subKeyArray) && !static::exists($subKeyArray, $segment)) { |
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.
I believe you made a mistake here. The code you are looking for is:
if (! static::accessible($subKeyArray) || ! static::exists($subKeyArray, $segment)) {
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.
Uh... I missed to turn the and to an or!
|
Tests are failing. |
|
I am continuously unable to understand how this type of change contributes anything to anyone. The PR description is misleading. This isn't not removing a redundant else, it is attempting to inverse the logic of a condition in order to make the else redundant, and then removing it. Keyword being "attempting" because this simply negated both sides of an and gate instead of negating the actual condition. In short, this doesn't fix anything, the PR description is misleading, and I fail to see how |
|
@tillkruss Yeah. There is a mistake on the new if condition 😕 |
|
Please resubmit with CI passing. |
|
Uh... A lot has happened here while I was sleeping! 😮 Anyway, I'm fixing the issue and will resubmit the PR. Thanks to all of you. 😄 |
getandhasmethod's redundantelsecondition removed.