1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
--TEST-- Fully qualified classes in trait return types --FILE-- <?php namespace FooSpace; trait Fooable { function foo(): \Iterator { return new \EmptyIterator(); } } class Foo { use Fooable; } $foo = new Foo; var_dump($foo->foo([])); --EXPECTF-- object(EmptyIterator)#%d (%d) { }