Question about generics and required verbosity #10798
-
Playground: https://phpstan.org/r/e0ebd5cf-8308-44fe-98a8-5047f48fc3f1 Method
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The tip on the playground tries to explain it:
What it means: Let's say you have If you have Your types do not guarantee that. This is the fix: https://phpstan.org/r/72a9e0a7-4c7d-4ed7-9977-64b1df59ca05 |
Beta Was this translation helpful? Give feedback.
The tip on the playground tries to explain it:
What it means: Let's say you have
C<X, Y>
. This means thatgetAWithError
has to returnX
.If you have
C<Alpha, Beta>
,getAWithError
needs to returnAlpha
.Your types do not guarantee that. This is the fix: https://phpstan.org/r/72a9e0a7-4c7d-4ed7-9977-64b1df59ca05