Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 202199b

Browse filesBrowse 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
Copy full SHA for 202199b

File tree

1 file changed

+7
-3
lines changed
Filter options

1 file changed

+7
-3
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php
+7-3Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.