Skip to content

Commit 6980144

Browse files
committed
drop MessageSelector support in the Translator
1 parent 32fbfdb commit 6980144

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG
66

77
* removed the backup feature of the `FileDumper` class
88
* removed `TranslationWriter::writeTranslations()` method
9+
* removed support for passing `MessageSelector` instances to the constructor of the `Translator` class
910

1011
3.4.0
1112
-----

Translator.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,11 @@ class Translator implements TranslatorInterface, TranslatorBagInterface
8585
*
8686
* @throws InvalidArgumentException If a locale contains invalid characters
8787
*/
88-
public function __construct($locale, $formatter = null, $cacheDir = null, $debug = false)
88+
public function __construct($locale, MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = false)
8989
{
9090
$this->setLocale($locale);
9191

92-
if ($formatter instanceof MessageSelector) {
93-
$formatter = new MessageFormatter($formatter);
94-
@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);
95-
} elseif (null === $formatter) {
92+
if (null === $formatter) {
9693
$formatter = new MessageFormatter();
9794
}
9895

0 commit comments

Comments
 (0)