Can't typehint object return type #4286
Answered
by
ondrejmirtes
MarkusRodler
asked this question in
Support
-
https://phpstan.org/r/1c0a0785-9490-412b-a3cc-5eafdd0704bb /**
* @template T
* @param class-string<T> $className
* @param int $id
* @return T|null
*/
function findEntity(string $className, int $id): object; => PHPDoc tag @return with type mixed is not subtype of native type object. I want to use generic support for my project but i can't tell phpstan that the output of my function is not mixed. |
Beta Was this translation helpful? Give feedback.
Answered by
ondrejmirtes
Dec 28, 2020
Replies: 1 comment 1 reply
-
Sure: https://phpstan.org/r/ecf88871-e51f-480d-bca5-7269658543fe |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ondrejmirtes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sure: https://phpstan.org/r/ecf88871-e51f-480d-bca5-7269658543fe