phpantom_lsp 0.7.0

Fast PHP language server with deep type intelligence. Generics, Laravel, PHPStan annotations. Ready in an instant.
Documentation
// test: __invoke with Generator return type resolves item type in foreach
// feature: completion
// Adapted from phpactor call-expression/invoke2.test
// expect: format(
---
<?php

class Foobar
{
    /**
     * @return \Generator<DateTime>
     */
    public function __invoke(): \Generator
    {
        yield new DateTime();
    }
}

class DateTime {
    public function format(string $f): string {}
}

class Baz
{
    private Foobar $foo;

    public function __construct(Foobar $foo) {
        $this->foo = $foo;
    }

    public function baz(): void {
        foreach (($this->foo)() as $bar) {
            $bar-><>
        }
    }
}