Closed greg0ire closed 4 years ago
Wait what, getType() returns self
rather than the actual type? FFS PHP
This seems ok to me - it could also have been done in a ClassPatch but they're not really meant for generic issues like this I suppose
Thanks @greg0ire
Wait what, getType() returns self rather than the actual type? FFS PHP
Yep, this is by design, and is the same reason it cannot raise a reflection exception. getType
is a purely syntactic operation. It just reads the type as is from the parser.
We need to do the same for parent
~parent
is not a valid type?~ Oh: https://3v4l.org/N6OId. 😆
Using self in the implementing class means narrowing the type, and result in an LSP violation (and a rightful crash from PHP). Resolving self to the declaring type results in a compatible signature.
Fixes #484