diff --git a/phpstan/baseline.neon b/phpstan/baseline.neon index ac39f66e8..c335349c5 100644 --- a/phpstan/baseline.neon +++ b/phpstan/baseline.neon @@ -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 diff --git a/src/Composer/Json/JsonFile.php b/src/Composer/Json/JsonFile.php index 2202530d9..bbcd24206 100644 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -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); }