feature #24176 [Translation] drop MessageSelector support in the Translator (xabbuh)
This PR was merged into the 4.0-dev branch.
Discussion
----------
[Translation] drop MessageSelector support in the Translator
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
2028a83689
drop MessageSelector support in the Translator
This commit is contained in:
commit
3e4f97852d
@ -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;
|
||||
|
@ -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
|
||||
-----
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user