phpantom_lsp 0.7.0

Fast PHP language server with deep type intelligence. Generics, Laravel, PHPStan annotations. Ready in an instant.
Documentation
// 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-><>
    }
}