@@ -29,6 +29,9 @@ class BetterReflectionSourceLocatorFactory
2929 /** @var \PhpParser\Parser */
3030 private $ parser ;
3131
32+ /** @var \PhpParser\Parser */
33+ private $ php8Parser ;
34+
3235 /** @var PhpStormStubsSourceStubber */
3336 private $ phpstormStubsSourceStubber ;
3437
@@ -90,6 +93,7 @@ class BetterReflectionSourceLocatorFactory
9093 */
9194 public function __construct (
9295 \PhpParser \Parser $ parser ,
96+ \PhpParser \Parser $ php8Parser ,
9397 PhpStormStubsSourceStubber $ phpstormStubsSourceStubber ,
9498 ReflectionSourceStubber $ reflectionSourceStubber ,
9599 OptimizedSingleFileSourceLocatorRepository $ optimizedSingleFileSourceLocatorRepository ,
@@ -109,6 +113,7 @@ public function __construct(
109113 )
110114 {
111115 $ this ->parser = $ parser ;
116+ $ this ->php8Parser = $ php8Parser ;
112117 $ this ->phpstormStubsSourceStubber = $ phpstormStubsSourceStubber ;
113118 $ this ->reflectionSourceStubber = $ reflectionSourceStubber ;
114119 $ this ->optimizedSingleFileSourceLocatorRepository = $ optimizedSingleFileSourceLocatorRepository ;
@@ -165,7 +170,11 @@ public function create(): SourceLocator
165170 return $ this ->container ->getService ('betterReflectionFunctionReflector ' );
166171 });
167172
168- $ locators [] = new SkipClassAliasSourceLocator (new PhpInternalSourceLocator ($ astLocator , $ this ->phpstormStubsSourceStubber ));
173+ $ astPhp8Locator = new Locator ($ this ->php8Parser , function (): FunctionReflector {
174+ return $ this ->container ->getService ('betterReflectionFunctionReflector ' );
175+ });
176+
177+ $ locators [] = new SkipClassAliasSourceLocator (new PhpInternalSourceLocator ($ astPhp8Locator , $ this ->phpstormStubsSourceStubber ));
169178 $ locators [] = new ClassBlacklistSourceLocator ($ this ->autoloadSourceLocator , $ this ->staticReflectionClassNamePatterns );
170179 foreach ($ this ->composerAutoloaderProjectPaths as $ composerAutoloaderProjectPath ) {
171180 $ locator = $ this ->composerJsonAndInstalledJsonSourceLocatorMaker ->create ($ composerAutoloaderProjectPath );
0 commit comments