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?> 22--EXPECTF-- 23object(ArrayObject)#%d (1) { 24 ["storage":"ArrayObject":private]=> 25 array(2) { 26 [0]=> 27 int(1) 28 [1]=> 29 int(2) 30 } 31} 32object(ArrayIterator)#%d (1) { 33 ["storage":"ArrayIterator":private]=> 34 array(2) { 35 [0]=> 36 int(1) 37 [1]=> 38 int(2) 39 } 40} 41