xref: /PHP-8.4/Zend/tests/bug62609_2.phpt (revision 75a678a7)
1--TEST--
2Bug #62609: Allow implementing Traversable on abstract classes (work)
3--FILE--
4<?php
5
6abstract class AbstractTraversable implements Traversable {}
7
8class NonAbstractTraversable extends AbstractTraversable implements IteratorAggregate {
9    public function getIterator(): Traversable {
10        yield "foo";
11        yield "bar";
12    }
13}
14
15foreach (new NonAbstractTraversable as $value) {
16    echo $value, "\n";
17}
18
19?>
20--EXPECT--
21foo
22bar
23