8000 bug #18909 Fixed singular of committee (peterrehm) · symfony/symfony@c87c175 · GitHub
[go: up one dir, main page]

Skip to content

Commit c87c175

Browse files
committed
bug #18909 Fixed singular of committee (peterrehm)
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
2 parents 8c7d9d9 + b5e1f24 commit c87c175

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/Symfony/Component/Inflector/Inflector.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ final class Inflector
2626
* @var array
2727
*
2828
* @see http://english-zone.com/spelling/plurals.html
29-
* @see http://www.scribd.com/doc/3271143/List-of-100-Irregular-Plural-Nouns-in-English
3029
*/
3130
private static $pluralMap = array(
3231
// First entry: plural suffix, reversed
@@ -71,6 +70,15 @@ final class Inflector
7170
// movies (movie)
7271
array('seivom', 6, true, true, 'movie'),
7372

73+
// feet (foot)
74+
array('teef', 4, true, true, 'foot'),
75+
76+
// geese (goose)
77+
array('eseeg', 5, true, true, 'goose'),
78+
79+
// teeth (tooth)
80+
array('hteet', 5, true, true, 'tooth'),
81+
7482
// news (news)
7583
array('swen', 4, true, true, 'news'),
7684

@@ -218,11 +226,6 @@ public static function singularize($plural)
218226
}
219227
}
220228

221-
// Convert teeth to tooth, feet to foot
222-
if (false !== ($pos = strpos($plural, 'ee')) && strlen($plural) > 3 && 'feedback' !== $plural) {
223-
return substr_replace($plural, 'oo', $pos, 2);
224-
}
225-
226229
// Assume that plural and singular is identical
227230
return $plural;
228231
}

src/Symfony/Component/Inflector/Tests/InflectorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public function singularizeProvider()
5353
array('children', 'child'),
5454
array('circuses', array('circus', 'circuse', 'circusis')),
5555
array('cliffs', 'cliff'),
56+
array('committee', 'committee'),
5657
array('crises', array('cris', 'crise', 'crisis')),
5758
array('criteria', array('criterion', 'criterium')),
5859
array('cups', 'cup'),

0 commit comments

Comments
 (0)
0