8000 Mutate remaining data providers to static ones by alexandre-daubois · Pull Request #58326 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Mutate remaining data providers to static ones #58326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 20, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public static function provideInlineStyleOptionsCases()
];
}

public function provideInlineStyleTagsWithUnknownOptions()
public static function provideInlineStyleTagsWithUnknownOptions()
{
return [
['<options=abc;>', 'abc'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ public static function provideDistinguishedChoices()
];
}

public function provideSameKeyChoices()
public static function provideSameKeyChoices()
{
// Only test types here that can be used as array keys
return [
Expand All @@ -597,7 +597,7 @@ public function provideSameKeyChoices()
];
}

public function provideDistinguishedKeyChoices()
public static function provideDistinguishedKeyChoices()
{
// Only test types here that can be used as array keys
return [
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Intl/Tests/LocalesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class LocalesTest extends ResourceBundleTestCase
{
public function testGetLocales()
{
$this->assertSame($this->getLocales(), Locales::getLocales());
$this->assertSame(static::getLocales(), Locales::getLocales());
}

public function testGetAliases()
{
$this->assertSame($this->getLocaleAliases(), Locales::getAliases());
$this->assertSame(static::getLocaleAliases(), Locales::getAliases());
}

/**
Expand All @@ -41,7 +41,7 @@ public function testGetNames($displayLocale)
// We can't assert on exact list of locale, as there's too many variations.
// The best we can do is to make sure getNames() returns a subset of what getLocales() returns.
$this->assertNotEmpty($locales);
$this->assertEmpty(array_diff($locales, $this->getLocales()));
$this->assertEmpty(array_diff($locales, static::getLocales()));
}

public function testGetNamesDefaultLocale()
Expand Down
26 changes: 9 additions & 17 deletions src/Symfony/Component/Intl/Tests/ResourceBundleTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -758,45 +758,37 @@ protected function tearDown(): void
\Locale::setDefault($this->defaultLocale);
}

public function provideLocales()
public static function provideLocales()
{
return array_map(
function ($locale) { return [$locale]; },
$this->getLocales()
static::getLocales()
);
}

public function provideLocaleAliases()
public static function provideLocaleAliases()
{
return array_map(
function ($alias, $ofLocale) { return [$alias, $ofLocale]; },
array_keys($this->getLocaleAliases()),
$this->getLocaleAliases()
array_keys(static::getLocaleAliases()),
static::getLocaleAliases()
);
}

public function provideRootLocales()
{
return array_map(
function ($locale) { return [$locale]; },
$this->getRootLocales()
);
}

protected function getLocales()
protected static function getLocales()
{
return self::LOCALES;
}

protected function getLocaleAliases()
protected static function getLocaleAliases()
{
return self::LOCALE_ALIASES;
}

protected function getRootLocales()
protected static function getRootLocales()
{
if (null === self::$rootLocales) {
self::$rootLocales = array_filter($this->getLocales(), function ($locale) {
self::$rootLocales = array_filter(static::getLocales(), function ($locale) {
// no locales for which fallback is possible (e.g "en_GB")
return !str_contains($locale, '_');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ public function testFindAllSqlGenerated(AbstractPlatform $platform, string $expe
$connection->findAll(50);
}

public function provideFindAllSqlGeneratedByPlatform(): iterable
public static function provideFindAllSqlGeneratedByPlatform(): iterable
{
yield 'MySQL' => [
class_exists(MySQLPlatform::class) ? new MySQLPlatform() : new MySQL57Platform(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ public function testDenormalizeBooleanTypesWithNotMatchingData(array $data, stri
$normalizer->denormalize($data, $type);
}

public function provideBooleanTypesData()
public static function provideBooleanTypesData()
{
return [
[['foo' => true], FalsePropertyDummy::class],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function testAsciiClosureRule()
$this->assertSame('Dieser Wert sollte grOEsser oder gleich', (string) $s->ascii([$rule]));
}

public function provideCreateFromCodePoint(): array
public static function provideCreateFromCodePoint(): array
{
return [
['', []],
Expand Down
Loading
0