From 7d3b508b1017f74980b134fc598308833cc622f5 Mon Sep 17 00:00:00 2001 From: hbgamra Date: Mon, 8 Jul 2024 10:08:30 +0200 Subject: [PATCH] Simplify boolean condition in datetime handling --- serializer/custom_context_builders.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serializer/custom_context_builders.rst b/serializer/custom_context_builders.rst index 00d08ef71d3..508b40b421e 100644 --- a/serializer/custom_context_builders.rst +++ b/serializer/custom_context_builders.rst @@ -42,7 +42,7 @@ value is ``0000-00-00``. To do that you'll first have to create your normalizer: public function supportsDenormalization($data, string $type, ?string $format = null, array $context = []): bool { - return true === ($context['zero_datetime_to_null'] ?? false) + return ($context['zero_datetime_to_null'] ?? false) && is_a($type, \DateTimeInterface::class, true); } }