From e0f94ae9007efdaff79d4e57550b1b44a9727eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 8 Apr 2025 15:49:04 +0200 Subject: [PATCH] Handle null input in fromNormalized method Updated the `fromNormalized` method to return null when provided with a null input. This ensures better handling of edge cases and prevents potential errors from null data. --- .../ChillMainBundle/Service/RollingDate/RollingDate.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php index e2657cde5..ea673b872 100644 --- a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php +++ b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php @@ -100,8 +100,12 @@ class RollingDate ]; } - public static function fromNormalized(array $data): self + public static function fromNormalized(?array $data): ?self { + if (null === $data) { + return null; + } + if (1 === $data['v']) { return new self( $data['roll'],