From 981c7ba51a8ad0b774dcd760bcfc32ea9a9b7534 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Fri, 22 Dec 2023 14:35:22 +0100 Subject: [PATCH] Regression test Closes https://github.com/phpstan/phpstan/issues/5086 --- .../Analyser/NodeScopeResolverTest.php | 1 + tests/PHPStan/Analyser/data/bug-5086.php | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/PHPStan/Analyser/data/bug-5086.php diff --git a/tests/PHPStan/Analyser/NodeScopeResolverTest.php b/tests/PHPStan/Analyser/NodeScopeResolverTest.php index 605ca80172..b55ec321ff 100644 --- a/tests/PHPStan/Analyser/NodeScopeResolverTest.php +++ b/tests/PHPStan/Analyser/NodeScopeResolverTest.php @@ -121,6 +121,7 @@ public function dataFileAsserts(): iterable yield from $this->gatherAssertTypes(__DIR__ . '/data/inherit-phpdoc-merging-template.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-3266.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-3269.php'); + yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5086.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/assign-nested-arrays.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-3276.php'); yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Methods/data/bug-6856.php'); diff --git a/tests/PHPStan/Analyser/data/bug-5086.php b/tests/PHPStan/Analyser/data/bug-5086.php new file mode 100644 index 0000000000..6018447ba7 --- /dev/null +++ b/tests/PHPStan/Analyser/data/bug-5086.php @@ -0,0 +1,26 @@ +doFoo())) { + return; + } + + assertType(stdClass::class, $obj); + } + +}