diff --git a/composer.json b/composer.json index 036eebcb..b62a30de 100644 --- a/composer.json +++ b/composer.json @@ -34,9 +34,9 @@ ], "require": { "php": ">=8.1", - "spiral/core": "^3.15", - "spiral/logger": "^3.15", - "spiral/tokenizer": "^3.15", + "spiral/core": "^3.14.8", + "spiral/logger": "^3.14.8", + "spiral/tokenizer": "^3.14.8", "symfony/translation": "^5.1 || ^6.0 || ^7.0", "psr/event-dispatcher": "^1.0" }, diff --git a/src/Catalogue/CatalogueManager.php b/src/Catalogue/CatalogueManager.php index 15aba123..9ffe8e10 100644 --- a/src/Catalogue/CatalogueManager.php +++ b/src/Catalogue/CatalogueManager.php @@ -23,7 +23,7 @@ final class CatalogueManager implements CatalogueManagerInterface public function __construct( private readonly LoaderInterface $loader, - CacheInterface $cache = null + ?CacheInterface $cache = null ) { $this->cache = $cache ?? new NullCache(); } diff --git a/src/Exception/LocaleException.php b/src/Exception/LocaleException.php index cfeb30ea..8c0d7d41 100644 --- a/src/Exception/LocaleException.php +++ b/src/Exception/LocaleException.php @@ -12,7 +12,7 @@ class LocaleException extends TranslatorException public function __construct( protected string $locale, int $code = 0, - \Throwable $previous = null + ?\Throwable $previous = null ) { parent::__construct(\sprintf('Undefined locale \'%s\'', $locale), $code, $previous); } diff --git a/src/Traits/TranslatorTrait.php b/src/Traits/TranslatorTrait.php index e77ceb57..8aacdc1e 100644 --- a/src/Traits/TranslatorTrait.php +++ b/src/Traits/TranslatorTrait.php @@ -30,7 +30,7 @@ trait TranslatorTrait * * @throws ScopeException */ - protected function say(string $string, array $options = [], string $bundle = null): string + protected function say(string $string, array $options = [], ?string $bundle = null): string { if (Translator::isMessage($string)) { //Cut [[ and ]] diff --git a/src/Translator.php b/src/Translator.php index 822b6fbf..0743060f 100644 --- a/src/Translator.php +++ b/src/Translator.php @@ -67,7 +67,7 @@ public function getCatalogueManager(): CatalogueManagerInterface * * @throws LocaleException */ - 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 { $domain ??= $this->config->getDefaultDomain(); $locale ??= $this->locale; @@ -88,8 +88,8 @@ public function transChoice( string $id, string|int $number, array $parameters = [], - string $domain = null, - string $locale = null + ?string $domain = null, + ?string $locale = null ): string { $domain ??= $this->config->getDefaultDomain(); $locale ??= $this->locale; diff --git a/src/helpers.php b/src/helpers.php index df53702e..6600e06c 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -18,7 +18,7 @@ * @throws TranslatorException * @throws ScopeException */ - function l(string $string, array $options = [], string $domain = null): string + function l(string $string, array $options = [], ?string $domain = null): string { /** @psalm-suppress InternalMethod */ $container = ContainerScope::getContainer(); @@ -47,7 +47,7 @@ function l(string $string, array $options = [], string $domain = null): string * @throws TranslatorException * @throws ScopeException */ - function p(string $string, int $number, array $options = [], string $domain = null): string + function p(string $string, int $number, array $options = [], ?string $domain = null): string { /** @psalm-suppress InternalMethod */ $container = ContainerScope::getContainer(); diff --git a/tests/TraitTest.php b/tests/TraitTest.php index d8311940..d0045c51 100644 --- a/tests/TraitTest.php +++ b/tests/TraitTest.php @@ -27,7 +27,7 @@ class TraitTest extends TestCase use TranslatorTrait; /** - * @var \PHPUnit\Framework\MockObject\MockObject|ContainerInterface + * @var \PHPUnit_Framework_MockObject_MockObject|ContainerInterface */ private $container;