1--TEST--
2Observer: Generator with explicit return
3--SKIPIF--
4<?php if (!extension_loaded('zend-test')) die('skip: zend-test extension required'); ?>
5--INI--
6zend_test.observer.enabled=1
7zend_test.observer.observe_all=1
8zend_test.observer.show_return_value=1
9--FILE--
10<?php
11function getResults() {
12    for ($i = 10; $i < 13; $i++) {
13        yield $i;
14    }
15    return 1337;
16}
17
18function doSomething() {
19    $generator = getResults();
20    foreach ($generator as $value) {
21        echo $value . PHP_EOL;
22    }
23    echo $generator->getReturn() . PHP_EOL;
24
25    return 'Done';
26}
27
28echo doSomething() . PHP_EOL;
29?>
30--EXPECTF--
31<!-- init '%s%eobserver_generator_%d.php' -->
32<file '%s%eobserver_generator_%d.php'>
33  <!-- init doSomething() -->
34  <doSomething>
35    <!-- init getResults() -->
36    <getResults>
37    </getResults:10>
3810
39    <getResults>
40    </getResults:11>
4111
42    <getResults>
43    </getResults:12>
4412
45    <getResults>
46    </getResults:1337>
471337
48  </doSomething:'Done'>
49Done
50</file '%s%eobserver_generator_%d.php'>
51