8000 Refactored array to private static variable · symfony/symfony@9c99398 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9c99398

Browse files
committed
Refactored array to private static variable
1 parent 3bd0571 commit 9c99398

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Symfony/Component/Inflector/Inflector.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,16 @@ final class Inflector
130130
array('elpoep', 6, true, true, 'person'),
131131
);
132132

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+
);
142+
133143
/**
134144
* This class should not be instantiated.
135145
*/
@@ -223,7 +233,7 @@ public static function singularize($plural)
223233
);
224234

225235
// Convert teeth to tooth, feet to foot
226-
if (false !== ($pos = strpos($plural, 'ee')) && strlen($plural) > 3 && !isset($irregularNouns[strtolower($plural)])) {
236+
if (false !== ($pos = strpos($plural, 'ee')) && strlen($plural) > 3 && !isset(self::$irregularNouns[strtolower($plural)])) {
227237
return substr_replace($plural, 'oo', $pos, 2);
228238
}
229239

0 commit comments

Comments
 (0)
0