Skip to content

Commit

Permalink
Additional fix to make class aliases work
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed May 30, 2022
1 parent 5a77923 commit 99acc02
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use PHPStan\BetterReflection\SourceLocator\Located\LocatedSource;
use PHPStan\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber;
use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator;
use ReflectionClass;

class ReflectionClassSourceLocator implements SourceLocator
{
Expand All @@ -35,10 +36,12 @@ public function locateIdentifier(Reflector $reflector, Identifier $identifier):
return null;
}

$reflection = new ReflectionClass($className);

return $this->astLocator->findReflection(
$reflector,
new LocatedSource($stub->getStub(), $className, $stub->getFileName()),
$identifier,
new LocatedSource($stub->getStub(), $reflection->getName(), $stub->getFileName()),
new Identifier($reflection->getName(), new IdentifierType(IdentifierType::IDENTIFIER_CLASS)),
);
}

Expand Down

0 comments on commit 99acc02

Please sign in to comment.