diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php b/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php index 190bd5d0da817..14cb2adecfe55 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php @@ -63,7 +63,7 @@ class Translator extends BaseTranslator implements WarmableInterface * * @throws InvalidArgumentException */ - public function __construct(ContainerInterface $container, $formatter, string $defaultLocale, array $loaderIds = array(), array $options = array()) + public function __construct(ContainerInterface $container, MessageFormatterInterface $formatter, string $defaultLocale, array $loaderIds = array(), array $options = array()) { $this->container = $container; $this->loaderIds = $loaderIds; diff --git a/src/Symfony/Component/Translation/CHANGELOG.md b/src/Symfony/Component/Translation/CHANGELOG.md index 289fed1ce4344..ed821fa03d715 100644 --- a/src/Symfony/Component/Translation/CHANGELOG.md +++ b/src/Symfony/Component/Translation/CHANGELOG.md @@ -6,6 +6,7 @@ CHANGELOG * removed the backup feature of the `FileDumper` class * removed `TranslationWriter::writeTranslations()` method + * removed support for passing `MessageSelector` instances to the constructor of the `Translator` class 3.4.0 ----- diff --git a/src/Symfony/Component/Translation/Translator.php b/src/Symfony/Component/Translation/Translator.php index 5ed01af58b914..f691e65ba6525 100644 --- a/src/Symfony/Component/Translation/Translator.php +++ b/src/Symfony/Component/Translation/Translator.php @@ -85,14 +85,11 @@ class Translator implements TranslatorInterface, TranslatorBagInterface * * @throws InvalidArgumentException If a locale contains invalid characters */ - public function __construct($locale, $formatter = null, $cacheDir = null, $debug = false) + public function __construct($locale, MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = false) { $this->setLocale($locale); - if ($formatter instanceof MessageSelector) { - $formatter = new MessageFormatter($formatter); - @trigger_error(sprintf('Passing a "%s" instance into the "%s" as a second argument is deprecated since version 3.4 and will be removed in 4.0. Inject a "%s" implementation instead.', MessageSelector::class, __METHOD__, MessageFormatterInterface::class), E_USER_DEPRECATED); - } elseif (null === $formatter) { + if (null === $formatter) { $formatter = new MessageFormatter(); }
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: