mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-10 00:43:50 +09:00
Updates to vendors etc
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
|
||||
namespace Symfony\Contracts\Translation\Test;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorTrait;
|
||||
@@ -45,7 +47,7 @@ class TranslatorTest extends TestCase
|
||||
|
||||
public function getTranslator(): TranslatorInterface
|
||||
{
|
||||
return new class() implements TranslatorInterface {
|
||||
return new class implements TranslatorInterface {
|
||||
use TranslatorTrait;
|
||||
};
|
||||
}
|
||||
@@ -53,6 +55,7 @@ class TranslatorTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getTransTests
|
||||
*/
|
||||
#[DataProvider('getTransTests')]
|
||||
public function testTrans($expected, $id, $parameters)
|
||||
{
|
||||
$translator = $this->getTranslator();
|
||||
@@ -63,6 +66,7 @@ class TranslatorTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getTransChoiceTests
|
||||
*/
|
||||
#[DataProvider('getTransChoiceTests')]
|
||||
public function testTransChoiceWithExplicitLocale($expected, $id, $number)
|
||||
{
|
||||
$translator = $this->getTranslator();
|
||||
@@ -75,6 +79,8 @@ class TranslatorTest extends TestCase
|
||||
*
|
||||
* @dataProvider getTransChoiceTests
|
||||
*/
|
||||
#[DataProvider('getTransChoiceTests')]
|
||||
#[RequiresPhpExtension('intl')]
|
||||
public function testTransChoiceWithDefaultLocale($expected, $id, $number)
|
||||
{
|
||||
$translator = $this->getTranslator();
|
||||
@@ -85,6 +91,7 @@ class TranslatorTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getTransChoiceTests
|
||||
*/
|
||||
#[DataProvider('getTransChoiceTests')]
|
||||
public function testTransChoiceWithEnUsPosix($expected, $id, $number)
|
||||
{
|
||||
$translator = $this->getTranslator();
|
||||
@@ -103,6 +110,7 @@ class TranslatorTest extends TestCase
|
||||
/**
|
||||
* @requires extension intl
|
||||
*/
|
||||
#[RequiresPhpExtension('intl')]
|
||||
public function testGetLocaleReturnsDefaultLocaleIfNotSet()
|
||||
{
|
||||
$translator = $this->getTranslator();
|
||||
@@ -139,6 +147,7 @@ class TranslatorTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getInterval
|
||||
*/
|
||||
#[DataProvider('getInterval')]
|
||||
public function testInterval($expected, $number, $interval)
|
||||
{
|
||||
$translator = $this->getTranslator();
|
||||
@@ -164,6 +173,7 @@ class TranslatorTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getChooseTests
|
||||
*/
|
||||
#[DataProvider('getChooseTests')]
|
||||
public function testChoose($expected, $id, $number, $locale = null)
|
||||
{
|
||||
$translator = $this->getTranslator();
|
||||
@@ -181,6 +191,7 @@ class TranslatorTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getNonMatchingMessages
|
||||
*/
|
||||
#[DataProvider('getNonMatchingMessages')]
|
||||
public function testThrowExceptionIfMatchingMessageCannotBeFound($id, $number)
|
||||
{
|
||||
$translator = $this->getTranslator();
|
||||
@@ -296,6 +307,7 @@ class TranslatorTest extends TestCase
|
||||
/**
|
||||
* @dataProvider failingLangcodes
|
||||
*/
|
||||
#[DataProvider('failingLangcodes')]
|
||||
public function testFailedLangcodes($nplural, $langCodes)
|
||||
{
|
||||
$matrix = $this->generateTestData($langCodes);
|
||||
@@ -305,6 +317,7 @@ class TranslatorTest extends TestCase
|
||||
/**
|
||||
* @dataProvider successLangcodes
|
||||
*/
|
||||
#[DataProvider('successLangcodes')]
|
||||
public function testLangcodes($nplural, $langCodes)
|
||||
{
|
||||
$matrix = $this->generateTestData($langCodes);
|
||||
@@ -359,14 +372,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,7 +35,7 @@ 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 '';
|
||||
@@ -111,7 +111,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.6-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
|
||||
Reference in New Issue
Block a user