// 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-><>
}