diff --git a/tests/PHPStan/Analyser/AnalyserIntegrationTest.php b/tests/PHPStan/Analyser/AnalyserIntegrationTest.php index 908ac69fdc..dfc11a9947 100644 --- a/tests/PHPStan/Analyser/AnalyserIntegrationTest.php +++ b/tests/PHPStan/Analyser/AnalyserIntegrationTest.php @@ -1507,6 +1507,15 @@ public function testBug13279(): void $this->assertSame('Parameter #2 $offset of function array_splice expects int, string given.', $errors[0]->getMessage()); } + public function testBug13310(): void + { + // require file to make sure the defined function is known + require_once __DIR__ . '/data/bug-13310.php'; + + $errors = $this->runAnalyse(__DIR__ . '/data/bug-13310.php'); + $this->assertNoErrors($errors); + } + /** * @param string[]|null $allAnalysedFiles * @return Error[] diff --git a/tests/PHPStan/Analyser/data/bug-13310.php b/tests/PHPStan/Analyser/data/bug-13310.php new file mode 100644 index 0000000000..f5c56bffdb --- /dev/null +++ b/tests/PHPStan/Analyser/data/bug-13310.php @@ -0,0 +1,28 @@ + + */ +function get_array(): array +{ + return []; +} + +$tests = get_array(); + +foreach ($tests as $test) { + +// information fichiers + $test['information'] = ''; + $test['information'] .= $test['a'] ? 'test' : ''; + $test['information'] .= $test['b'] ? 'test' : ''; + $test['information'] .= $test['c'] ? 'test' : ''; + $test['information'] .= $test['d'] ? 'test' : ''; + $test['information'] .= $test['e'] ? 'test' : ''; + $test['information'] .= $test['f'] ? 'test' : ''; + $test['information'] .= $test['g'] ? 'test' : ''; + $test['information'] .= $test['h'] ? 'test' : ''; + +}