Skip to content

Commit

Permalink
Fix declension of russian last names ending with 'га' #65
Browse files Browse the repository at this point in the history
  • Loading branch information
wapmorgan committed Feb 2, 2020
1 parent 30b4202 commit 9a3fa74
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Russian/LastNamesInflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ public static function getCases($name, $gender = null)
$prefix = S::name(S::slice($name, 0, -1));
return [
static::IMENIT => S::name($name),
static::RODIT => $prefix.(static::isDeafConsonant(S::slice($name, -2, -1)) ? 'и' : 'ы'),
static::RODIT => $prefix.(static::isDeafConsonant(S::slice($name, -2, -1)) || S::slice($name, -2)
== 'га' ? 'и' : 'ы'),
static::DAT => $prefix.'е',
static::VINIT => $prefix.'у',
static::TVORIT => $prefix.'ой',
Expand Down
1 change: 1 addition & 0 deletions tests/Russian/LastNamesInflectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function lastNamesProvider()
['Толстой', NamesInflection::MALE, 'Толстого', 'Толстому', 'Толстого', 'Толстым', 'Толстом'],
['Стальной', NamesInflection::MALE, 'Стального', 'Стальному', 'Стального', 'Стальным', 'Стальном'],
['Жареный', NamesInflection::MALE, 'Жареного', 'Жареному', 'Жареного', 'Жареным', 'Жареном'],
['Прожога', NamesInflection::MALE, 'Прожоги', 'Прожоге', 'Прожогу', 'Прожогой', 'Прожоге'],

['Смирнова', NamesInflection::FEMALE, 'Смирновой', 'Смирновой', 'Смирнову', 'Смирновой', 'Смирновой'],
['Кромская', NamesInflection::FEMALE, 'Кромской', 'Кромской', 'Кромскую', 'Кромской', 'Кромской'],
Expand Down

0 comments on commit 9a3fa74

Please sign in to comment.