Fix TypeError when a JSON file can not be read (#10818)
parent
15f7d24e7e
commit
1e9210f7b1
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue