Skip to content

[Serializer] type: align with interface signature for denormalize methods #21201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions serializer/custom_context_builders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,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;
Expand All @@ -42,7 +42,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);
Expand Down