File tree 1 file changed +5
-4
lines changed
Filter options
src/Symfony/Component/Validator/Constraints 1 file changed +5
-4
lines changed
Original file line number Diff line number Diff line change 12
12
namespace Symfony \Component \Validator \Constraints ;
13
13
14
14
use Symfony \Component \Intl \Intl ;
15
+ use Symfony \Component \Intl \Locale as IntlLocale ;
15
16
use Symfony \Component \Validator \Constraint ;
16
17
use Symfony \Component \Validator \ConstraintValidator ;
17
18
use Symfony \Component \Validator \Exception \UnexpectedTypeException ;
@@ -42,12 +43,12 @@ public function validate($value, Constraint $constraint)
42
43
43
44
$ value = (string ) $ value ;
44
45
if ($ constraint ->canonicalize ) {
45
- $ value = \Locale ::canonicalize ($ value );
46
+ $ value = IntlLocale ::canonicalize ($ value );
46
47
}
47
- $ locales = Intl::getLocaleBundle ()-> getLocaleNames ();
48
- $ aliases = Intl:: getLocaleBundle ()-> getAliases ();
48
+ $ localeBundle = Intl::getLocaleBundle ();
49
+ $ locales = $ localeBundle -> getLocaleNames ();
49
50
50
- if (!isset ($ locales [$ value ]) && !in_array ($ value , $ aliases )) {
51
+ if (!isset ($ locales [$ value ]) && !in_array ($ value , $ localeBundle -> getAliases (), true )) {
51
52
$ this ->context ->buildViolation ($ constraint ->message )
52
53
->setParameter ('{{ value }} ' , $ this ->formatValue ($ value ))
53
54
->setCode (Locale::NO_SUCH_LOCALE_ERROR )
You can’t perform that action at this time.
0 commit comments