diff --git a/tests/PHPStan/Analyser/AnalyserIntegrationTest.php b/tests/PHPStan/Analyser/AnalyserIntegrationTest.php index 442e5863fe..6f9b3116c0 100644 --- a/tests/PHPStan/Analyser/AnalyserIntegrationTest.php +++ b/tests/PHPStan/Analyser/AnalyserIntegrationTest.php @@ -1184,6 +1184,12 @@ public function testBug5091(): void $this->assertNoErrors($errors); } + public function testBug9346(): void + { + $errors = $this->runAnalyse(__DIR__ . '/data/bug-9346.php'); + $this->assertNoErrors($errors); + } + public function testBug9459(): void { $errors = $this->runAnalyse(__DIR__ . '/data/bug-9459.php'); diff --git a/tests/PHPStan/Analyser/NodeScopeResolverTest.php b/tests/PHPStan/Analyser/NodeScopeResolverTest.php index 6a8c6b517d..0fad39c8a5 100644 --- a/tests/PHPStan/Analyser/NodeScopeResolverTest.php +++ b/tests/PHPStan/Analyser/NodeScopeResolverTest.php @@ -181,6 +181,8 @@ public function dataFileAsserts(): iterable yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Methods/data/bug-9542.php'); yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Functions/data/bug-9803.php'); yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/PhpDoc/data/bug-10594.php'); + + yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Methods/data/bug-9346.php'); } /** diff --git a/tests/PHPStan/Analyser/data/bug-9346.php b/tests/PHPStan/Analyser/data/bug-9346.php new file mode 100644 index 0000000000..5331126b4d --- /dev/null +++ b/tests/PHPStan/Analyser/data/bug-9346.php @@ -0,0 +1,64 @@ + 'baz']; + + /** + * @phpstan-return FooJson + */ + public function sayHello(DateTime $date): array + { + return $this->var; + } + }; + return $foo; + } +}