TypePHP 编译器 https://swoole.com/aot/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

30 lines
516 B

--TEST--
generator methods can access private properties
--FILE--
<?php
class PrivateGeneratorBox implements IteratorAggregate
{
private array $items;
public function __construct(array $items)
{
$this->items = $items;
}
public function getIterator(): Traversable
{
foreach ($this->items as $item) {
yield $item;
}
}
}
function main(): void
{
foreach (new PrivateGeneratorBox([1]) as $value) {
echo $value, "\n";
}
}
?>
--EXPECTF--
1