Fixes sprintf(): Too few arguments in Translator

Fixes the log produced when the method is called : 

Before : "sprintf(): Too few arguments"

After : "The "Symfony\Component\Translation\Translator::transChoice()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%count%" parameter."

Reference : http://php.net/manual/function.sprintf.php
This commit is contained in:
Stéphane Delprat 2018-11-27 13:52:28 +09:00 committed by Nicolas Grekas
parent 1aaf73e396
commit 45c3de044e

View File

@ -226,7 +226,7 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran
*/
public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%count%" parameter.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%%count%%" parameter.', __METHOD__), E_USER_DEPRECATED);
if (!$this->formatter instanceof ChoiceMessageFormatterInterface) {
throw new LogicException(sprintf('The formatter "%s" does not support plural translations.', \get_class($this->formatter)));