Fixed execution without params

This commit is contained in:
2024-07-08 00:06:03 +08:00
parent 47930b010f
commit e5dad3f2d6
2 changed files with 14 additions and 3 deletions

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");