updated-packages
This commit is contained in:
@@ -16,6 +16,9 @@ use Symfony\Component\Translation\MessageSelector;
|
||||
use Symfony\Component\Translation\TranslatorInterface as LegacyTranslatorInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
// Help opcache.preload discover always-needed symbols
|
||||
class_exists(IntlFormatter::class);
|
||||
|
||||
/**
|
||||
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
|
||||
*/
|
||||
@@ -32,7 +35,7 @@ class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterf
|
||||
if ($translator instanceof MessageSelector) {
|
||||
$translator = new IdentityTranslator($translator);
|
||||
} elseif (null !== $translator && !$translator instanceof TranslatorInterface && !$translator instanceof LegacyTranslatorInterface) {
|
||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||
}
|
||||
|
||||
$this->translator = $translator ?? new IdentityTranslator();
|
||||
@@ -42,7 +45,7 @@ class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterf
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function format($message, $locale, array $parameters = array())
|
||||
public function format($message, $locale, array $parameters = [])
|
||||
{
|
||||
if ($this->translator instanceof TranslatorInterface) {
|
||||
return $this->translator->trans($message, $parameters, null, $locale);
|
||||
@@ -54,7 +57,7 @@ class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterf
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function formatIntl(string $message, string $locale, array $parameters = array()): string
|
||||
public function formatIntl(string $message, string $locale, array $parameters = []): string
|
||||
{
|
||||
return $this->intlFormatter->formatIntl($message, $locale, $parameters);
|
||||
}
|
||||
@@ -64,16 +67,16 @@ class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterf
|
||||
*
|
||||
* @deprecated since Symfony 4.2, use format() with a %count% parameter instead
|
||||
*/
|
||||
public function choiceFormat($message, $number, $locale, array $parameters = array())
|
||||
public function choiceFormat($message, $number, $locale, array $parameters = [])
|
||||
{
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the format() one instead with a %count% parameter.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the format() one instead with a %%count%% parameter.', __METHOD__), \E_USER_DEPRECATED);
|
||||
|
||||
$parameters = array('%count%' => $number) + $parameters;
|
||||
$parameters = ['%count%' => $number] + $parameters;
|
||||
|
||||
if ($this->translator instanceof TranslatorInterface) {
|
||||
return $this->format($message, $locale, $parameters);
|
||||
}
|
||||
|
||||
return $this->format($this->translator->transChoice($message, $number, array(), null, $locale), $locale, $parameters);
|
||||
return $this->format($this->translator->transChoice($message, $number, [], null, $locale), $locale, $parameters);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user