Skip to content

Commit 12b9c1a

Browse files
authored
Merge pull request #9 from doenietzomoeilijk/master
Allow `BaseObject::jsonSerialize()` to serialize `false` values.
2 parents 44af78e + d1daa20 commit 12b9c1a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Objects/BaseObject.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@ public function loadFromArray($object)
3838
}
3939

4040
/**
41-
* @return string[]
41+
* @return array
4242
*/
4343
public function jsonSerialize()
4444
{
4545
$properties = get_object_vars($this);
46-
$properties = array_filter($properties, function ($value) {
47-
return ! empty($value);
46+
$properties = array_filter($properties, static function ($value) {
47+
return $value === false || !empty($value);
4848
});
49+
4950
return $properties;
5051
}
5152
}

0 commit comments

Comments
 (0)