1--TEST-- 2Internal covariant return type of self 3--FILE-- 4<?php 5class Foo { 6 public static function test() : self { 7 return new Foo; 8 } 9} 10 11class Bar extends Foo { 12 public static function test() : parent { 13 return new Bar; 14 } 15} 16 17var_dump(Bar::test()); 18var_dump(Foo::test()); 19--EXPECTF-- 20object(Bar)#%d (0) { 21} 22object(Foo)#%d (0) { 23} 24