Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ed56c53

Browse files
committed
[Translation] Fix test, null is valid according to the tests
1 parent 22437d4 commit ed56c53

10 files changed

+12
-14
lines changed

src/Symfony/Component/Translation/Formatter/MessageFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(TranslatorInterface $translator = null, IntlFormatte
3434
/**
3535
* {@inheritdoc}
3636
*/
37-
public function format(string $message, string $locale, array $parameters = [])
37+
public function format(string $message, ?string $locale, array $parameters = [])
3838
{
3939
if ($this->translator instanceof TranslatorInterface) {
4040
return $this->translator->trans($message, $parameters, null, $locale);

src/Symfony/Component/Translation/Formatter/MessageFormatterInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ interface MessageFormatterInterface
2626
*
2727
* @return string
2828
*/
29-
public function format(string $message, string $locale, array $parameters = []);
29+
public function format(string $message, ?string $locale, array $parameters = []);
3030
}

src/Symfony/Component/Translation/Loader/ArrayLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ArrayLoader implements LoaderInterface
2323
/**
2424
* {@inheritdoc}
2525
*/
26-
public function load($resource, string $locale, string $domain = 'messages')
26+
public function load($resource, ?string $locale, string $domain = 'messages')
2727
{
2828
$resource = $this->flatten($resource);
2929
$catalogue = new MessageCatalogue($locale);

src/Symfony/Component/Translation/Loader/FileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ abstract class FileLoader extends ArrayLoader
2323
/**
2424
* {@inheritdoc}
2525
*/
26-
public function load($resource, string $locale, string $domain = 'messages')
26+
public function load($resource, ?string $locale, string $domain = 'messages')
2727
{
2828
if (!stream_is_local($resource)) {
2929
throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource));

src/Symfony/Component/Translation/Loader/IcuDatFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class IcuDatFileLoader extends IcuResFileLoader
2626
/**
2727
* {@inheritdoc}
2828
*/
29-
public function load($resource, string $locale, string $domain = 'messages')
29+
public function load($resource, ?string $locale, string $domain = 'messages')
3030
{
3131
if (!stream_is_local($resource.'.dat')) {
3232
throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource));

src/Symfony/Component/Translation/Loader/IcuResFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class IcuResFileLoader implements LoaderInterface
2626
/**
2727
* {@inheritdoc}
2828
*/
29-
public function load($resource, string $locale, string $domain = 'messages')
29+
public function load($resource, ?string $locale, string $domain = 'messages')
3030
{
3131
if (!stream_is_local($resource)) {
3232
throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource));

src/Symfony/Component/Translation/Loader/LoaderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ interface LoaderInterface
3434
* @throws NotFoundResourceException when the resource cannot be found
3535
* @throws InvalidResourceException when the resource cannot be loaded
3636
*/
37-
public function load($resource, string $locale, string $domain = 'messages');
37+
public function load($resource, ?string $locale, string $domain = 'messages');
3838
}

src/Symfony/Component/Translation/Loader/QtFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class QtFileLoader implements LoaderInterface
2727
/**
2828
* {@inheritdoc}
2929
*/
30-
public function load($resource, string $locale, string $domain = 'messages')
30+
public function load($resource, ?string $locale, string $domain = 'messages')
3131
{
3232
if (!stream_is_local($resource)) {
3333
throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource));

src/Symfony/Component/Translation/Loader/XliffFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class XliffFileLoader implements LoaderInterface
2828
/**
2929
* {@inheritdoc}
3030
*/
31-
public function load($resource, string $locale, string $domain = 'messages')
31+
public function load($resource, ?string $locale, string $domain = 'messages')
3232
{
3333
if (!stream_is_local($resource)) {
3434
throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource));

src/Symfony/Component/Translation/Translator.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,10 @@ public function addLoader(string $format, LoaderInterface $loader)
119119
*
120120
* @param string $format The name of the loader (@see addLoader())
121121
* @param mixed $resource The resource name
122-
* @param string $locale The locale
123-
* @param string $domain The domain
124122
*
125123
* @throws InvalidArgumentException If the locale contains invalid characters
126124
*/
127-
public function addResource(string $format, $resource, string $locale, string $domain = null)
125+
public function addResource(string $format, $resource, ?string $locale, string $domain = null)
128126
{
129127
if (null === $domain) {
130128
$domain = 'messages';
@@ -248,7 +246,7 @@ protected function getLoaders()
248246
/**
249247
* @param string $locale
250248
*/
251-
protected function loadCatalogue(string $locale)
249+
protected function loadCatalogue(?string $locale)
252250
{
253251
if (null === $this->cacheDir) {
254252
$this->initializeCatalogue($locale);
@@ -260,7 +258,7 @@ protected function loadCatalogue(string $locale)
260258
/**
261259
* @param string $locale
262260
*/
263-
protected function initializeCatalogue(string $locale)
261+
protected function initializeCatalogue(?string $locale)
264262
{
265263
$this->assertValidLocale($locale);
266264

0 commit comments

Comments
 (0)