Narrowing return type on inheritance for abstract method through PHPdoc causes PHP error
问题 Assume we have the following inheritance chain in PHP abstract class Entity {} abstract class RealEntity extends Entity {} abstract class PseudoEntity extends Entity {} and a bunch of other classes that mirror the same inheritance chain abstract class EntitySerializer { /** * @return Entity */ abstract public function getEntity(); } abstract class RealEntitySerializer extends EntitySerializer { /** * @return RealEntity */ abstract public function getEntity(); } abstract class