1--TEST--
2ReflectionGenerator basic test
3--FILE--
4<?php
5
6function foo() {
7	yield;
8}
9
10$gens = [
11	(new class() {
12		function a() {
13			yield from foo();
14		}
15	})->a(),
16	(function() {
17		yield;
18	})(),
19	foo(),
20];
21
22foreach ($gens as $gen) {
23	var_dump($gen);
24
25	$gen->valid(); // start Generator
26	$ref = new ReflectionGenerator($gen);
27
28	var_dump($ref->getTrace());
29	var_dump($ref->getExecutingLine());
30	var_dump($ref->getExecutingFile());
31	var_dump($ref->getExecutingGenerator());
32	var_dump($ref->getFunction());
33	var_dump($ref->getThis());
34}
35
36?>
37--EXPECTF--
38object(Generator)#2 (0) {
39}
40array(1) {
41  [0]=>
42  array(4) {
43    ["file"]=>
44    string(%d) "%s"
45    ["line"]=>
46    int(%d)
47    ["function"]=>
48    string(3) "foo"
49    ["args"]=>
50    array(0) {
51    }
52  }
53}
54int(%d)
55string(%d) "%sReflectionGenerator_basic.%s"
56object(Generator)#6 (0) {
57}
58object(ReflectionMethod)#8 (2) {
59  ["name"]=>
60  string(1) "a"
61  ["class"]=>
62  string(%d) "class@anonymous%s"
63}
64object(class@anonymous)#1 (0) {
65}
66object(Generator)#4 (0) {
67}
68array(0) {
69}
70int(%d)
71string(%d) "%sReflectionGenerator_basic.%s"
72object(Generator)#4 (0) {
73}
74object(ReflectionFunction)#7 (1) {
75  ["name"]=>
76  string(9) "{closure}"
77}
78NULL
79object(Generator)#5 (0) {
80}
81array(0) {
82}
83int(%d)
84string(%d) "%sReflectionGenerator_basic.%s"
85object(Generator)#5 (0) {
86}
87object(ReflectionFunction)#8 (1) {
88  ["name"]=>
89  string(3) "foo"
90}
91NULL
92