|
16 | 16 | use PHPStan\Cache\Cache; |
17 | 17 | use PHPStan\DependencyInjection\AutowiredParameter; |
18 | 18 | use PHPStan\DependencyInjection\AutowiredService; |
| 19 | +use PHPStan\Internal\ComposerHelper; |
19 | 20 | use PHPStan\Php\PhpVersion; |
20 | 21 | use PHPStan\Reflection\BetterReflection\SourceLocator\AutoloadFunctionsSourceLocator; |
21 | 22 | use PHPStan\Reflection\BetterReflection\SourceLocator\AutoloadSourceLocator; |
22 | 23 | use PHPStan\Reflection\BetterReflection\SourceLocator\ComposerJsonAndInstalledJsonSourceLocatorMaker; |
| 24 | +use PHPStan\Reflection\BetterReflection\SourceLocator\FileCachedSourceLocator; |
23 | 25 | use PHPStan\Reflection\BetterReflection\SourceLocator\FileNodesFetcher; |
24 | 26 | use PHPStan\Reflection\BetterReflection\SourceLocator\OptimizedDirectorySourceLocatorRepository; |
25 | 27 | use PHPStan\Reflection\BetterReflection\SourceLocator\OptimizedPsrAutoloaderLocatorFactory; |
@@ -163,14 +165,18 @@ public function create(): SourceLocator |
163 | 165 | ); |
164 | 166 | } |
165 | 167 | } |
166 | | - $cachedPhpstormSourceStubber = new CachedPhpStormStubsSourceStubber( |
167 | | - $this->phpstormStubsSourceStubber, |
168 | | - $this->cache, |
169 | | - $this->phpVersion, |
170 | | - ); |
| 168 | + |
| 169 | + $phpstormStubsVersion = ComposerHelper::getPhpStormStubsVersion(); |
171 | 170 |
|
172 | 171 | $locators[] = new RewriteClassAliasSourceLocator(new AggregateSourceLocator($fileLocators)); |
173 | | - $locators[] = new SkipClassAliasSourceLocator(new PhpInternalSourceLocator($astPhp8Locator, $cachedPhpstormSourceStubber)); |
| 172 | + $locators[] = new SkipClassAliasSourceLocator( |
| 173 | + new FileCachedSourceLocator( |
| 174 | + new PhpInternalSourceLocator($astPhp8Locator, $this->phpstormStubsSourceStubber), |
| 175 | + $this->cache, |
| 176 | + $this->phpVersion, |
| 177 | + sprintf('phpstorm-stubs-php8-%s', $phpstormStubsVersion) |
| 178 | + ) |
| 179 | + ); |
174 | 180 |
|
175 | 181 | $locators[] = new AutoloadSourceLocator($this->fileNodesFetcher, true); |
176 | 182 | $locators[] = new PhpVersionBlacklistSourceLocator(new PhpInternalSourceLocator($astLocator, $this->reflectionSourceStubber), $cachedPhpstormSourceStubber); |
|
0 commit comments