Skip to content
Closed
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
2 changes: 1 addition & 1 deletion serializer/custom_context_builders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know much about the serializer ... but this change is not exactly the same. Before, only true (and false) are valid. If we remove the true === condition, any value that converts to true (like (int) 2 or (string) foo) will be allowed too.

But maybe I'm missing something here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say you are right @javiereguiluz

https://3v4l.org/cWCSA

&& is_a($type, \DateTimeInterface::class, true);
}
}
Expand Down