Add support for manipulating empty json files
parent
af6ef235e1
commit
534bd64cd1
|
@ -34,6 +34,9 @@ class JsonManipulator
|
|||
}
|
||||
|
||||
$contents = trim($contents);
|
||||
if ($contents === '') {
|
||||
$contents = '{}';
|
||||
}
|
||||
if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
|
||||
throw new \InvalidArgumentException('The json file must be an object ({})');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue