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
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 91ab25a07ed2a2cdd2003b44ac499de9e5f63225
25 changes: 9 additions & 16 deletions src/Symfony/Component/Inflector/Inflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ final class Inflector
// 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 @@ -130,17 +139,6 @@ final class Inflector
array('elpoep', 6, true, true, 'person'),
);

/**
* 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 @@ -228,11 +226,6 @@ public static function singularize($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