Optimize assertLocale regexp
This commit is contained in:
parent
9572918064
commit
537c39b11e
@ -308,7 +308,7 @@ class Translator implements TranslatorInterface
|
||||
*/
|
||||
private function assertValidLocale($locale)
|
||||
{
|
||||
if (0 !== preg_match('/[^a-z0-9@_\\.\\-]+/i', $locale, $match)) {
|
||||
if (1 !== preg_match('/^[a-z0-9@_\\.\\-]*$/i', $locale)) {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid locale: %s.', $locale));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user