phpantom_lsp 0.7.0

Fast PHP language server with deep type intelligence. Generics, Laravel, PHPStan annotations. Ready in an instant.
Documentation
// test: constructor with generic argument infers template type
// feature: completion
// Adapted from phpactor generics/constructor-generic-arg.test
// expect: strMethod(
---
<?php

/**
 * @template T
 */
class Foobar {
    /**
     * @param T $fo
     */
    public function __construct($fo) {}
}

/**
 * @template T
 */
class Foo {
    /** @param Foobar<T> $a */
    public function __construct(Foobar $a) {}

    /**
     * @return T
     */
    public function a() {}
}

class StringResult {
    public function strMethod(): void {}
}

$f = new Foo(new Foobar(new StringResult()));
$f->a()-><>