Arquivos
hhvm/hphp/test/quick/generator_method.php
T
Paul Tarjan 269ec416d5 Rename closures and generators - take 3
This reverts commit 2e9677b7c3f37e9627b9cbc9a6ddec82a10e7215.

Third time is the charm. I hid it from reflection, but I missed `get_class_methods`.

The diff betweenn this and what was reverted is https://phabricator.fb.com/P2217891 and then I did https://phabricator.fb.com/P2217904 because it looked like it should be done.
2013-06-12 11:34:39 -07:00

19 linhas
317 B
PHP

<?php
class A {
public function Gen() {
var_dump($this);
yield 1; yield 2; yield 3;
}
public static function SGen() {
var_dump(get_called_class());
yield 4; yield 5; yield 6;
}
}
$a = new A();
foreach ($a->Gen() as $num) { var_dump($num); }
foreach (A::SGen() as $num) { var_dump($num); }