You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using PHPStan v0.12.25. This may be related to #3273 but seemed different enough that it's worth reporting. If it is the same issue, I figure it might be helpful just to shed light on the bug from another angle.
I'm using a static factory method to create new instances of the generic Collection class. Since it's a static method (and therefore shouldn't be able to inherit the class type variable), I've declared a new method-level type variable and declared that the method returns a Collection of those method-level types. Unfortunately it causes this error:
Method Collection::ofType() should return Collection<U of Immutable> but returns Collection<Immutable>.
Bug report
Using PHPStan v0.12.25. This may be related to #3273 but seemed different enough that it's worth reporting. If it is the same issue, I figure it might be helpful just to shed light on the bug from another angle.
I'm using a static factory method to create new instances of the generic Collection class. Since it's a static method (and therefore shouldn't be able to inherit the class type variable), I've declared a new method-level type variable and declared that the method returns a Collection of those method-level types. Unfortunately it causes this error:
Code snippet that reproduces the problem
https://phpstan.org/r/d388d25d-7ccc-4f4f-89f2-7fafde83fa83
Expected output
I would expect there to be no errors. For reference, this works in Psalm: https://psalm.dev/r/6b3ad129ed
The text was updated successfully, but these errors were encountered: