Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow returning null from NormalizerInterface::normalize#34340

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:3.4fromteohhanhui:patch-3
Nov 13, 2019

Conversation

teohhanhui
Copy link
Contributor

QA
Branch?3.4
Bug fix?yes?
New feature?no
Deprecations?no
TicketsN/A
LicenseMIT
Doc PRN/A

Looking at the code, it seems that a normalizer might be called with anull value for$data, and thus it's only sensible that it be allowed to returnnull too:

// If a normalizer supports the given data, use it
if ($normalizer =$this->getNormalizer($data,$format,$context)) {
return$normalizer->normalize($data,$format,$context);
}
if (null ===$data ||is_scalar($data)) {
return$data;
}

Updating the phpdoc to match.

jvasseur reacted with thumbs up emoji
fabpot pushed a commit that referenced this pull requestNov 13, 2019
… (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/ALooking 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-L148Updating the phpdoc to match.Commits-------1c8edc5 Allow returning null from NormalizerInterface::normalize
@fabpotfabpot merged commit1c8edc5 intosymfony:3.4Nov 13, 2019
@nicolas-grekas
Copy link
Member

Thank you@teohhanhui

teohhanhui reacted with hooray emojiteohhanhui reacted with heart emojiteohhanhui reacted with rocket emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@dunglasdunglasAwaiting requested review from dunglasdunglas is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
3.4
Development

Successfully merging this pull request may close these issues.

4 participants
@teohhanhui@nicolas-grekas@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp