8000 Switched the conversion ee to oo to a whitelist approach · symfony/symfony@91ab25a · GitHub
[go: up one dir, main page]

Skip to content

Commit 91ab25a

Browse files
committed
Switched the conversion ee to oo to a whitelist approach
1 parent 2dcd773 commit 91ab25a

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

src/Symfony/Component/Inflector/Inflector.php

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ final class Inflector
7070
// movies (movie)
7171
array('seivom', 6, true, true, 'movie'),
7272

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+
7382
// news (news)
7483
array('swen', 4, true, true, 'news'),
7584

@@ -130,17 +139,6 @@ final class Inflector
130139
array('elpoep', 6, true, true, 'person'),
131140
);
132141

133-
/**
134-
* Irregular nouns which will not be converted 'ee' to 'oo'
135-
*
136-
* @var array
137-
*/
138-
private static $irregularNouns = array(
139-
'committee' => 'committee',
140-
'feedback' => 'feedback',
141-
'screenshots' => 'screenshot',
142-
);
143-
144142
/**
145143
* This class should not be instantiated.
146144
*/
@@ -228,11 +226,6 @@ public static function singularize($plural)
228226
}
229227
}
230228

231-
// Convert teeth to tooth, feet to foot
232-
if (false !== ($pos = strpos($plural, 'ee')) && strlen($plural) > 3 && !isset(self::$irregularNouns[strtolower($plural)])) {
233-
return substr_replace($plural, 'oo', $pos, 2);
234-
}
235-
236229
// Assume that plural and singular is identical
237230
return $plural;
238231
}

0 commit comments

Comments
 (0)
0