From 3d11f5424d9b9ec24ddf6193a95fa0eee030ea0e Mon Sep 17 00:00:00 2001 From: Evgeniy Krylov Date: Fri, 12 Jan 2024 12:39:14 +0400 Subject: [PATCH] =?UTF-8?q?Issue-144=20=D0=9D=D0=B5=D0=BA=D0=BE=D1=80?= =?UTF-8?q?=D1=80=D0=B5=D0=BA=D1=82=D0=BD=D0=BE=20=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=B0=D0=B5=D1=82=20=D0=BF=D1=80=D0=B5=D0=B4=D0=BB=D0=BE?= =?UTF-8?q?=D0=B3=20"=D1=81=D0=BE"=20=D1=81=D0=BE=20=D1=81=D0=BB=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BC=D0=B8,=20=D0=BD=D0=B0=D1=87=D0=B8=D0=BD?= =?UTF-8?q?=D0=B0=D1=8E=D1=89=D0=B8=D0=BC=D0=B8=D1=81=D1=8F=20=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=B1=D1=83=D0=BA=D0=B2=D1=83=20"=D1=81"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Исправил англ "с" на русскую Добавил тесты --- src/Russian/RussianLanguage.php | 2 +- tests/Russian/RussianLanguageTest.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Russian/RussianLanguage.php b/src/Russian/RussianLanguage.php index 7d40ac8..feaf67e 100644 --- a/src/Russian/RussianLanguage.php +++ b/src/Russian/RussianLanguage.php @@ -273,7 +273,7 @@ public static function isConsonant($char) public static function with($word) { $normalized = trim(S::lower($word)); - if (in_array(S::slice($normalized, 0, 1), ['c', 'з', 'ш', 'ж'], + if (in_array(S::slice($normalized, 0, 1), ['с', 'з', 'ш', 'ж'], true) && static::isConsonant(S::slice($normalized, 1, 2)) || S::slice($normalized, 0, 1) === 'щ') { return 'со ' . $word; } diff --git a/tests/Russian/RussianLanguageTest.php b/tests/Russian/RussianLanguageTest.php index 75f019e..eaabf4f 100644 --- a/tests/Russian/RussianLanguageTest.php +++ b/tests/Russian/RussianLanguageTest.php @@ -42,6 +42,8 @@ public function testWith() $this->assertEquals('с пола', RussianLanguage::with('пола')); $this->assertEquals('со шкафа', RussianLanguage::with('шкафа')); $this->assertEquals('со щами', RussianLanguage::with('щами')); + $this->assertEquals('со снегом', RussianLanguage::with('снегом')); + $this->assertEquals('с сестрой', RussianLanguage::with('сестрой')); } public function testAbout()