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

[PropertyInfo][ReflectionExtractor] Check the array mutator prefixes last when the property is singular#36305

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

Conversation

@fancyweb
Copy link
Contributor

QA
Branch?3.4
Bug fix?yes
New feature?no
Deprecations?no
Tickets#36079
LicenseMIT
Doc PR-

Check the related tickets that have a very descriptive example.

If the property is singular, we should prioritize non array mutator prefixes and do the opposite for plural property. It relies on some guessing but it actually fixes real world scenarios.

*/
private$arrayMutatorPrefixes;

private$arrayMutatorPrefixesFirst;
Copy link
ContributorAuthor

@fancywebfancywebApr 1, 2020
edited
Loading

Choose a reason for hiding this comment

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

We don't need these new class properties if we do some refacto on the existing $mutatorPrefixes and $arrayMutatorPrefixes ones. Basically, currently, $mutatorPrefixes includes the values of $arrayMutatorPrefixes. We could separate the values and join them when we need them.

Copy link
Member

@dunglasdunglasApr 6, 2020
edited
Loading

Choose a reason for hiding this comment

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

As these properties are marked@internal, doing the refactoring is ok. I'm in favor for the refactor if it simplifies the code.

Choose a reason for hiding this comment

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

the refacto should target master

$ucSingulars = (array) Inflector::singularize($ucProperty);

foreach ($this->mutatorPrefixesas$prefix) {
$mutatorPrefixes =\in_array($ucProperty,$ucSingulars,true) ?$this->arrayMutatorPrefixesLast :$this->arrayMutatorPrefixesFirst;
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

If the the property singulars contains the property itself, we can assume the property is singular isn'it?

dunglas reacted with thumbs up emoji
@nicolas-grekasnicolas-grekas added this to the3.4 milestoneApr 3, 2020
@nicolas-grekas
Copy link
Member

Thank you@fancyweb.

@nicolas-grekasnicolas-grekas merged commit547c99e intosymfony:3.4Apr 6, 2020
@fancywebfancyweb deleted the property-info-reflection-extractor-prioritize-mutator-method branchApril 6, 2020 10:12
@nicolas-grekas
Copy link
Member

@fancyweb now merged up to master, refacto unlocked :)

This was referencedApr 28, 2020
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

@fancyweb@nicolas-grekas@dunglas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp