Fix and update Composer autoload

This commit is contained in:
Frédéric Guillot
2021-12-16 13:44:31 -08:00
committed by Frédéric Guillot
parent 3e139ab6f4
commit 4cfdb88813
78 changed files with 1854 additions and 1893 deletions

View File

@@ -1,3 +0,0 @@
vendor/
composer.lock
phpunit.xml

View File

@@ -1,4 +1,4 @@
Copyright (c) 2018-2020 Fabien Potencier
Copyright (c) 2018-2019 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -158,10 +158,10 @@ class TranslatorTest extends TestCase
/**
* @dataProvider getNonMatchingMessages
* @expectedException \InvalidArgumentException
*/
public function testThrowExceptionIfMatchingMessageCannotBeFound($id, $number)
{
$this->expectException('InvalidArgumentException');
$translator = $this->getTranslator();
$translator->trans($id, ['%count%' => $number]);

View File

@@ -43,9 +43,7 @@ trait TranslatorTrait
*/
public function trans($id, array $parameters = [], $domain = null, $locale = null)
{
if ('' === $id = (string) $id) {
return '';
}
$id = (string) $id;
if (!isset($parameters['%count%']) || !is_numeric($parameters['%count%'])) {
return strtr($id, $parameters);
@@ -92,8 +90,8 @@ EOF;
}
}
} else {
$leftNumber = '-Inf' === $matches['left'] ? -\INF : (float) $matches['left'];
$rightNumber = is_numeric($matches['right']) ? (float) $matches['right'] : \INF;
$leftNumber = '-Inf' === $matches['left'] ? -INF : (float) $matches['left'];
$rightNumber = \is_numeric($matches['right']) ? (float) $matches['right'] : INF;
if (('[' === $matches['left_delimiter'] ? $number >= $leftNumber : $number > $leftNumber)
&& (']' === $matches['right_delimiter'] ? $number <= $rightNumber : $number < $rightNumber)
@@ -119,7 +117,7 @@ EOF;
$message = sprintf('Unable to choose a translation for "%s" with locale "%s" for value "%d". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %%count%% apples").', $id, $locale, $number);
if (class_exists(InvalidArgumentException::class)) {
if (\class_exists(InvalidArgumentException::class)) {
throw new InvalidArgumentException($message);
}

View File

@@ -16,7 +16,7 @@
}
],
"require": {
"php": ">=7.1.3"
"php": "^7.1.3"
},
"suggest": {
"symfony/translation-implementation": ""
@@ -28,10 +28,6 @@
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
}
}