php-src/Zend/tests/bug62609_2.phpt
Máté Kocsis 75a678a7e3
Declare tentative return types for Zend (#7251)
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-07-19 13:44:20 +02:00

23 lines
442 B
PHP

--TEST--
Bug #62609: Allow implementing Traversable on abstract classes (work)
--FILE--
<?php
abstract class AbstractTraversable implements Traversable {}
class NonAbstractTraversable extends AbstractTraversable implements IteratorAggregate {
public function getIterator(): Traversable {
yield "foo";
yield "bar";
}
}
foreach (new NonAbstractTraversable as $value) {
echo $value, "\n";
}
?>
--EXPECT--
foo
bar