-
Notifications
You must be signed in to change notification settings - Fork 11.4k
[9.x] fixed issue on which class to check increment and decrement methods for custom cast #45444
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
[9.x] fixed issue on which class to check increment and decrement methods for custom cast #45444
Conversation
…rement methods for custom cast
Wouldn't it be better to just call the existing |
I see your point @Sjord But the I'm fine with both solutions tho. I'll just wait for someone to review it and if needed I can update it. |
I think a test would be good here. |
|
||
$castType = $this->parseCasterClass($this->getCasts()[$key]); | ||
if (method_exists($castType, 'castUsing')) { | ||
$castType = $castType::castUsing([]); |
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.
Wouldn't calling the "castUsing" method with an empty array disregards any given cast parameters?
@taylorotwell I'll work on the test |
@taylorotwell I made some changes:
|
This fix is related to the issue mentioned on #45418
The code was checking if the increment/decrement methods were available on one class but then using another class to actually call the methods. This fix is for the code to check the same class that will be called the methods.