Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- { php-version: 8.1, symfony-locked-version: 6.4.*, dependency-version: prefer-stable }
- { php-version: 8.3, symfony-locked-version: 6.4.*, dependency-version: prefer-stable }
- { php-version: 8.3, symfony-locked-version: 7.4.*, dependency-version: prefer-stable }
- { php-version: 8.4, symfony-locked-version: 8.1.*, dependency-version: prefer-stable }
name: PHPUnit (PHP ${{matrix.php-version}}, Symfony Version Lock ${{ matrix.symfony-locked-version }}, ${{ matrix.dependency-version }})
steps:
- uses: actions/checkout@v6
Expand Down
24 changes: 12 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@
}
],
"require": {
"php": "8.1.*|8.3.*",
"php": "8.1.*|8.3.*|8.4.*",
"ext-intl": "*",
"lib-icu": ">=4.8",
"jms/parser-lib": "^1.0.0",
"psr/log": "^1.0",
"symfony/config": "^6.0|^7.0",
"symfony/dependency-injection": "^6.0|^7.0",
"symfony/finder": "^6.0|^7.0",
"symfony/framework-bundle": "^6.0|^7.0",
"symfony/http-kernel": "^6.0|^7.0",
"symfony/translation": "^6.0|^7.0",
"psr/log": "^1.0|^2.0|^3.0",
"symfony/config": "^6.0|^7.0|^8.0",
"symfony/dependency-injection": "^6.0|^7.0|^8.0",
"symfony/finder": "^6.0|^7.0|^8.0",
"symfony/framework-bundle": "^6.0|^7.0|^8.0",
"symfony/http-kernel": "^6.0|^7.0|^8.0",
"symfony/translation": "^6.0|^7.0|^8.0",
"symfony/translation-contracts": "^2.0|^3.0",
"twig/twig": "^1.42|^2.0|^3.0"
},
"require-dev": {
"phpunit/phpunit": "^8.5 | ^9.0",
"symfony/monolog-bundle": "^3.4.31",
"symfony/phpunit-bridge": "^6.0|^7.0",
"symfony/twig-bundle": "^6.0|^7.0",
"symfony/yaml": "^6.0|^7.0"
"symfony/monolog-bundle": "^3.4.31|^4.0",
"symfony/phpunit-bridge": "^6.0|^7.0|^8.0",
"symfony/twig-bundle": "^6.0|^7.0|^8.0",
"symfony/yaml": "^6.0|^7.0|^8.0"
},
"autoload": {
"psr-4": {
Expand Down
8 changes: 4 additions & 4 deletions src/Translator/FormatterDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(TranslatorInterface $translator, FormatterInterface
$this->formatter = $formatter;
}

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
{
$message = $this->translator->trans($id, $parameters, $domain, $locale);

Expand All @@ -55,7 +55,7 @@ public function getLocale(): string
*
* @throws \Webfactory\IcuTranslationBundle\Translator\FormattingException if formatting fails
*/
protected function handleFormatting(string $id, string $message, array $parameters = [], string $locale = null): string
protected function handleFormatting(string $id, string $message, array $parameters = [], ?string $locale = null): string
{
if (empty($message)) {
// No formatting needed.
Expand All @@ -74,7 +74,7 @@ protected function handleFormatting(string $id, string $message, array $paramete
/**
* Applies Intl formatting on the provided message.
*/
protected function format(string $message, array $parameters = [], string $locale = null): string
protected function format(string $message, array $parameters = [], ?string $locale = null): string
{
return $this->formatter->format($locale, $message, $parameters);
}
Expand All @@ -85,7 +85,7 @@ protected function format(string $message, array $parameters = [], string $local
* If a correct locale is provided that one is used.
* Otherwise, the default locale is returned.
*/
protected function toLocale(string $locale = null): string
protected function toLocale(?string $locale = null): string
{
return $locale ?? $this->getLocale();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Translator/Formatting/GracefulExceptionsDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class GracefulExceptionsDecorator extends AbstractFormatterDecorator
* @param \Webfactory\IcuTranslationBundle\Translator\Formatting\FormatterInterface $innerFormatter
* @param LoggerInterface $logger
*/
public function __construct(FormatterInterface $innerFormatter, LoggerInterface $logger = null)
public function __construct(FormatterInterface $innerFormatter, ?LoggerInterface $logger = null)
{
parent::__construct($innerFormatter);
$this->logger = (null !== $logger) ? $logger : new NullLogger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MissingParameterWarningDecorator extends AbstractFormatterDecorator
* @param \Webfactory\IcuTranslationBundle\Translator\Formatting\FormatterInterface $innerFormatter
* @param LoggerInterface $logger
*/
public function __construct(FormatterInterface $innerFormatter, LoggerInterface $logger = null)
public function __construct(FormatterInterface $innerFormatter, ?LoggerInterface $logger = null)
{
parent::__construct($innerFormatter);
$this->logger = (null !== $logger) ? $logger : new NullLogger();
Expand Down
2 changes: 1 addition & 1 deletion src/Twig/IcuFormattingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function getFilters(): array
];
}

public function format(string $message = '', array $parameters = [], string $locale = null): string
public function format(string $message = '', array $parameters = [], ?string $locale = null): string
{
return $this->formatter->format($locale ?: $this->translator->getLocale(), $message, $parameters);
}
Expand Down
Loading