From 2d0dc9f76331c8f6afd817ad3b51770e98f8bf6a Mon Sep 17 00:00:00 2001 From: payablijah Date: Thu, 30 Apr 2026 17:34:07 -0400 Subject: [PATCH] added JsonSerializableType to PHP fernignore --- .fernignore | 3 +++ src/Core/Json/JsonSerializableType.php | 4 ++++ 2 files changed, 7 insertions(+) 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."); }