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.
25 lines
476 B
25 lines
476 B
--TEST--
|
|
Symfony pattern: foreach over Traversable returned from method
|
|
--FILE--
|
|
<?php
|
|
|
|
final class TraversableProvider
|
|
{
|
|
public function getIterator(): ArrayIterator
|
|
{
|
|
return new ArrayIterator(['first' => 1, 'second' => 2]);
|
|
}
|
|
}
|
|
|
|
function main(): void
|
|
{
|
|
$provider = new TraversableProvider();
|
|
|
|
foreach ($provider->getIterator() as $key => $value) {
|
|
var_dump($key.':'.$value);
|
|
}
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
string(7) "first:1"
|
|
string(8) "second:2"
|
|
|