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

[Serializer] Rename normalize param#39735

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:4.4fromVincentLanglet:renameParam
Jan 13, 2021

Conversation

@VincentLanglet
Copy link
Contributor

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
LicenseMIT

The ProblemNormalizer is the only one Normalizer which

  • Use a different param name$exception instead of the one in the interface$object.
  • Doesn't type check the param.

The first point lead to an unfixable error with Psalm when extending the ProblemNormalizer

  • If the variable is named$object it does not match with the parent
  • If the variable is named$exception it does not match with the interface

@carsonbotcarsonbot added this to the4.4 milestoneJan 6, 2021
@carsonbotcarsonbot changed the titleRename normalize param[Serializer] Rename normalize paramJan 6, 2021
publicfunctionnormalize($exception,$format =null,array$context = [])
publicfunctionnormalize($object,$format =null,array$context = [])
{
if (!$objectinstanceof FlattenException) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe could you just add a@param tag here to make Psalm happy?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I can remove these lines if preferred ; this does not have impact psalm for developer which extends this class.
My main concern was about the name of the param.

This method is public, and the interface is allowingobject ; so theorically this method should handle every possible object and not restricting the param directly in the phpdoc.

I agree that this seems duplicate with thesupportNormalization method. We could consider that this is similar to Voter

* It is safe to assume that $attribute and $subject already passed the "supports()" method check.
.

But when I look at others Normalizer, it seems that checking the param was the strategy adopted

So I added consistency

@fabpot
Copy link
Member

Thank you@VincentLanglet.

@fabpotfabpot merged commitd23b74e intosymfony:4.4Jan 13, 2021
This was referencedJan 27, 2021
hultberg pushed a commit to hultberg/symfony that referenced this pull requestSep 17, 2021
This PR was merged into the 4.4 branch.Discussion----------[Serializer] Rename normalize param| Q             | A| ------------- | ---| Branch?       | 4.4| Bug fix?      | yes| New feature?  | no| Deprecations? | no| License       | MITThe ProblemNormalizer is the only one Normalizer which- Use a different param name `$exception` instead of the one in the interface `$object`.- Doesn't type check the param.The first point lead to an unfixable error with Psalm when extending the ProblemNormalizer- If the variable is named `$object` it does not match with the parent- If the variable is named `$exception` it does not match with the interfaceCommits-------7e6eee2 Rename normalize param
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@dunglasdunglasdunglas approved these changes

@fabpotfabpotfabpot approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

5 participants

@VincentLanglet@fabpot@dunglas@derrabus@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp