phpantom_lsp 0.7.0

Fast PHP language server with deep type intelligence. Generics, Laravel, PHPStan annotations. Ready in an instant.
Documentation
// test: negated @phpstan-assert removes type from union
// feature: completion
// Adapted from phpactor narrowing/narrow-negate.test
// expect: barMethod(
// expect_absent: fooMethod(
---
<?php

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

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

final class Assert
{
    /**
     * @phpstan-assert !Foobar $class
     */
    public static function assertNotFoobar($class): void
    {
    }
}

function test(Foobar|Barfoo $obj): void {
    Assert::assertNotFoobar($obj);
    $obj-><>
}