Navigation Menu

Skip to content

Commit

Permalink
Silencing errors related to composer.json reading
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jun 10, 2020
1 parent 28ed924 commit 364cf39
Showing 1 changed file with 13 additions and 4 deletions.
Expand Up @@ -40,11 +40,20 @@ public function create(string $installationPath): ?SourceLocator
return null;
}

$composerJsonContents = FileReader::read($composerJsonPath);
$composer = Json::decode($composerJsonContents, Json::FORCE_ARRAY);
try {
$composerJsonContents = FileReader::read($composerJsonPath);
$composer = Json::decode($composerJsonContents, Json::FORCE_ARRAY);
} catch (\PHPStan\File\CouldNotReadFileException | \Nette\Utils\JsonException $e) {
return null;
}

try {
$installedJsonContents = FileReader::read($installedJsonPath);
$installedJson = Json::decode($installedJsonContents, Json::FORCE_ARRAY);
} catch (\PHPStan\File\CouldNotReadFileException | \Nette\Utils\JsonException $e) {
return null;
}

$installedJsonContents = FileReader::read($installedJsonPath);
$installedJson = Json::decode($installedJsonContents, Json::FORCE_ARRAY);
$installed = $installedJson['packages'] ?? $installedJson;

$classMapPaths = array_merge(
Expand Down

0 comments on commit 364cf39

Please sign in to comment.