Skip to content

Commit eccdbea

Browse files
committed
Merge branch '7.0' into 7.1
* 7.0: [Validator] Check `Locale` class existence before using it
2 parents f87efa1 + a5e2616 commit eccdbea

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
@@ -82,8 +82,10 @@ protected function setUp(): void
8282
$this->validator = $this->createValidator();
8383
$this->validator->initialize($this->context);
8484

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

8890
$this->expectedViolations = [];
8991
$this->call = 0;
@@ -95,7 +97,9 @@ protected function tearDown(): void
9597
{
9698
$this->restoreDefaultTimezone();
9799

98-
\Locale::setDefault($this->defaultLocale);
100+
if (class_exists(\Locale::class)) {
101+
\Locale::setDefault($this->defaultLocale);
102+
}
99103
}
100104

101105
protected function setDefaultTimezone(?string $defaultTimezone)

0 commit comments

Comments
 (0)