8000 minor #34340 Allow returning null from NormalizerInterface::normalize… · symfony/symfony@53dc781 · GitHub
[go: up one dir, main page]

Skip to content

Commit 53dc781

Browse files
minor #34340 Allow returning null from NormalizerInterface::normalize (teohhanhui)
This PR was merged into the 3.4 branch. Discussion ---------- Allow returning null from NormalizerInterface::normalize | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes? | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A Looking at the code, it seems that a normalizer might be called with a `null` value for `$data`, and thus it's only sensible that it be allowed to return `null` too: https://github.com/symfony/symfony/blob/7064ff35f2539e2c915257a50eb37839b485dbeb/src/Symfony/Component/Serializer/Serializer.php#L141-L148 Updating the phpdoc to match. Commits ------- 1c8edc5 Allow returning null from NormalizerInterface::normalize
2 parents 4cc37df + 1c8edc5 commit 53dc781

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ interface NormalizerInterface
3030
* @param string $format Format the normalization result will be encoded as
3131
* @param array $context Context options for the normalizer
3232
*
33-
* @return array|string|int|float|bool
33+
* @return array|string|int|float|bool|null
3434
*
35-
* @throws InvalidArgumentException Occurs when the object given is not an attempted type for the normalizer
35+
* @throws InvalidArgumentException Occurs when the object given is not a supported type for the normalizer
3636
* @throws CircularReferenceException Occurs when the normalizer detects a circular reference when no circular
3737
* reference handler can fix it
3838
* @throws LogicException Occurs when the normalizer is not called in an expected context

0 commit comments

Comments
 (0)
0