Fixed singular of committee

This commit is contained in:
Peter Rehm 2016-05-29 14:11:17 +02:00 committed by Fabien Potencier
parent 922f1b0e60
commit b5e1f24860
2 changed files with 10 additions and 6 deletions

View File

@ -26,7 +26,6 @@ final class Inflector
* @var array * @var array
* *
* @see http://english-zone.com/spelling/plurals.html * @see http://english-zone.com/spelling/plurals.html
* @see http://www.scribd.com/doc/3271143/List-of-100-Irregular-Plural-Nouns-in-English
*/ */
private static $pluralMap = array( private static $pluralMap = array(
// First entry: plural suffix, reversed // First entry: plural suffix, reversed
@ -71,6 +70,15 @@ final class Inflector
// movies (movie) // movies (movie)
array('seivom', 6, true, true, '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) // news (news)
array('swen', 4, true, true, 'news'), array('swen', 4, true, true, 'news'),
@ -218,11 +226,6 @@ final class Inflector
} }
} }
// Convert teeth to tooth, feet to foot
if (false !== ($pos = strpos($plural, 'ee')) && strlen($plural) > 3 && 'feedback' !== $plural) {
return substr_replace($plural, 'oo', $pos, 2);
}
// Assume that plural and singular is identical // Assume that plural and singular is identical
return $plural; return $plural;
} }

View File

@ -53,6 +53,7 @@ class InflectorTest extends \PHPUnit_Framework_TestCase
array('children', 'child'), array('children', 'child'),
array('circuses', array('circus', 'circuse', 'circusis')), array('circuses', array('circus', 'circuse', 'circusis')),
array('cliffs', 'cliff'), array('cliffs', 'cliff'),
array('committee', 'committee'),
array('crises', array('cris', 'crise', 'crisis')), array('crises', array('cris', 'crise', 'crisis')),
array('criteria', array('criterion', 'criterium')), array('criteria', array('criterion', 'criterium')),
array('cups', 'cup'), array('cups', 'cup'),