1
0
Fork 0

Fix TypeError when a JSON file can not be read (#10818)

pull/10823/head
Fabien Villepinte 2022-06-04 15:20:58 +02:00 committed by GitHub
parent 15f7d24e7e
commit 1e9210f7b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -4365,11 +4365,6 @@ parameters:
count: 1
path: ../src/Composer/Json/JsonFile.php
-
message: "#^Parameter \\#1 \\$json of static method Composer\\\\Json\\\\JsonFile\\:\\:parseJson\\(\\) expects string\\|null, string\\|false\\|null given\\.$#"
count: 1
path: ../src/Composer/Json/JsonFile.php
-
message: "#^Parameter \\#1 \\$json of static method Composer\\\\Json\\\\JsonFile\\:\\:validateSyntax\\(\\) expects string, string\\|false given\\.$#"
count: 1

View File

@ -110,6 +110,10 @@ class JsonFile
throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
}
if ($json === false) {
throw new \RuntimeException('Could not read '.$this->path);
}
return static::parseJson($json, $this->path);
}