File tree Expand file tree Collapse file tree
src/Reflection/BetterReflection/SourceLocator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,11 +40,20 @@ public function create(string $installationPath): ?SourceLocator
4040 return null ;
4141 }
4242
43- $ composerJsonContents = FileReader::read ($ composerJsonPath );
44- $ composer = Json::decode ($ composerJsonContents , Json::FORCE_ARRAY );
43+ try {
44+ $ composerJsonContents = FileReader::read ($ composerJsonPath );
45+ $ composer = Json::decode ($ composerJsonContents , Json::FORCE_ARRAY );
46+ } catch (\PHPStan \File \CouldNotReadFileException | \Nette \Utils \JsonException $ e ) {
47+ return null ;
48+ }
49+
50+ try {
51+ $ installedJsonContents = FileReader::read ($ installedJsonPath );
52+ $ installedJson = Json::decode ($ installedJsonContents , Json::FORCE_ARRAY );
53+ } catch (\PHPStan \File \CouldNotReadFileException | \Nette \Utils \JsonException $ e ) {
54+ return null ;
55+ }
4556
46- $ installedJsonContents = FileReader::read ($ installedJsonPath );
47- $ installedJson = Json::decode ($ installedJsonContents , Json::FORCE_ARRAY );
4857 $ installed = $ installedJson ['packages ' ] ?? $ installedJson ;
4958
5059 $ classMapPaths = array_merge (
You can’t perform that action at this time.
0 commit comments