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

Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Switched the conversion ee to oo to a whitelist approach
  • Loading branch information
peterrehm committed Jun 6, 2016
commit e21c52fa18cb684c3c38866f7b334cad3a31546e
25 changes: 9 additions & 16 deletions src/Symfony/Component/PropertyAccess/StringUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ class StringUtil
// movies (movie)
array('seivom', 6, true, true, 'movie'),

// feet (foot)
array('teef', 4, true, true, 'foot'),

// geese (goose)
array('eseeg', 5, true, true, 'goose'),

// teeth (tooth)
array('hteet', 5, true, true, 'tooth'),

// news (news)
array('swen', 4, true, true, 'news'),

Expand Down Expand Up @@ -125,17 +134,6 @@ class StringUtil
array('xuae', 4, false, true, 'eau'),
);

/**
* Irregular nouns which will not be converted 'ee' to 'oo'
*
* @var array
*/
private static $irregularNouns = array(
'committee' => 'committee',
'feedback' => 'feedback',
'screenshots' => 'screenshot',
);

/**
* This class should not be instantiated.
*/
Expand Down Expand Up @@ -221,11 +219,6 @@ public static function singularify($plural)
}
}

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

// Assume that plural and singular is identical
return $plural;
}
Expand Down
0