phpantom_lsp 0.7.0

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

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

/**
 * @template T
 */
class Foo {
    /**
     * @var T[]
     */
    private $a;

    /** @param T[] $a */
    public function __construct(array $a) {
        $this->a = $a;
    }

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

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