Skip to content

Commit

Permalink
Merge pull request #155 from anoriar/fix-male-voi
Browse files Browse the repository at this point in the history
Склонение мужских фамилий с окончаниями вой
  • Loading branch information
wapmorgan authored Sep 26, 2024
2 parents cb4565d + 6afe233 commit f3e760f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Russian/LastNamesInflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ public static function getCases($name, $gender = null)
// similar to next if
if (in_array(S::slice($name, -2), ['ой', 'ый', 'ий'], true)) {
$last_consonant = S::slice($name, -3, -2);
$last_sonority = (RussianLanguage::isSonorousConsonant($last_consonant) && $last_consonant !== 'н') || $last_consonant === 'ц';
$last_sonority = (RussianLanguage::isSonorousConsonant($last_consonant) &&
in_array($last_consonant, ['н', 'в'], true) === false) || $last_consonant === 'ц';

if ($last_sonority) {
$prefix = S::name(S::slice($name, 0, -1));
return [
Expand Down
1 change: 1 addition & 0 deletions tests/Russian/LastNamesInflectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function lastNamesProvider()
return [
['Смирнов', NamesInflection::MALE, 'Смирнова', 'Смирнову', 'Смирнова', 'Смирновым', 'Смирнове'],
['Кромской', NamesInflection::MALE, 'Кромского', 'Кромскому', 'Кромского', 'Кромским', 'Кромском'],
['Ольховой', NamesInflection::MALE, 'Ольхового', 'Ольховому', 'Ольхового', 'Ольховым', 'Ольховом'],
['Ус', NamesInflection::MALE, 'Уса', 'Усу', 'Уса', 'Усом', 'Усе'],
['Кузьмич', NamesInflection::MALE, 'Кузьмича', 'Кузьмичу', 'Кузьмича', 'Кузьмичом', 'Кузьмиче'],
['Берг', NamesInflection::MALE, 'Берга', 'Бергу', 'Берга', 'Бергом', 'Берге'],
Expand Down

0 comments on commit f3e760f

Please sign in to comment.