File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1212namespace Symfony \Component \Validator \Constraints ;
1313
1414use Symfony \Component \Intl \Intl ;
15+ use Symfony \Component \Intl \Locale as IntlLocale ;
1516use Symfony \Component \Validator \Constraint ;
1617use Symfony \Component \Validator \ConstraintValidator ;
1718use Symfony \Component \Validator \Exception \UnexpectedTypeException ;
@@ -42,12 +43,12 @@ public function validate($value, Constraint $constraint)
4243
4344 $ value = (string ) $ value ;
4445 if ($ constraint ->canonicalize ) {
45- $ value = \Locale ::canonicalize ($ value );
46+ $ value = IntlLocale ::canonicalize ($ value );
4647 }
47- $ locales = Intl::getLocaleBundle ()-> getLocaleNames ();
48- $ aliases = Intl:: getLocaleBundle ()-> getAliases ();
48+ $ localeBundle = Intl::getLocaleBundle ();
49+ $ locales = $ localeBundle -> getLocaleNames ();
4950
50- if (!isset ($ locales [$ value ]) && !in_array ($ value , $ aliases )) {
51+ if (!isset ($ locales [$ value ]) && !in_array ($ value , $ localeBundle -> getAliases (), true )) {
5152 $ this ->context ->buildViolation ($ constraint ->message )
5253 ->setParameter ('{{ value }} ' , $ this ->formatValue ($ value ))
5354 ->setCode (Locale::NO_SUCH_LOCALE_ERROR )
You can’t perform that action at this time.
0 commit comments