8000 bug #38283 [Translator] Optional Intl dependency (ro0NL) · symfony/symfony@d9bcb64 · GitHub
[go: up one dir, main page]

Skip to content

Commit d9bcb64

Browse files
committed
bug #38283 [Translator] Optional Intl dependency (ro0NL)
This PR was squashed before being merged into the 4.4 branch. Discussion ---------- [Translator] Optional Intl dependency | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #38279 | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Never break backward compatibility (see https://symfony.com/bc). - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too.) - Features and deprecations must be submitted against branch master. --> i decided to cast $locale at construct, given its property is documented to be string Commits ------- a2eb263 [Translator] Optional Intl dependency
2 parents 02be26a + a2eb263 commit d9bcb64

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Translation/Translator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,15 @@ public function setLocale($locale)
163163
}
164164

165165
$this->assertValidLocale($locale);
166-
$this->locale = $locale;
166+
$this->locale = $locale ?? (class_exists(\Locale::class) ? \Locale::getDefault() : 'en');
167167
}
168168

169169
/**
170170
* {@inheritdoc}
171171
*/
172172
public function getLocale()
173173
{
174-
return $this->locale ?? \Locale::getDefault();
174+
return $this->locale;
175175
}
176176

177177
/**

0 commit comments

Comments
 (0)
0