Skip to content

Commit

Permalink
AutoloadSourceLocator - do not throw exception on nonexistent file
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Mar 8, 2020
1 parent 149ee9d commit d0a9aa1
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,14 @@ public function locateIdentifier(Reflector $reflector, Identifier $identifier):
}
[$potentiallyLocatedFile, $className] = $locateResult;

try {
$fileContents = FileReader::read($potentiallyLocatedFile);
} catch (\PHPStan\File\CouldNotReadFileException $e) {
return null;
}

$locatedSource = new LocatedSource(
FileReader::read($potentiallyLocatedFile),
$fileContents,
$potentiallyLocatedFile
);

Expand Down

0 comments on commit d0a9aa1

Please sign in to comment.