php-src/ext/spl/tests/RecursiveIteratorIterator_invalid_aggregate.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

21 lines
498 B
PHP

--TEST--
RecursiveIteratorIterator constructor should thrown if IteratorAggregate does not return Iterator
--FILE--
<?php
class MyIteratorAggregate implements IteratorAggregate {
#[ReturnTypeWillChange]
function getIterator() {
return null;
}
}
try {
new RecursiveIteratorIterator(new MyIteratorAggregate);
} catch (LogicException $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
MyIteratorAggregate::getIterator() must return an object that implements Traversable