This commit is contained in:
2025-05-12 14:25:25 +02:00
parent ab2db755ef
commit 9e378ca2b7
2719 changed files with 46505 additions and 60181 deletions

View File

@@ -69,7 +69,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA
/**
* @throws InvalidArgumentException If a locale contains invalid characters
*/
public function __construct(string $locale, MessageFormatterInterface $formatter = null, string $cacheDir = null, bool $debug = false, array $cacheVary = [])
public function __construct(string $locale, ?MessageFormatterInterface $formatter = null, ?string $cacheDir = null, bool $debug = false, array $cacheVary = [])
{
$this->setLocale($locale);
@@ -110,7 +110,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA
*
* @throws InvalidArgumentException If the locale contains invalid characters
*/
public function addResource(string $format, mixed $resource, string $locale, string $domain = null)
public function addResource(string $format, mixed $resource, string $locale, ?string $domain = null)
{
$domain ??= 'messages';
@@ -171,7 +171,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA
return $this->fallbackLocales;
}
public function trans(?string $id, array $parameters = [], string $domain = null, string $locale = null): string
public function trans(?string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string
{
if (null === $id || '' === $id) {
return '';
@@ -203,7 +203,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA
return $this->formatter->format($catalogue->get($id, $domain), $locale, $parameters);
}
public function getCatalogue(string $locale = null): MessageCatalogueInterface
public function getCatalogue(?string $locale = null): MessageCatalogueInterface
{
if (!$locale) {
$locale = $this->getLocale();