-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[5.2] Strengthen dealing with null keys #12958
Conversation
@@ -3080,12 +3080,16 @@ public function setRawAttributes(array $attributes, $sync = false) | |||
/** | |||
* Get the model's original attribute values. | |||
* | |||
* @param string|null $key | |||
* @param null|string $key |
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.
please revet that
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 have changed the other way around, and that's indeed better.
Isn't this how Arr::get already works though? If the key is null it will just return the array? |
That's exactly what |
Yeah I've already written this a few times. It depends if you consider using |
It's a regular use case. Passing null as the key returns the entire array. |
@taylorotwell Ok I see the issue. |
@@ -3082,10 +3082,14 @@ public function setRawAttributes(array $attributes, $sync = false) | |||
* | |||
* @param string|null $key | |||
* @param mixed $default | |||
* @return array | |||
* @return mixed|array |
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.
Still it would be relevant to apply this phpdoc fix.
Follow-up to #12946.
No behaviour changes, just polishing in order to prevent regressions.