// test: IteratorAggregate with key and value generic types resolves value in foreach
// feature: completion
// Adapted from phpactor generics/iterator_aggregate2.test
// expect: execute(
---
<?php
class Command {
public function execute(): void {}
}
/**
* @template TKey
* @template TValue
* @extends \IteratorAggregate<TKey, TValue>
*/
interface TypedCollection extends \IteratorAggregate {}
/**
* @implements TypedCollection<string, Command>
*/
class CommandCollection implements TypedCollection {}
function test(CommandCollection $commands): void {
foreach ($commands as $key => $command) {
$command-><>
}
}