@@ -29,6 +29,9 @@ class BetterReflectionSourceLocatorFactory
29
29
/** @var \PhpParser\Parser */
30
30
private $ parser ;
31
31
32
+ /** @var \PhpParser\Parser */
33
+ private $ php8Parser ;
34
+
32
35
/** @var PhpStormStubsSourceStubber */
33
36
private $ phpstormStubsSourceStubber ;
34
37
@@ -90,6 +93,7 @@ class BetterReflectionSourceLocatorFactory
90
93
*/
91
94
public function __construct (
92
95
\PhpParser \Parser $ parser ,
96
+ \PhpParser \Parser $ php8Parser ,
93
97
PhpStormStubsSourceStubber $ phpstormStubsSourceStubber ,
94
98
ReflectionSourceStubber $ reflectionSourceStubber ,
95
99
OptimizedSingleFileSourceLocatorRepository $ optimizedSingleFileSourceLocatorRepository ,
@@ -109,6 +113,7 @@ public function __construct(
109
113
)
110
114
{
111
115
$ this ->parser = $ parser ;
116
+ $ this ->php8Parser = $ php8Parser ;
112
117
$ this ->phpstormStubsSourceStubber = $ phpstormStubsSourceStubber ;
113
118
$ this ->reflectionSourceStubber = $ reflectionSourceStubber ;
114
119
$ this ->optimizedSingleFileSourceLocatorRepository = $ optimizedSingleFileSourceLocatorRepository ;
@@ -165,7 +170,11 @@ public function create(): SourceLocator
165
170
return $ this ->container ->getService ('betterReflectionFunctionReflector ' );
166
171
});
167
172
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 ));
169
178
$ locators [] = new ClassBlacklistSourceLocator ($ this ->autoloadSourceLocator , $ this ->staticReflectionClassNamePatterns );
170
179
foreach ($ this ->composerAutoloaderProjectPaths as $ composerAutoloaderProjectPath ) {
171
180
$ locator = $ this ->composerJsonAndInstalledJsonSourceLocatorMaker ->create ($ composerAutoloaderProjectPath );
0 commit comments