Skip to content

Commit

Permalink
Merge pull request #145 from evg555/master
Browse files Browse the repository at this point in the history
Issue-144 Некорректно работает предлог "со" со словами, начинающимися…
  • Loading branch information
wapmorgan authored Jan 25, 2024
2 parents 3dcf539 + 3d11f54 commit 0088f8f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Russian/RussianLanguage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Russian/RussianLanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 0088f8f

Please sign in to comment.