Skip to content

Commit 202199b

Browse files
committed
Merge branch '5.4' into 6.4
* 5.4: [Validator] Check `Locale` class existence before using it
2 parents 48f192f + ca66c1c commit 202199b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ protected function setUp(): void
8383
$this->validator = $this->createValidator();
8484
$this->validator->initialize($this->context);
8585

86-
$this->defaultLocale = \Locale::getDefault();
87-
\Locale::setDefault('en');
86+
if (class_exists(\Locale::class)) {
87+
$this->defaultLocale = \Locale::getDefault();
88+
\Locale::setDefault('en');
89+
}
8890

8991
$this->expectedViolations = [];
9092
$this->call = 0;
@@ -96,7 +98,9 @@ protected function tearDown(): void
9698
{
9799
$this->restoreDefaultTimezone();
98100

99-
\Locale::setDefault($this->defaultLocale);
101+
if (class_exists(\Locale::class)) {
102+
\Locale::setDefault($this->defaultLocale);
103+
}
100104
}
101105

102106
protected function setDefaultTimezone(?string $defaultTimezone)

0 commit comments

Comments
 (0)