mirror of
https://github.com/symfony/symfony-docs.git
synced 2026-03-24 00:32:14 +01:00
Merge branch '6.4' into 7.2
* 6.4: [Serializer] type: align with interface signature for denormalize methods
This commit is contained in:
@@ -27,7 +27,7 @@ value is ``0000-00-00``. To do that you'll first have to create your normalizer:
|
||||
{
|
||||
use DenormalizerAwareTrait;
|
||||
|
||||
public function denormalize($data, string $type, ?string $format = null, array $context = []): mixed
|
||||
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
|
||||
{
|
||||
if ('0000-00-00' === $data) {
|
||||
return null;
|
||||
@@ -38,7 +38,7 @@ value is ``0000-00-00``. To do that you'll first have to create your normalizer:
|
||||
return $this->denormalizer->denormalize($data, $type, $format, $context);
|
||||
}
|
||||
|
||||
public function supportsDenormalization($data, string $type, ?string $format = null, array $context = []): bool
|
||||
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
return true === ($context['zero_datetime_to_null'] ?? false)
|
||||
&& is_a($type, \DateTimeInterface::class, true);
|
||||
|
||||
Reference in New Issue
Block a user