Fixed execution without params

This commit is contained in:
Anthony Axenov 2024-07-08 00:06:03 +08:00
parent 47930b010f
commit be12d8d38a
Signed by: anthony
GPG Key ID: EA9EC32FF7CCD4EC

View File

@ -44,6 +44,9 @@ class Environment implements ArrayAccess
*/
public function readFromFile(string $filepath): static
{
if (empty($filepath)) {
return $this;
}
$content = file_get_contents(static::$filepath = $filepath);
$content = json_decode($content, flags: JSON_THROW_ON_ERROR); //TODO try-catch
$content || throw new JsonException("not a valid environment: $filepath");