Arquivos
hhvm/hphp/test/quick/closure_gen_scope.php
T
ptarjan 503f75d08b Rename test directories
These names don't make sense now that we run both suites the same
way.
2013-04-17 09:06:51 -07:00

23 linhas
328 B
PHP

<?php
class X {
private $priv = 'X';
function foo() {
return function ($x) {
yield $x->priv;
};
}
}
class Y extends X { private $priv = 'Y'; }
class Z extends X { private $priv = 'Z'; }
function test($x) {
$f = $x->foo();
foreach ($f($x) as $v) var_dump($v);
}
test(new X);
test(new Y);
test(new Z);