From 612d0538929ce2025c58231fab635d3152d1ffae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 6 Apr 2022 13:59:05 +0200 Subject: [PATCH] fix phpstan and phpcs --- .../Serializer/Normalizer/DateNormalizer.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php index 81e953267..d3161fd4a 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php @@ -45,12 +45,17 @@ class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInt switch ($type) { case DateTime::class: $result = DateTime::createFromFormat(DateTimeInterface::ISO8601, $data['datetime']); + break; case DateTimeInterface::class: case DateTimeImmutable::class: $result = DateTimeImmutable::createFromFormat(DateTimeInterface::ISO8601, $data['datetime']); + break; + + default: + throw new UnexpectedValueException(); } if (false === $result) { @@ -58,8 +63,6 @@ class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInt } return $result; - - throw new UnexpectedValueException(); } public function normalize($date, $format = null, array $context = [])