Skip to content

Commit

Permalink
Make static data providers that are not using dynamic calls (#6696)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos committed Dec 5, 2022
1 parent ad0a87e commit a2bdba3
Show file tree
Hide file tree
Showing 317 changed files with 893 additions and 893 deletions.
2 changes: 1 addition & 1 deletion tests/AbstractDoctrineAnnotationFixerTestCase.php
Expand Up @@ -34,7 +34,7 @@ public function testConfigureWithInvalidConfiguration(array $configuration): voi
$this->fixer->configure($configuration);
}

public function provideInvalidConfigurationCases(): array
public static function provideInvalidConfigurationCases(): array
{
return [
[['foo' => 'bar']],
Expand Down
2 changes: 1 addition & 1 deletion tests/AbstractFunctionReferenceFixerTest.php
Expand Up @@ -55,7 +55,7 @@ public function testAbstractFunctionReferenceFixer(
static::assertFalse($tokens->isChanged());
}

public function provideAbstractFunctionReferenceFixerCases(): array
public static function provideAbstractFunctionReferenceFixerCases(): array
{
return [
'simple case I' => [
Expand Down
2 changes: 1 addition & 1 deletion tests/AutoReview/CommandTest.php
Expand Up @@ -38,7 +38,7 @@ public function testCommandHasNameConst(Command $command): void
static::assertNotNull($command::getDefaultName());
}

public function provideCommandHasNameConstCases(): array
public static function provideCommandHasNameConstCases(): array
{
$application = new Application();
$commands = $application->all();
Expand Down
2 changes: 1 addition & 1 deletion tests/AutoReview/DescribeCommandTest.php
Expand Up @@ -49,7 +49,7 @@ public function testDescribeCommand(FixerFactory $factory, string $fixerName): v
static::assertSame(0, $commandTester->getStatusCode());
}

public function provideDescribeCommandCases(): iterable
public static function provideDescribeCommandCases(): iterable
{
$factory = new FixerFactory();
$factory->registerBuiltInFixers();
Expand Down
4 changes: 2 additions & 2 deletions tests/AutoReview/FixerFactoryTest.php
Expand Up @@ -137,7 +137,7 @@ public function testFixersPriorityCasesHaveIntegrationTest(string $fixerName, ar
static::assertCount(0, $missingIntegrationsTests, sprintf("There shall be an integration test. How do you know that priority set up is good, if there is no integration test to check it?\nMissing:\n- %s", implode("\n- ", $missingIntegrationsTests)));
}

public function provideFixersPriorityCasesHaveIntegrationCases(): iterable
public static function provideFixersPriorityCasesHaveIntegrationCases(): iterable
{
foreach (self::getFixersPriorityGraph() as $fixerName => $edges) {
yield $fixerName => [$fixerName, $edges];
Expand Down Expand Up @@ -168,7 +168,7 @@ public function testPriorityIntegrationTestFilesAreListedAsPriorityCases(\SplFil
);
}

public function provideIntegrationTestFilesCases(): iterable
public static function provideIntegrationTestFilesCases(): iterable
{
foreach (new \DirectoryIterator(self::getIntegrationPriorityDirectory()) as $candidate) {
if (!$candidate->isDot()) {
Expand Down
4 changes: 2 additions & 2 deletions tests/AutoReview/ProjectCodeTest.php
Expand Up @@ -683,7 +683,7 @@ static function (string $className): bool {
/**
* @return iterable<array{class-string<TestCase>}>
*/
public function provideTestClassCases(): iterable
public static function provideTestClassCases(): iterable
{
if (null === self::$testClassCases) {
self::$testClassCases = array_map(
Expand Down Expand Up @@ -716,7 +716,7 @@ public function testPhpUnitFixerExtendsAbstractPhpUnitFixer(string $className):
static::assertTrue($reflection->isSubclassOf(AbstractPhpUnitFixer::class));
}

public function providePhpUnitFixerExtendsAbstractPhpUnitFixerCases(): iterable
public static function providePhpUnitFixerExtendsAbstractPhpUnitFixerCases(): iterable
{
$factory = new FixerFactory();
$factory->registerBuiltInFixers();
Expand Down
2 changes: 1 addition & 1 deletion tests/AutoReview/TransformerTest.php
Expand Up @@ -101,7 +101,7 @@ public function provideTransformerPriorityCases(): array
/**
* @return TransformerInterface[]
*/
public function provideTransformerCases(): array
public static function provideTransformerCases(): array
{
static $transformersArray = null;

Expand Down
4 changes: 2 additions & 2 deletions tests/Cache/CacheTest.php
Expand Up @@ -119,7 +119,7 @@ public function testFromJsonThrowsInvalidArgumentExceptionIfJsonIsMissingKey(arr
Cache::fromJson($json);
}

public function provideMissingDataCases(): array
public static function provideMissingDataCases(): array
{
$data = [
'php' => '7.1.2',
Expand Down Expand Up @@ -158,7 +158,7 @@ public function testCanConvertToAndFromJson(SignatureInterface $signature): void
static::assertSame($hash, $cached->get($file));
}

public function provideCanConvertToAndFromJsonCases(): array
public static function provideCanConvertToAndFromJsonCases(): array
{
$toolInfo = new ToolInfo();
$config = new Config();
Expand Down
2 changes: 1 addition & 1 deletion tests/Cache/SignatureTest.php
Expand Up @@ -65,7 +65,7 @@ public function testEqualsReturnsFalseIfValuesAreNotIdentical(Signature $signatu
static::assertFalse($signature->equals($anotherSignature));
}

public function provideEqualsReturnsFalseIfValuesAreNotIdenticalCases(): iterable
public static function provideEqualsReturnsFalseIfValuesAreNotIdenticalCases(): iterable
{
$php = PHP_VERSION;
$version = '2.0';
Expand Down
2 changes: 1 addition & 1 deletion tests/ConfigTest.php
Expand Up @@ -248,7 +248,7 @@ public function testConfigDefault(): void
static::assertFalse($config->getUsingCache());
}

public function provideRegisterCustomFixersCases(): array
public static function provideRegisterCustomFixersCases(): array
{
$fixers = [
new NoWhitespaceBeforeCommaInArrayFixer(),
Expand Down
Expand Up @@ -40,7 +40,7 @@ public function testCalculate(int $expected, bool $isDryRun, bool $hasChangedFil
);
}

public function provideCalculateCases(): array
public static function provideCalculateCases(): array
{
return [
[0, true, false, false, false, false],
Expand Down
4 changes: 2 additions & 2 deletions tests/Console/Command/HelpCommandTest.php
Expand Up @@ -36,7 +36,7 @@ public function testToString(string $expected, $input): void
static::assertSame($expected, HelpCommand::toString($input));
}

public function provideToStringCases(): iterable
public static function provideToStringCases(): iterable
{
yield ["['a' => 3, 'b' => 'c']", ['a' => 3, 'b' => 'c']];

Expand Down Expand Up @@ -71,7 +71,7 @@ public function testGetDisplayableAllowedValues($expected, FixerOptionInterface
static::assertSame($expected, HelpCommand::getDisplayableAllowedValues($input));
}

public function provideGetDisplayableAllowedValuesCases(): iterable
public static function provideGetDisplayableAllowedValuesCases(): iterable
{
yield [null, new FixerOption('foo', 'bar', false, null, ['int'], [])];

Expand Down
6 changes: 3 additions & 3 deletions tests/Console/Command/SelfUpdateCommandTest.php
Expand Up @@ -81,7 +81,7 @@ public function testCommandName(string $name): void
static::assertSame($command, $application->find($name));
}

public function provideCommandNameCases(): array
public static function provideCommandNameCases(): array
{
return [
['self-update'],
Expand Down Expand Up @@ -276,7 +276,7 @@ public function testExecuteWhenNotAbleToGetLatestVersions(
static::assertSame(1, $commandTester->getStatusCode());
}

public function provideExecuteWhenNotAbleToGetLatestVersionsCases(): array
public static function provideExecuteWhenNotAbleToGetLatestVersionsCases(): array
{
return [
[false, false, [], true],
Expand Down Expand Up @@ -322,7 +322,7 @@ public function testExecuteWhenNotInstalledAsPhar(array $input, bool $decorated)
static::assertSame(1, $commandTester->getStatusCode());
}

public function provideExecuteWhenNotInstalledAsPharCases(): array
public static function provideExecuteWhenNotInstalledAsPharCases(): array
{
return [
[[], true],
Expand Down
20 changes: 10 additions & 10 deletions tests/Console/ConfigurationResolverTest.php
Expand Up @@ -130,7 +130,7 @@ public function testResolveProgressWithNegativeConfigAndExplicitProgress(string
static::assertSame($progressType, $resolver->getProgress());
}

public function provideProgressTypeCases(): array
public static function provideProgressTypeCases(): array
{
return [
['none'],
Expand Down Expand Up @@ -297,7 +297,7 @@ public function testResolvePath(array $paths, string $cwd, array $expectedPaths)
static::assertSame($expectedPaths, $resolver->getPath());
}

public function providePathCases(): iterable
public static function providePathCases(): iterable
{
yield [
['Command'],
Expand Down Expand Up @@ -343,7 +343,7 @@ public function testRejectInvalidPath(array $paths, string $expectedMessage): vo
$resolver->getPath();
}

public function provideEmptyPathCases(): iterable
public static function provideEmptyPathCases(): iterable
{
yield [
[''],
Expand Down Expand Up @@ -497,7 +497,7 @@ static function (\SplFileInfo $file): string {
static::assertSame($expected, $intersectionItems);
}

public function provideResolveIntersectionOfPathsCases(): array
public static function provideResolveIntersectionOfPathsCases(): array
{
$dir = __DIR__.'/../Fixtures/ConfigurationResolverPathsIntersection';
$cb = static function (array $items) use ($dir): array {
Expand Down Expand Up @@ -665,7 +665,7 @@ public function testConfigFinderIsOverridden(array $options, bool $expectedResul
static::assertSame($expectedResult, $resolver->configFinderIsOverridden());
}

public function provideConfigFinderIsOverriddenCases(): array
public static function provideConfigFinderIsOverriddenCases(): array
{
$root = __DIR__.'/../..';

Expand Down Expand Up @@ -971,7 +971,7 @@ public function testResolveRenamedRulesWithUnknownRules(string $expectedMessage,
$resolver->getRules();
}

public function provideRenamedRulesCases(): iterable
public static function provideRenamedRulesCases(): iterable
{
yield 'with config' => [
'The rules contain unknown fixers: "blank_line_before_return" is renamed (did you mean "blank_line_before_statement"? (note: use configuration "[\'statements\' => [\'return\']]")).
Expand Down Expand Up @@ -1079,7 +1079,7 @@ public function testResolveDiffer(string $expected, $diffConfig): void
static::assertInstanceOf($expected, $resolver->getDiffer());
}

public function provideDifferCases(): array
public static function provideDifferCases(): array
{
return [
[
Expand Down Expand Up @@ -1120,7 +1120,7 @@ public function testDeprecationOfPassingOtherThanNoOrYes(): void
$resolver->getRiskyAllowed();
}

public function provideResolveBooleanOptionCases(): array
public static function provideResolveBooleanOptionCases(): array
{
return [
[true, true, 'yes'],
Expand Down Expand Up @@ -1161,7 +1161,7 @@ public function testDeprecatedFixerConfigured($ruleConfig): void
$resolver->getFixers();
}

public function provideDeprecatedFixerConfiguredCases(): array
public static function provideDeprecatedFixerConfiguredCases(): array
{
return [
[true],
Expand All @@ -1170,7 +1170,7 @@ public function provideDeprecatedFixerConfiguredCases(): array
];
}

public function provideGetDirectoryCases(): array
public static function provideGetDirectoryCases(): array
{
return [
[null, '/my/path/my/file', 'path/my/file'],
Expand Down
2 changes: 1 addition & 1 deletion tests/Console/Output/ProcessOutputTest.php
Expand Up @@ -55,7 +55,7 @@ public function testProcessProgressOutput(array $statuses, string $expectedOutpu
static::assertSame($expectedOutput, $output->fetch());
}

public function provideProcessProgressOutputCases(): array
public static function provideProcessProgressOutputCases(): array
{
return [
[
Expand Down
4 changes: 2 additions & 2 deletions tests/Console/SelfUpdate/NewVersionCheckerTest.php
Expand Up @@ -42,7 +42,7 @@ public function testGetLatestVersionOfMajor(int $majorVersion, ?string $expected
static::assertSame($expectedVersion, $checker->getLatestVersionOfMajor($majorVersion));
}

public function provideLatestVersionOfMajorCases(): array
public static function provideLatestVersionOfMajorCases(): array
{
return [
[1, 'v1.13.2'],
Expand All @@ -68,7 +68,7 @@ public function testCompareVersions(string $versionA, string $versionB, int $exp
);
}

public function provideCompareVersionsCases(): array
public static function provideCompareVersionsCases(): array
{
$cases = [];

Expand Down
2 changes: 1 addition & 1 deletion tests/Differ/DiffConsoleFormatterTest.php
Expand Up @@ -38,7 +38,7 @@ public function testDiffConsoleFormatter(string $expected, bool $isDecoratedOutp
);
}

public function provideTestCases(): array
public static function provideTestCases(): array
{
return [
[
Expand Down
22 changes: 11 additions & 11 deletions tests/DocBlock/AnnotationTest.php
Expand Up @@ -99,7 +99,7 @@ public function testGetContent(int $index, string $content): void
static::assertSame($content, (string) $annotation);
}

public function provideGetContentCases(): iterable
public static function provideGetContentCases(): iterable
{
foreach (self::$content as $index => $content) {
yield [$index, $content];
Expand All @@ -117,7 +117,7 @@ public function testStart(int $index, int $start): void
static::assertSame($start, $annotation->getStart());
}

public function provideStartCases(): iterable
public static function provideStartCases(): iterable
{
foreach (self::$start as $index => $start) {
yield [$index, $start];
Expand All @@ -135,7 +135,7 @@ public function testEnd(int $index, int $end): void
static::assertSame($end, $annotation->getEnd());
}

public function provideEndCases(): iterable
public static function provideEndCases(): iterable
{
foreach (self::$end as $index => $end) {
yield [$index, $end];
Expand All @@ -153,7 +153,7 @@ public function testGetTag(int $index, string $tag): void
static::assertSame($tag, $annotation->getTag()->getName());
}

public function provideGetTagCases(): iterable
public static function provideGetTagCases(): iterable
{
foreach (self::$tags as $index => $tag) {
yield [$index, $tag];
Expand All @@ -174,7 +174,7 @@ public function testRemove(int $index, int $start, int $end): void
static::assertSame('', $doc->getLine($end)->getContent());
}

public function provideRemoveCases(): iterable
public static function provideRemoveCases(): iterable
{
foreach (self::$start as $index => $start) {
yield [$index, $start, self::$end[$index]];
Expand All @@ -193,7 +193,7 @@ public function testRemoveEdgeCases(string $expected, string $input): void
static::assertSame($expected, $doc->getContent());
}

public function provideRemoveEdgeCasesCases(): array
public static function provideRemoveEdgeCasesCases(): array
{
return [
// Single line
Expand Down Expand Up @@ -242,7 +242,7 @@ public function testTypeParsing(array $expected, string $input): void
static::assertSame($expected, $tag->getTypes());
}

public function provideTypeParsingCases(): array
public static function provideTypeParsingCases(): array
{
return [
[
Expand Down Expand Up @@ -468,7 +468,7 @@ public function testTypes(array $expected, array $new, string $input, string $ou
static::assertSame($output, $line->getContent());
}

public function provideTypesCases(): array
public static function provideTypesCases(): array
{
return [
[['Foo', 'null'], ['Bar[]'], ' * @param Foo|null $foo', ' * @param Bar[] $foo'],
Expand All @@ -494,7 +494,7 @@ public function testNormalizedTypes(array $expected, string $input): void
static::assertSame($expected, $tag->getNormalizedTypes());
}

public function provideNormalizedTypesCases(): array
public static function provideNormalizedTypesCases(): array
{
return [
[['null', 'string'], '* @param StRiNg|NuLl $foo'],
Expand Down Expand Up @@ -553,7 +553,7 @@ public function testGetTypeExpression(string $line, ?NamespaceAnalysis $namespac
static::assertSame($expectedCommonType, $result->getCommonType());
}

public function provideTypeExpressionCases(): iterable
public static function provideTypeExpressionCases(): iterable
{
$appNamespace = new NamespaceAnalysis('App', 'App', 0, 999, 0, 999);
$useTraversable = new NamespaceUseAnalysis('Traversable', 'Traversable', false, 0, 999, NamespaceUseAnalysis::TYPE_CLASS);
Expand All @@ -574,7 +574,7 @@ public function testGetVariableName(string $line, ?string $expectedVariableName)
static::assertSame($expectedVariableName, $annotation->getVariableName());
}

public function provideGetVariableCases(): iterable
public static function provideGetVariableCases(): iterable
{
yield ['* @param int $foo', '$foo'];

Expand Down

0 comments on commit a2bdba3

Please sign in to comment.