From e9b6bd25ad2f7cb8a502061a659c63cb6e8f7ab3 Mon Sep 17 00:00:00 2001 From: Alexey Borisov Date: Thu, 26 Sep 2024 12:13:16 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BA=D0=BB=D0=BE=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BC=D1=83=D0=B6=D1=81=D0=BA=D0=B8=D1=85=20?= =?UTF-8?q?=D1=84=D0=B0=D0=BC=D0=B8=D0=BB=D0=B8=D0=B9=20=D1=81=20=D0=BE?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=87=D0=B0=D0=BD=D0=B8=D1=8F=D0=BC=D0=B8=20?= =?UTF-8?q?=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Russian/LastNamesInflection.php | 13 +++++++++++++ tests/Russian/LastNamesInflectionTest.php | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/Russian/LastNamesInflection.php b/src/Russian/LastNamesInflection.php index a7f00bc..213a32e 100644 --- a/src/Russian/LastNamesInflection.php +++ b/src/Russian/LastNamesInflection.php @@ -212,6 +212,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)); diff --git a/tests/Russian/LastNamesInflectionTest.php b/tests/Russian/LastNamesInflectionTest.php index 68a7f24..7653907 100644 --- a/tests/Russian/LastNamesInflectionTest.php +++ b/tests/Russian/LastNamesInflectionTest.php @@ -77,6 +77,9 @@ public function lastNamesProvider() // ['Зоя', NamesInflection::FEMALE, 'Зои', 'Зое', 'Зою', 'Зоей', 'Зое'], // ['Молодыха', NamesInflection::FEMALE, 'Молодыхи', 'Молодыхе', 'Молодыху', 'Молодыхой', 'Молодыхе'], ['Стальная', NamesInflection::FEMALE, 'Стальной', 'Стальной', 'Стальную', 'Стальной', 'Стальной'], + ['Янушонок', NamesInflection::MALE, 'Янушонка', 'Янушонку', 'Янушонка', 'Янушонком', 'Янушонке'], + ['Оборок', NamesInflection::MALE, 'Оборка', 'Оборку', 'Оборка', 'Оборком', 'Оборке'], + ['Бок', NamesInflection::MALE, 'Бока', 'Боку', 'Бока', 'Боком', 'Боке'], [ 'Завгородняя', NamesInflection::FEMALE,