Update DateNormalizer: Add return type hints for denormalize and normalize methods

This commit is contained in:
2025-09-18 11:20:06 +02:00
parent e3f72fbb79
commit 806f709d80

View File

@@ -22,7 +22,7 @@ class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInt
{
public function __construct(private readonly RequestStack $requestStack, private readonly ParameterBagInterface $parameterBag) {}
public function denormalize($data, $type, $format = null, array $context = [])
public function denormalize($data, $type, $format = null, array $context = []): ?DateTimeInterface
{
if (null === $data) {
return null;
@@ -51,7 +51,7 @@ class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInt
return $result;
}
public function normalize($date, $format = null, array $context = [])
public function normalize($date, $format = null, array $context = []): array
{
/* @var DateTimeInterface $date */
switch ($format) {