Skip to content

Commit a427037

Browse files
committed
Wrap use of \Locale in a class_exists test
1 parent a716613 commit a427037

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Symfony/Component/Translation/LocaleSwitcher.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ public function __construct(
3434

3535
public function setLocale(string $locale): void
3636
{
37-
\Locale::setDefault($this->locale = $locale);
37+
if (class_exists(\Locale::class)) {
38+
\Locale::setDefault($this->locale = $locale);
39+
}
3840
$this->requestContext?->setParameter('_locale', $locale);
3941

4042
foreach ($this->localeAwareServices as $service) {

0 commit comments

Comments
 (0)