The reason is probably that return types are currently invariant, so a inheriting class would have to declare the parent as return type anyway.
Lee Davis <leedavi...@gmail.com> schrieb am Di., 1. März 2016 12:46: > Hi Internals, > > whilst recently playing with return type hints on PHP 7 I noticed that > "static" cannot be used as a valid return type. I'm not entirely sure > whether this has been purposely prevented or not. > > https://3v4l.org/LEXis > > The behaviour works it's just a parse error that's stopping it. It's fairly > easy to get around this behaviour by using 'self' on the return hint > however I'm not too sure how correct this is considering you might want to > have that method be extendable. > > https://3v4l.org/rk4W6 > > I always considered 'self' to represent the class where the definition > lies, and 'static' to mean the caller class (i.e. when using LSB) so it > might be something that you'd want to define on the type hint. > > Do you think this is something we should allow into the type system? > > Thoughts? >