Skip to content

Commit c2dbd45

Browse files
ondrejmirtesclaude
andcommitted
Bump FileTypeMapper cache key to discard entries poisoned by comment-dropping parses
A run with the turbo comment-loss bug (phpstan/phpstan#15037) cached PHPDoc-less name-scope maps under ftm- keys. The entries validate only by file content hashes and the phpdoc-parser version, so an upgrade to the fixed extension keeps trusting them — analysis stays broken (missing generics, mass false positives) until the tmpDir is wiped by hand, and clear-result-cache does not help. Rotate the variable cache key to v6 so every installation rebuilds the maps once. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EpvCn4kVHSaS5aaiaaRhEm
1 parent dfba023 commit c2dbd45

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/Type/FileTypeMapper.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,11 @@ private function getNameScopeMap(string $fileName): array
347347
}
348348

349349
$cacheKey = sprintf('ftm-%s', $fileName);
350-
$variableCacheKey = sprintf('v5-%s', ComposerHelper::getPhpDocParserVersion());
350+
// v6: v5 entries may be poisoned by the turbo comment-loss bug
351+
// (https://github.com/phpstan/phpstan/issues/15037) - a parse that
352+
// silently dropped every comment cached PHPDoc-less name-scope maps,
353+
// and the content hashes cannot tell them apart from real ones.
354+
$variableCacheKey = sprintf('v6-%s', ComposerHelper::getPhpDocParserVersion());
351355
$cached = $this->loadCachedPhpDocNodeMap($cacheKey, $variableCacheKey);
352356
if ($cached === null) {
353357
[$nameScopeMap, $files] = $this->createPhpDocNodeMap($fileName, null, null, [], $fileName);

0 commit comments

Comments
 (0)