php-src/Zend/tests/generators/generator_static_method.phpt
2012-07-20 17:40:04 +02:00

30 lines
411 B
PHP

--TEST--
A static method can be a generator
--FILE--
<?php
class Test {
public static function gen() {
var_dump(get_class());
var_dump(get_called_class());
yield 1;
yield 2;
yield 3;
}
}
class ExtendedTest extends Test {
}
foreach (ExtendedTest::gen() as $i) {
var_dump($i);
}
?>
--EXPECT--
string(4) "Test"
string(12) "ExtendedTest"
int(1)
int(2)
int(3)