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
Return type T does not accept T&null #5860
Comments
Looks like a doublicate issue, or?: #5591 |
/cc @arnaud-lb Also this one :) |
@jlherren After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-9: Function test() should return T but returns T&null.
+No errors |
Fixed: phpstan/phpstan-src@9f12f0f |
ondrejmirtes
added a commit
to phpstan/phpstan-src
that referenced
this issue
Feb 28, 2022
Closes phpstan/phpstan#6464 Closes phpstan/phpstan#6423 Closes phpstan/phpstan#6418 Closes phpstan/phpstan#6230 Closes phpstan/phpstan#5860
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug report
After upgrading to PHPStan 1.0, I find that a function that should return
T
does not accept returningT&null
, whereT
is a template type.Code snippet that reproduces the problem
https://phpstan.org/r/984459d4-1124-4ca9-888c-dc3d31b979fb
Expected output
No error
Did PHPStan help you today? Did it make you happy in any way?
I'm all excited about the 1.0 release :)
The text was updated successfully, but these errors were encountered: