1 2 3 4 5 6 7 8 9 10 11 12 13
--TEST-- Return type of parent is allowed in closure --FILE-- <?php class A {} class B extends A {} $c = function(parent $x): parent { return $x; }; var_dump($c->bindTo(null, 'B')(new A)); --EXPECTF-- object(A)#%d (0) { }