Skip to content

Commit

Permalink
Merge pull request #154 from anoriar/fix-male-ok
Browse files Browse the repository at this point in the history
Склонение мужских фамилий с окончаниями ок
  • Loading branch information
wapmorgan authored Sep 26, 2024
2 parents f3e760f + e9b6bd2 commit 1065704
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Russian/LastNamesInflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,19 @@ public static function getCases($name, $gender = null)
];
}

if (S::length($name) > 3 && in_array(S::slice($name, -2), ['ок'], true)) {
$prefix = S::name(S::slice($name, 0, -2)) . S::slice($name, -1);

return [
static::IMENIT => S::name($name),
static::RODIT => $prefix . 'а',
static::DAT => $prefix . 'у',
static::VINIT => $prefix . 'а',
static::TVORIT => $prefix . 'ом',
static::PREDLOJ => $prefix . 'е',
];
}

} else {
if (in_array(S::slice($name, -3), ['ова', 'ева', 'ина', 'ына', 'ёва'], true)) {
$prefix = S::name(S::slice($name, 0, -1));
Expand Down
3 changes: 3 additions & 0 deletions tests/Russian/LastNamesInflectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ public function lastNamesProvider()
// ['Зоя', NamesInflection::FEMALE, 'Зои', 'Зое', 'Зою', 'Зоей', 'Зое'],
// ['Молодыха', NamesInflection::FEMALE, 'Молодыхи', 'Молодыхе', 'Молодыху', 'Молодыхой', 'Молодыхе'],
['Стальная', NamesInflection::FEMALE, 'Стальной', 'Стальной', 'Стальную', 'Стальной', 'Стальной'],
['Янушонок', NamesInflection::MALE, 'Янушонка', 'Янушонку', 'Янушонка', 'Янушонком', 'Янушонке'],
['Оборок', NamesInflection::MALE, 'Оборка', 'Оборку', 'Оборка', 'Оборком', 'Оборке'],
['Бок', NamesInflection::MALE, 'Бока', 'Боку', 'Бока', 'Боком', 'Боке'],
[
'Завгородняя',
NamesInflection::FEMALE,
Expand Down

0 comments on commit 1065704

Please sign in to comment.