@@ -52,8 +52,8 @@ services:
5252 pathRoutingParser :
5353 class : PHPStan\Parser\PathRoutingParser
5454 arguments :
55- currentPhpVersionRichParser : @currentPhpVersionRichParser
56- currentPhpVersionSimpleParser : @currentPhpVersionSimpleParser
55+ currentPhpVersionRichParser : @cachedRichParser
56+ currentPhpVersionSimpleParser : @cachedSimpleParser
5757 php8Parser : @php8Parser
5858 singleReflectionFile : %singleReflectionFile%
5959 autowired : false
@@ -64,14 +64,29 @@ services:
6464 wrappedParser : @defaultAnalysisParser
6565 autowired : false
6666
67- defaultAnalysisParser :
67+ # the cache sits behind the routing: CachedParser keys by source code, so
68+ # one cache in front of it would hand the body-stripped AST of a file
69+ # outside the analysed paths to an analysed file with the same contents
70+ cachedRichParser :
71+ class : PHPStan\Parser\CachedParser
72+ arguments :
73+ originalParser : @currentPhpVersionRichParser
74+ cachedNodesByStringCountMax : %cache.nodesByStringCountMax%
75+ cachedSourceBytesMax : %cache.nodesByStringSourceBytesMax%
76+ autowired : false
77+
78+ cachedSimpleParser :
6879 class : PHPStan\Parser\CachedParser
6980 arguments :
70- originalParser : @pathRoutingParser
81+ originalParser : @currentPhpVersionSimpleParser
7182 cachedNodesByStringCountMax : %cache.nodesByStringCountMax%
7283 cachedSourceBytesMax : %cache.nodesByStringSourceBytesMax%
7384 autowired : false
7485
86+ defaultAnalysisParser :
87+ factory : @pathRoutingParser
88+ autowired : false
89+
7590 freshStubParser :
7691 class : PHPStan\Parser\StubParser
7792 arguments :
0 commit comments