Skip to content

Commit

Permalink
Fix lowercase validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Propaganistas committed Jan 26, 2023
1 parent 49d4a85 commit 8debcc5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Traits/ParsesCountries.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait ParsesCountries
*/
public static function isValidCountryCode($country)
{
return in_array($country, PhoneNumberUtil::getInstance()->getSupportedRegions());
return in_array(strtoupper($country), array_map('strtoupper', PhoneNumberUtil::getInstance()->getSupportedRegions()));
}

/**
Expand All @@ -31,11 +31,10 @@ protected function parseCountries($countries)
/** @phpstan-ignore-next-line */
return is_null($value);
})
->map(function ($country) {
return strtoupper($country);
})
->filter(function ($value) {
return static::isValidCountryCode($value);
})->map(function ($value) {
return strtoupper($value);
})->toArray();
}
}

0 comments on commit 8debcc5

Please sign in to comment.