diff --git a/.fernignore b/.fernignore index 33bb080..57a0d2f 100644 --- a/.fernignore +++ b/.fernignore @@ -1,3 +1,6 @@ # Specify files that shouldn't be modified by Fern LICENSE.md CONTRIBUTING.md + +# nullable DateTime fix +src/Core/Json/JsonSerializableType.php diff --git a/src/Core/Json/JsonSerializableType.php b/src/Core/Json/JsonSerializableType.php index a555b67..445d0bb 100644 --- a/src/Core/Json/JsonSerializableType.php +++ b/src/Core/Json/JsonSerializableType.php @@ -145,6 +145,10 @@ public static function jsonDeserialize(array $data): static $dateTypeAttr = $property->getAttributes(Date::class)[0] ?? null; if ($dateTypeAttr) { $dateType = $dateTypeAttr->newInstance()->type; + if ($value === null) { + $args[$property->getName()] = null; + continue; + } if (!is_string($value)) { throw new JsonException("Unexpected non-string type for date."); }