1--TEST-- 2Inheritance Hinting Compile Checking Failure Internal Classes 3--INI-- 4opcache.enable_cli=1 5--FILE-- 6<?php 7class Foo { 8 public static function test() : Traversable { 9 return new ArrayIterator([1, 2]); 10 } 11} 12 13class Bar extends Foo { 14 public static function test() : Traversable { 15 return new ArrayObject([1, 2]); 16 } 17} 18 19var_dump(Bar::test()); 20var_dump(Foo::test()); 21--EXPECTF-- 22object(ArrayObject)#%d (1) { 23 ["storage":"ArrayObject":private]=> 24 array(2) { 25 [0]=> 26 int(1) 27 [1]=> 28 int(2) 29 } 30} 31object(ArrayIterator)#%d (1) { 32 ["storage":"ArrayIterator":private]=> 33 array(2) { 34 [0]=> 35 int(1) 36 [1]=> 37 int(2) 38 } 39} 40