1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 16:38:25 +02:00
Files
archived-php-src/Zend/tests/generators/yield_during_method_call.phpt
2012-08-20 12:53:18 +02:00

36 lines
405 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);
// test cloning
$g1 = gen();
$g1->rewind();
$g2 = clone $g1;
unset($g1);
$g2->send('bar');
?>
--EXPECT--
foo
bar