-
Notifications
You must be signed in to change notification settings - Fork 660
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
Changed signature of Serializable::unserialize stub #6438
Conversation
There is a concrete difference between phpdoc and types in signature, even in stubs. To have a compatible implementation, you have to respect types in parent signature according to two rules:
This means that when you add a param type in signature, the implementation may keep its type empty (because empty is mixed and mixed is wider). However, as soon as you declare a return type, you require that each implementation declare a return type at least equal to what you added. This is why tests fail. In conclusion, you may keep types in signature for parameters but you have to keep them in phpdoc for return types |
879efba
to
f290e0f
Compare
@SCIF see https://3v4l.org/ZGMmf Psalm support PHP 7.1 and above. What must be done is add a version number to this test so it's only checked for a specific version |
@SCIF 7.4 is still in active support phase, so it's too soon to call that outdated. It's just version-dependent - valid for 8.0+, but invalid for <8.0. |
however this probably means we need to have stubs that depend on the php version. We already have a Php80.phpstub, but I think Psalm will fail if we have a class in two different stub, so we would need to have a Php7(1|2|3|4).phpstub to contain old signatures |
The test crashed is actually incorrect. Docs |
That seem correct, you can get rid of the test |
Done :) |
Thanks! |
Signature aligned with https://www.php.net/manual/en/serializable.unserialize.php