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(): Generator {
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--
20Fatal error: Declaration of SomeCollection::getIterator(): Generator must be compatible with Collection::getIterator(): Iterator in %sgenerators003.php on line 6
21