-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[VarExporter] fix contravariance problem with __unserialize() in lazy proxy #57460
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
[VarExporter] fix contravariance problem with __unserialize() in lazy proxy #57460
Conversation
Not adding types will cause trouble in other scenarios. We should probably document how to use the trait in untyped codebases. |
Instead, we could generate the method in ProxyHelper maybe? use LazyProxyTrait {
__unserialize as __doUnserialize;
}
public function __unserialize($data): void { $this->__doUnserialize($data); } |
0f62950
to
37e6102
Compare
wouldn't this cause issues in those other cases mentioned above ? And if no, why not updating the trait directly ? |
as a curiosity, which would be these scenarios?
done! |
for correctness and also to allow child classes to add the type hint I'd say |
764f35b
to
41ea97a
Compare
Tests are failing so there are some details to fix but this looks good to me so far, thanks. |
yes, I saw this... any hints about the failure? |
The PR title does not reflect the proposed change anymore though. |
41ea97a
to
0591cc9
Compare
b475c47
to
59ceea9
Compare
59ceea9
to
6630f5e
Compare
Thank you @nikophil. |
LazyProxyTrait::__unserialize()
has currently the following prototype:public function __unserialize(array $data): void
. So, classes defining this__unserialize()
method without thearray
type hint could not useLazyProxyTrait