1010use PHPStan \BetterReflection \SourceLocator \Type \MemoizingSourceLocator ;
1111use PHPStan \BetterReflection \SourceLocator \Type \PhpInternalSourceLocator ;
1212use PHPStan \BetterReflection \SourceLocator \Type \SourceLocator ;
13- use PHPStan \Reflection \BetterReflection \SourceLocator \LazySourceLocator ;
1413use PHPStan \Reflection \BetterReflection \SourceLocator \OptimizedPsrAutoloaderLocatorFactory ;
1514use PHPStan \Reflection \BetterReflection \SourceLocator \OptimizedSingleFileSourceLocatorRepository ;
1615use function dirname ;
@@ -31,14 +30,10 @@ public function __construct(
3130 public function create (): SourceLocator
3231 {
3332 $ locators = [];
34- $ locators [] = new LazySourceLocator (function () {
35- $ locators = [];
36- foreach ($ this ->stubFilesProvider ->getStubFiles () as $ stubFile ) {
37- $ locators [] = $ this ->optimizedSingleFileSourceLocatorRepository ->getOrCreate ($ stubFile );
38- }
39-
40- return new AggregateSourceLocator ($ locators );
41- });
33+ $ astPhp8Locator = new Locator ($ this ->php8Parser );
34+ foreach ($ this ->stubFilesProvider ->getStubFiles () as $ stubFile ) {
35+ $ locators [] = $ this ->optimizedSingleFileSourceLocatorRepository ->getOrCreate ($ stubFile );
36+ }
4237
4338 $ locators [] = $ this ->optimizedPsrAutoloaderLocatorFactory ->create (
4439 Psr4Mapping::fromArrayMappings ([
@@ -51,7 +46,6 @@ public function create(): SourceLocator
5146 ]),
5247 );
5348
54- $ astPhp8Locator = new Locator ($ this ->php8Parser );
5549 $ locators [] = new PhpInternalSourceLocator ($ astPhp8Locator , $ this ->phpStormStubsSourceStubber );
5650
5751 return new MemoizingSourceLocator (new AggregateSourceLocator ($ locators ));
0 commit comments