diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 393520283e..da9441bbf2 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -153,6 +153,8 @@ jobs: extensions: "" - script: "bin/phpstan analyse -l 8 tests/e2e/anon-class/Granularity.php" extensions: "" + - script: "bin/phpstan analyse -l 8 e2e/phpstan-phpunit-190/test.php -c e2e/phpstan-phpunit-190/test.neon" + extensions: "" steps: - name: "Checkout" diff --git a/e2e/phpstan-phpunit-190/test.neon b/e2e/phpstan-phpunit-190/test.neon new file mode 100644 index 0000000000..e69de29bb2 diff --git a/e2e/phpstan-phpunit-190/test.php b/e2e/phpstan-phpunit-190/test.php new file mode 100644 index 0000000000..ad8e71720f --- /dev/null +++ b/e2e/phpstan-phpunit-190/test.php @@ -0,0 +1,27 @@ += 8.1 + +namespace PhpstanPhpUnit190; + +class FoobarTest +{ + public function testBaz(): int + { + $matcher = new self(); + $this->acceptCallback(static function (string $test) use ($matcher): string { + match ($matcher->testBaz()) { + 1 => 1, + 2 => 2, + default => new \LogicException() + }; + + return $test; + }); + + return 1; + } + + public function acceptCallback(callable $cb): void + { + + } +} diff --git a/src/Node/Expr/AlwaysRememberedExpr.php b/src/Node/Expr/AlwaysRememberedExpr.php index 6df48fc9aa..049ad46a6b 100644 --- a/src/Node/Expr/AlwaysRememberedExpr.php +++ b/src/Node/Expr/AlwaysRememberedExpr.php @@ -9,7 +9,7 @@ class AlwaysRememberedExpr extends Expr implements VirtualNode { - public function __construct(private Expr $expr, private Type $type, private Type $nativeType) + public function __construct(public Expr $expr, private Type $type, private Type $nativeType) { parent::__construct([]); } @@ -39,7 +39,7 @@ public function getType(): string */ public function getSubNodeNames(): array { - return []; + return ['expr']; } }