Skip to content

Commit d9bb246

Browse files
committed
Merge branch '1.5.x' into 1.6.x
2 parents 070b0b2 + 2a145ba commit d9bb246

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

conf/config.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,6 +1871,7 @@ services:
18711871
currentPhpVersionRichParser: @currentPhpVersionRichParser
18721872
currentPhpVersionSimpleParser: @currentPhpVersionSimpleParser
18731873
php8Parser: @php8Parser
1874+
singleReflectionFile: %singleReflectionFile%
18741875
autowired: false
18751876

18761877
# Error formatters

src/Parser/PathRoutingParser.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
class PathRoutingParser implements Parser
1010
{
1111

12+
private ?string $singleReflectionFile;
13+
1214
/** @var bool[] filePath(string) => bool(true) */
1315
private array $analysedFiles = [];
1416

@@ -17,8 +19,10 @@ public function __construct(
1719
private Parser $currentPhpVersionRichParser,
1820
private Parser $currentPhpVersionSimpleParser,
1921
private Parser $php8Parser,
22+
?string $singleReflectionFile,
2023
)
2124
{
25+
$this->singleReflectionFile = $singleReflectionFile !== null ? $fileHelper->normalizePath($singleReflectionFile) : null;
2226
}
2327

2428
/**
@@ -40,7 +44,7 @@ public function parseFile(string $file): array
4044
}
4145

4246
$file = $this->fileHelper->normalizePath($file);
43-
if (!isset($this->analysedFiles[$file])) {
47+
if (!isset($this->analysedFiles[$file]) && $file !== $this->singleReflectionFile) {
4448
return $this->currentPhpVersionSimpleParser->parseFile($file);
4549
}
4650

tests/PHPStan/Parser/CachedParserTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ public function testParseTheSameFileWithDifferentMethod(): void
8989
$fileHelper,
9090
self::getContainer()->getService('currentPhpVersionRichParser'),
9191
self::getContainer()->getService('currentPhpVersionSimpleDirectParser'),
92-
self::getContainer()->getService('php8Parser')
92+
self::getContainer()->getService('php8Parser'),
93+
null
9394
);
9495
$parser = new CachedParser($pathRoutingParser, 500);
9596
$path = $fileHelper->normalizePath(__DIR__ . '/data/test.php');

0 commit comments

Comments
 (0)