8000 Fixed singular of committee by peterrehm · Pull Request #18909 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Fixed singular of committee #18909

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed

Fixed singular of committee #18909

wants to merge 4 commits into from

Conversation

peterrehm
Copy link
Contributor
@peterrehm peterrehm commented May 29, 2016
Q A
Branch? 3.1?
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #18872, #18748
License MIT
Doc PR -

As in SF 3.1 the StringUtil has been moved to a new Component, I am proposing this for 3.1.
I can easily provide the same in an additional PR against the 2.3? branch.

@peterrehm
Copy link
Contributor Author

Fabbot should be ignored in this case...

@fabpot
Copy link
Member
fabpot commented May 29, 2016

Can you indeed also provide a PR for 2.3?

@peterrehm
Copy link
Contributor Author

Just provided #18911

// Convert teeth to tooth, feet to foot
if (false !== ($pos = strpos($plural, 'ee')) && strlen($plural) > 3 && 'feedback' !== $plural) {
if (false !== ($pos = strpos($plural, 'ee')) && strlen($plural) > 3 && !in_array(strtolower($plural), $irregularNouns)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, preserve the strict comparison at in_array().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@@ -218,8 +227,14 @@ public static function singularize($plural)
}
}

$irregularNouns = array(
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem to be in use?

@peterrehm
Copy link
Contributor Author

@teohhanhui I was thinking about the whitelist approach as well but I see the problem that with the whitelist approach it will be hard to match all the relevent cases and the risk is high to introduce BC breaks whereas the blacklist approach should not break existing applications.

@TakTaki
Copy link
TakTaki commented Jun 6, 2016

@peterrehm I don't totally agree with you as I currently have a screenshotattribute in some entities, and this patch will break my applications. But I rather have it break than have a addScroonshot in my app.

@TakTaki
Copy link
TakTaki commented Jun 6, 2016

I was wondering: what if I have an attribute named screen? Does that mean we'll have to make a new patch to add screen to the blacklist?

@peterrehm
Copy link
Contributor Author

@TakTaki It would have needed an explicit list. After some research I only found the 3 added nouns affected, I did not find more. So I switched to the whitelist approach which should be easier. The question is if this is a BC break or not? /cc @nicolas-grekas

*
* @var array
*/
private static $irregularNouns = array(
Copy link
Member

Choose a reason for hiding this comment

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

this looks unused

@stof
Copy link
Member
stof commented Jun 6, 2016

Can you synchonize the PR targetting the older branch too ?

@peterrehm
Copy link
Contributor Author

@stof It was, missed some changes it is already updated.

@peterrehm
Copy link
Contributor Author

@stof The other PR is already updated as well. What do you think about the changed? I could not think of any better solution.

@@ -26,7 +26,6 @@
* @var array
*
* @see http://english-zone.com/spelling/plurals.html
* @see http://www.scribd.com/doc/3271143/List-of-100-Irregular-Plural-Nouns-in-English
Copy link
Contributor

Choose a reason for hiding this comment

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

fabpot added a commit that referenced this pull request Jun 8, 2016
This PR was submitted for the 2.3 branch but it was merged into the 2.7 branch instead (closes #18911).

Discussion
----------

Fixed singular of committee

| Q             | A
| ------------- | ---
| Branch?       | 2.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #18872, #18748
| License       | MIT
| Doc PR        | -

In addition to PR #18909.

Commits
-------

5661d52 Fixed singular of committee
@fabpot
Copy link
Member
fabpot commented Jun 8, 2016

Thank you @peterrehm.

fabpot added a commit that referenced this pull request Jun 8, 2016
This PR was squashed before being merged into the 3.1 branch (closes #18909).

Discussion
----------

Fixed singular of committee

| Q             | A
| ------------- | ---
| Branch?       | 3.1?
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #18872, #18748
| License       | MIT
| Doc PR        | -

As in SF 3.1 the StringUtil has been moved to a new Component, I am proposing this for 3.1.
I can easily provide the same in an additional PR against the 2.3? branch.

Commits
-------

b5e1f24 Fixed singular of committee
@fabpot fabpot closed this Jun 8, 2016
@peterrehm peterrehm deleted the inflector-committee branch June 8, 2016 15:18
@fabpot fabpot mentioned this pull request Jun 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0