1--TEST--
2Return type covariance works with generators
3--FILE--
4<?php
5interface Collection extends IteratorAggregate {
6    function getIterator(): Iterator;
7}
8
9class SomeCollection implements Collection {
10    function getIterator(): Iterator {
11        foreach ($this->data as $key => $value) {
12            yield $key => $value;
13        }
14    }
15}
16
17$some = new SomeCollection();
18var_dump($some->getIterator());
19--EXPECTF--
20object(Generator)#%d (%d) {
21}
22