mirror of
https://github.com/php/php-src.git
synced 2025-01-05 18:33:56 +08:00
28 lines
309 B
PHP
28 lines
309 B
PHP
--TEST--
|
|
Yield can be used during a method call
|
|
--FILE--
|
|
<?php
|
|
|
|
class A {
|
|
public function b($c) {
|
|
echo $c, "\n";
|
|
}
|
|
}
|
|
|
|
function gen() {
|
|
$a = new A;
|
|
$a->b(yield);
|
|
}
|
|
|
|
$gen = gen();
|
|
$gen->send('foo');
|
|
|
|
// test resource cleanup
|
|
$gen = gen();
|
|
$gen->rewind();
|
|
unset($gen);
|
|
|
|
?>
|
|
--EXPECT--
|
|
foo
|