Skip to content

Commit

Permalink
fix arabic lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
faissaloux committed Oct 26, 2024
1 parent 0874ebd commit 4c03599
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Investigator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@ private function notLowercasesIn(array $array): array
$unwanted = [];

foreach ($array as $word) {
if ($word === '') {
if (is_array($word)) {
array_push($unwanted, ...$this->notLowercasesIn($word));

continue;
}

if (is_array($word)) {
array_push($unwanted, ...$this->notLowercasesIn($word));
$clean = preg_replace('/[^A-Za-z]/', '', $word);

if ($clean == '') {
continue;
}

if (! ctype_lower(preg_replace('/[^A-Za-z]/', '', $word))) {
if (! ctype_lower($clean)) {
$unwanted[] = $word;
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/Fixtures/returnsArrayOnlyLowercase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
'lowercase',
'lower',
'case',
'العربية',
];

0 comments on commit 4c03599

Please sign in to comment.