1
0
mirror of https://github.com/php/php-src.git synced 2026-04-23 16:08:35 +02:00
Files
archived-php-src/Zend/tests/generators/yield_from_valid_exception.phpt
T
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

31 lines
592 B
PHP

--TEST--
Exception from valid() during yield from
--FILE--
<?php
class FooBar implements Iterator {
function rewind(): void {}
function current(): mixed {}
function key(): mixed {}
function next(): void {}
function valid(): bool {
throw new Exception("Exception from valid()");
}
}
function gen() {
try {
// the fact that the yield from result is used is relevant.
var_dump(yield from new FooBar);
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
}
$x = gen();
$x->current();
?>
--EXPECT--
Exception from valid()