Wrong inference that get_parent_class()
always return false
#4302
Labels
Milestone
get_parent_class()
always return false
#4302
Bug report
When using
get_parent_class($object)
on something that may be a subclass, PHPStan assume that it can only returnfalse
.Code snippet that reproduces the problem
https://phpstan.org/r/a374c54d-1422-4c1e-9a34-5005f6668c8c
Expected output
When using an interface or a superclass, PHPStan should not be sure about the return being
false
, it should keep the typestring|false
, because the real object may be a subclass of the one typehintedThe text was updated successfully, but these errors were encountered: