有没有办法访问 YIELD 的 KEY 或者只能通过 foreach 循环接受?
function foo()
{
yield 'bar' => 'baz';
}
$foo = foo();
foreach ($foo as $key => $val)
echo $key; // output: bar
$foo = foo();
echo key($foo->current()); //Warning: key() expects parameter 1 to be array, string given