[Web] Update composer libraries

This commit is contained in:
FreddleSpl0it committed 2026-10-28 11:56:29 +01:00
1 parent 9cc8ac2908
commit bd8c784118
1297 files changed
+71585 -24460

No files matched your search

@@ -11,7 +11,10 @@
namespace Symfony\Contracts\Translation\Test;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Translation\TranslatableMessage;
use Symfony\Contracts\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorTrait;
@@ -24,7 +27,7 @@ use Symfony\Contracts\Translation\TranslatorTrait;
*
* As mentioned by chx http://drupal.org/node/1273968 we can cover all by testing number from 0 to 199
*
* The goal to cover all languages is to far fetched so this test case is smaller.
* The goal to cover all languages is too far fetched so this test case is smaller.
*
* @author Clemens Tolboom clemens@build2be.nl
*/
@@ -45,7 +48,7 @@ class TranslatorTest extends TestCase
public function getTranslator(): TranslatorInterface
{
return new class() implements TranslatorInterface {
return new class implements TranslatorInterface {
use TranslatorTrait;
};
}
@@ -53,6 +56,7 @@ class TranslatorTest extends TestCase
/**
* @dataProvider getTransTests
*/
#[DataProvider('getTransTests')]
public function testTrans($expected, $id, $parameters)
{
$translator = $this->getTranslator();
@@ -63,6 +67,7 @@ class TranslatorTest extends TestCase
/**
* @dataProvider getTransChoiceTests
*/
#[DataProvider('getTransChoiceTests')]
public function testTransChoiceWithExplicitLocale($expected, $id, $number)
{
$translator = $this->getTranslator();
@@ -75,6 +80,8 @@ class TranslatorTest extends TestCase
*
* @dataProvider getTransChoiceTests
*/
#[DataProvider('getTransChoiceTests')]
#[RequiresPhpExtension('intl')]
public function testTransChoiceWithDefaultLocale($expected, $id, $number)
{
$translator = $this->getTranslator();
@@ -85,6 +92,7 @@ class TranslatorTest extends TestCase
/**
* @dataProvider getTransChoiceTests
*/
#[DataProvider('getTransChoiceTests')]
public function testTransChoiceWithEnUsPosix($expected, $id, $number)
{
$translator = $this->getTranslator();
@@ -103,6 +111,7 @@ class TranslatorTest extends TestCase
/**
* @requires extension intl
*/
#[RequiresPhpExtension('intl')]
public function testGetLocaleReturnsDefaultLocaleIfNotSet()
{
$translator = $this->getTranslator();
@@ -116,10 +125,12 @@ class TranslatorTest extends TestCase
public static function getTransTests()
{
return [
['Symfony is great!', 'Symfony is great!', []],
['Symfony is awesome!', 'Symfony is %what%!', ['%what%' => 'awesome']],
];
yield ['Symfony is great!', 'Symfony is great!', []];
yield ['Symfony is awesome!', 'Symfony is %what%!', ['%what%' => 'awesome']];
if (class_exists(TranslatableMessage::class)) {
yield ['He said "Symfony is awesome!".', 'He said "%what%".', ['%what%' => new TranslatableMessage('Symfony is %what%!', ['%what%' => 'awesome'])]];
}
}
public static function getTransChoiceTests()
@@ -139,6 +150,7 @@ class TranslatorTest extends TestCase
/**
* @dataProvider getInterval
*/
#[DataProvider('getInterval')]
public function testInterval($expected, $number, $interval)
{
$translator = $this->getTranslator();
@@ -164,6 +176,7 @@ class TranslatorTest extends TestCase
/**
* @dataProvider getChooseTests
*/
#[DataProvider('getChooseTests')]
public function testChoose($expected, $id, $number, $locale = null)
{
$translator = $this->getTranslator();
@@ -181,6 +194,7 @@ class TranslatorTest extends TestCase
/**
* @dataProvider getNonMatchingMessages
*/
#[DataProvider('getNonMatchingMessages')]
public function testThrowExceptionIfMatchingMessageCannotBeFound($id, $number)
{
$translator = $this->getTranslator();
@@ -296,6 +310,7 @@ class TranslatorTest extends TestCase
/**
* @dataProvider failingLangcodes
*/
#[DataProvider('failingLangcodes')]
public function testFailedLangcodes($nplural, $langCodes)
{
$matrix = $this->generateTestData($langCodes);
@@ -305,6 +320,7 @@ class TranslatorTest extends TestCase
/**
* @dataProvider successLangcodes
*/
#[DataProvider('successLangcodes')]
public function testLangcodes($nplural, $langCodes)
{
$matrix = $this->generateTestData($langCodes);
@@ -333,7 +349,7 @@ class TranslatorTest extends TestCase
* This both depends on a complete list trying to add above as understanding
* the plural rules of the current failing languages.
*
* @return array with nplural together with langcodes
* @return array With nplural together with langcodes
*/
public static function failingLangcodes(): array
{
@@ -359,14 +375,14 @@ class TranslatorTest extends TestCase
if ($expectSuccess) {
$this->assertCount($nplural, $indexes, "Langcode '$langCode' has '$nplural' plural forms.");
} else {
$this->assertNotEquals((int) $nplural, \count($indexes), "Langcode '$langCode' has '$nplural' plural forms.");
$this->assertNotCount($nplural, $indexes, "Langcode '$langCode' has '$nplural' plural forms.");
}
}
}
protected function generateTestData($langCodes)
{
$translator = new class() {
$translator = new class {
use TranslatorTrait {
getPluralizationRule as public;
}
@@ -16,5 +16,5 @@ namespace Symfony\Contracts\Translation;
*/
interface TranslatableInterface
{
public function trans(TranslatorInterface $translator, string $locale = null): string;
public function trans(TranslatorInterface $translator, ?string $locale = null): string;
}
@@ -59,7 +59,7 @@ interface TranslatorInterface
*
* @throws \InvalidArgumentException If the locale contains invalid characters
*/
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;
/**
* Returns the default locale.
@@ -35,12 +35,18 @@ trait TranslatorTrait
return $this->locale ?: (class_exists(\Locale::class) ? \Locale::getDefault() : 'en');
}
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 '';
}
foreach ($parameters as $k => $v) {
if ($v instanceof TranslatableInterface) {
$parameters[$k] = $v->trans($this, $locale);
}
}
if (!isset($parameters['%count%']) || !is_numeric($parameters['%count%'])) {
return strtr($id, $parameters);
}
@@ -56,22 +62,22 @@ trait TranslatorTrait
}
$intervalRegexp = <<<'EOF'
/^(?P<interval>
({\s*
(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)
\s*})
/^(?P<interval>
({\s*
(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)
\s*})
|
|
(?P<left_delimiter>[\[\]])
\s*
(?P<left>-Inf|\-?\d+(\.\d+)?)
\s*,\s*
(?P<right>\+?Inf|\-?\d+(\.\d+)?)
\s*
(?P<right_delimiter>[\[\]])
)\s*(?P<message>.*?)$/xs
EOF;
(?P<left_delimiter>[\[\]])
\s*
(?P<left>-Inf|\-?\d+(\.\d+)?)
\s*,\s*
(?P<right>\+?Inf|\-?\d+(\.\d+)?)
\s*
(?P<right_delimiter>[\[\]])
)\s*(?P<message>.*?)$/xs
EOF;
$standardRules = [];
foreach ($parts as $part) {
@@ -111,7 +117,7 @@ EOF;
return strtr($standardRules[0], $parameters);
}
$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);
$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)) {
throw new InvalidArgumentException($message);
@@ -27,7 +27,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-main": "3.4-dev"
"dev-main": "3.7-dev"
},
"thanks": {
"name": "symfony/contracts",