-
-
Notifications
You must be signed in to change notification settings - Fork 864
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
Covariance problem with template type with $this and static #9195
Comments
And that's exactly why this error is reported. The linked article explains it. |
@ondrejmirtes Yes, |
Yes. You can't have everything because that leads to unsafe code. |
@ondrejmirtes thank you. one phpstan ignore /w Still have one question - why |
@mvorisek It might start working when this suggestion is implemented #6732 (comment) |
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. |
Bug report
In #9153 (comment) I was advised to use
@template
instead of@template-covariant
. But then I get another phpstan error:I would say the phpstan error (with
@template
) is wrong, as$this
is strictly a subtype ofstatic
.Code snippet that reproduces the problem
https://phpstan.org/r/6897d3da-b2b5-4a31-b740-927310bd6e72 (with
@template-covariant
)https://phpstan.org/r/75af0bc1-1122-4734-8b36-b8cc966c32df (with
@template
)Expected output
no error
The text was updated successfully, but these errors were encountered: