diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php b/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php index 190bd5d0da..14cb2adecf 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 289fed1ce4..ed821fa03d 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 5ed01af58b..f691e65ba6 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(); }