howto get child type returned, not parent #7013
-
I read PHPStan documentation and tried a lot, but I don't understand how to get the child class detected by PHPStan in this code, or even if it is possible...
The link to the playground : https://phpstan.org/r/53aebcc3-717b-445c-8715-0f277151270b Thanks for your help ! |
Beta Was this translation helpful? Give feedback.
Answered by
ondrejmirtes
Apr 11, 2022
Replies: 1 comment 1 reply
-
The only way to achieve this is with generics: https://phpstan.org/r/5ed2bf49-e9fe-43b6-b279-182458ff358a |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
rdefaux
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The only way to achieve this is with generics: https://phpstan.org/r/5ed2bf49-e9fe-43b6-b279-182458ff358a