phpantom_lsp 0.7.0

Fast PHP language server with deep type intelligence. Generics, Laravel, PHPStan annotations. Ready in an instant.
Documentation
// test: instanceof narrowing works inside a class method
// feature: completion
// Adapted from phpactor if-statement/multiple_statements_with_class.test
// expect: barMethod(
// expect_absent: fooMethod(
---
<?php

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

class Bar {
    public function barMethod(): void {}
}

class TestClass {
    function test(Foo|Bar $foo): void {
        if (!$foo instanceof Bar) {
            return;
        }

        $foo-><>
    }
}