minor #33280 fix deprecated call to setLocale with null (Tobion)

This PR was merged into the 4.4 branch.

Discussion
----------

fix deprecated call to setLocale with null

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets |    <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        |

Fix a potentially invalid call since #33272

Commits
-------

26f9afe8d1 fix deprecated call to setLocale with null
This commit is contained in:
Nicolas Grekas 2019-08-21 17:06:06 +02:00
commit 8d8d3d4d40

View File

@ -46,7 +46,9 @@ class LocaleAwareListener implements EventSubscriberInterface
public function onKernelFinishRequest(FinishRequestEvent $event): void
{
if (null === $parentRequest = $this->requestStack->getParentRequest()) {
$this->setLocale($event->getRequest()->getDefaultLocale());
foreach ($this->localeAwareServices as $service) {
$service->setLocale($event->getRequest()->getDefaultLocale());
}
return;
}
@ -63,7 +65,7 @@ class LocaleAwareListener implements EventSubscriberInterface
];
}
private function setLocale(string $locale, string $defaultLocale = null): void
private function setLocale(string $locale, string $defaultLocale): void
{
foreach ($this->localeAwareServices as $service) {
try {