@@ -135,12 +135,23 @@ public function locateIdentifier(Reflector $reflector, Identifier $identifier):
135
135
if ($ locateResult === null ) {
136
136
return null ;
137
137
}
138
- [$ potentiallyLocatedFile , $ className , $ startLine ] = $ locateResult ;
138
+ [$ potentiallyLocatedFiles , $ className , $ startLine ] = $ locateResult ;
139
139
if ($ startLine !== null ) {
140
140
$ this ->startLineByClass [strtolower ($ className )] = $ startLine ;
141
141
}
142
142
143
- return $ this ->findReflection ($ reflector , $ potentiallyLocatedFile , new Identifier ($ className , $ identifier ->getType ()), $ startLine );
143
+ $ newIdentifier = new Identifier ($ className , $ identifier ->getType ());
144
+
145
+ foreach ($ potentiallyLocatedFiles as $ potentiallyLocatedFile ) {
146
+ $ reflection = $ this ->findReflection ($ reflector , $ potentiallyLocatedFile , $ newIdentifier , $ startLine );
147
+ if ($ reflection === null ) {
148
+ continue ;
149
+ }
150
+
151
+ return $ reflection ;
152
+ }
153
+
154
+ return null ;
144
155
}
145
156
146
157
private function findReflection (Reflector $ reflector , string $ file , Identifier $ identifier , ?int $ startLine ): ?Reflection
@@ -313,7 +324,7 @@ private function getReflectionClass(string $className): ?ReflectionClass
313
324
* that it cannot find the file, so we squelch the errors by overriding the
314
325
* error handler temporarily.
315
326
*
316
- * @return array{string, string, int|null}|null
327
+ * @return array{string[] , string, int|null}|null
317
328
*/
318
329
private function locateClassByName (string $ className ): ?array
319
330
{
@@ -324,7 +335,7 @@ private function locateClassByName(string $className): ?array
324
335
return null ;
325
336
}
326
337
327
- return [$ filename , $ reflection ->getName (), $ reflection ->getStartLine () !== false ? $ reflection ->getStartLine () : null ];
338
+ return [[ $ filename] , $ reflection ->getName (), $ reflection ->getStartLine () !== false ? $ reflection ->getStartLine () : null ];
328
339
}
329
340
330
341
if (!$ this ->disableRuntimeReflectionProvider ) {
@@ -334,7 +345,7 @@ private function locateClassByName(string $className): ?array
334
345
$ this ->silenceErrors ();
335
346
336
347
try {
337
- /** @var array{string, string, null}|null */
348
+ /** @var array{string[] , string, null}|null */
338
349
$ result = FileReadTrapStreamWrapper::withStreamWrapperOverride (
339
350
static function () use ($ className ): ?array {
340
351
$ functions = spl_autoload_functions ();
@@ -351,8 +362,8 @@ static function () use ($className): ?array {
351
362
*
352
363
* This will not be `null` when the autoloader tried to read a file.
353
364
*/
354
- if (FileReadTrapStreamWrapper::$ autoloadLocatedFile !== null ) {
355
- return [FileReadTrapStreamWrapper::$ autoloadLocatedFile , $ className , null ];
365
+ if (FileReadTrapStreamWrapper::$ autoloadLocatedFiles !== [] ) {
366
+ return [FileReadTrapStreamWrapper::$ autoloadLocatedFiles , $ className , null ];
356
367
}
357
368
}
358
369
@@ -363,7 +374,9 @@ static function () use ($className): ?array {
363
374
return null ;
364
375
}
365
376
366
- opcache_invalidate ($ result [0 ], true );
377
+ foreach ($ result [0 ] as $ file ) {
378
+ opcache_invalidate ($ file , true );
379
+ }
367
380
368
381
return $ result ;
369
382
} finally {
0 commit comments