Skip to content

Commit d586ec7

Browse files
authored
Merge pull request #14 from faissaloux/fix-arabic-lowecase
Fix arabic lowercase
2 parents 0874ebd + d12e0ea commit d586ec7

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/Investigator.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@ private function notLowercasesIn(array $array): array
1818
$unwanted = [];
1919

2020
foreach ($array as $word) {
21-
if ($word === '') {
22-
continue;
23-
}
24-
2521
if (is_array($word)) {
2622
array_push($unwanted, ...$this->notLowercasesIn($word));
2723

2824
continue;
2925
}
3026

31-
if (! ctype_lower(preg_replace('/[^A-Za-z]/', '', $word))) {
27+
$clean = preg_replace('/[^A-Za-z]/', '', $word);
28+
29+
if ($clean !== '' && ! ctype_lower($clean)) {
3230
$unwanted[] = $word;
3331
}
3432
}

tests/Fixtures/returnsArrayOnlyLowercase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@
1313
'lowercase',
1414
'lower',
1515
'case',
16+
'العربية',
1617
];

0 commit comments

Comments
 (0)