1--TEST--
2ReflectionGenerator::isClosed
3--FILE--
4<?php
5
6function empty_generator() {
7    return;
8    yield;
9}
10
11$gens = [
12    (function() {
13        yield;
14    })(),
15    empty_generator(),
16];
17
18foreach ($gens as $gen) {
19    $ref = new ReflectionGenerator($gen);
20    var_dump($ref->getExecutingLine());
21    var_dump($ref->isClosed());
22    var_dump($ref->getExecutingLine());
23    foreach ($gen as $dummy);
24    var_dump($ref->isClosed());
25    try {
26        var_dump($ref->getExecutingLine());
27    } catch (\Exception $e) {
28        echo $e->getMessage(), PHP_EOL;
29    }
30
31    echo PHP_EOL;
32}
33
34?>
35--EXPECT--
36int(9)
37bool(false)
38int(9)
39bool(true)
40Cannot fetch information from a closed Generator
41
42int(3)
43bool(false)
44int(3)
45bool(true)
46Cannot fetch information from a closed Generator
47