1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
--TEST-- Return type covariance; extends class --FILE-- <?php class A { function foo(): A {} } class B extends A { function foo(): StdClass {} } --EXPECTF-- Fatal error: Declaration of B::foo() must be compatible with A::foo(): A in %s on line %d