phpantom_lsp 0.7.0

Fast PHP language server with deep type intelligence. Generics, Laravel, PHPStan annotations. Ready in an instant.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// test: negated instanceof with throw narrows nullable type
// feature: completion
// Adapted from phpactor if-statement/nullable.test
// expect: fooMethod(
---
<?php

class Foo {
    public function fooMethod(): void {}
}

function test(?Foo $foobar): void {
    if (!$foobar instanceof Foo) {
        throw new \RuntimeException('not a Foo');
    }

    $foobar-><>
}