Skip to content

Commit 5f7a8c8

Browse files
committed
Changed data provider methods to static
1 parent 25a05ec commit 5f7a8c8

3 files changed

Lines changed: 11 additions & 26 deletions

File tree

tests/CompoundFixerTest.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,14 @@ protected function setUp(): void
2727
$this->runner = FixerTestRunner::withConfig($config);
2828
}
2929

30-
/**
31-
* @dataProvider fileList
32-
*
33-
* @param string $fileExpected
34-
* @param string $fileGiven
35-
*/
30+
/** @dataProvider fileList */
3631
public function test_FixedFiles_MatchExpectations(string $fileExpected, string $fileGiven)
3732
{
3833
$sourceCode = file_get_contents($fileGiven);
3934
$this->assertSame(file_get_contents($fileExpected), $this->runner->fix($sourceCode));
4035
}
4136

42-
public function fileList(): array
37+
public static function fileList(): iterable
4338
{
4439
$files = [];
4540
foreach (array_diff(scandir(__DIR__ . '/Fixtures/code-samples/Fixer'), ['..', '.']) as $file) {

tests/Sniffer/Sniffs/PhpDoc/CallableDefinitionSniffTest.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,14 @@
1717

1818
class CallableDefinitionSniffTest extends SnifferTest
1919
{
20-
/**
21-
* @dataProvider properties
22-
*
23-
* @param array $properties
24-
* @param int[] $expectedWarningLines
25-
*/
20+
/** @dataProvider properties */
2621
public function test_CallableParamDoc_WithoutDefinition_GivesWarning(array $properties, array $expectedWarningLines)
2722
{
2823
$this->setProperties($properties);
2924
$this->assertWarningLines('./tests/Fixtures/code-samples/Sniffs/PhpDocCallableDefinitions.php', $expectedWarningLines);
3025
}
3126

32-
public function properties(): array
27+
public static function properties(): iterable
3328
{
3429
return [
3530
[['syntax' => 'both', 'includeClosure' => false], range(15, 18)],

tests/Sniffer/Sniffs/PhpDoc/RequiredForPublicApiSniffTest.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,19 @@
1717

1818
class RequiredForPublicApiSniffTest extends SnifferTest
1919
{
20-
/**
21-
* @dataProvider classFileWarnings
22-
*
23-
* @param string $filename
24-
* @param array $warningLines
25-
*/
20+
/** @dataProvider classFileWarnings */
2621
public function test_Interface_Warnings(string $filename, array $warningLines)
2722
{
28-
$this->assertWarningLines($filename, $warningLines);
23+
$this->assertWarningLines('./tests/Fixtures/code-samples/Sniffs/' . $filename, $warningLines);
2924
}
3025

31-
public function classFileWarnings(): array
26+
public static function classFileWarnings(): iterable
3227
{
3328
return [
34-
'interface' => ['./tests/Fixtures/code-samples/Sniffs/PhpDocRequiredForInterfaceApi.php', [12]],
35-
'class' => ['./tests/Fixtures/code-samples/Sniffs/PhpDocRequiredForClassApi.php', [14]],
36-
'parent' => ['./tests/Fixtures/code-samples/Sniffs/PhpDocRequiredForParentApi.php', [8]],
37-
'invalid' => ['./tests/Fixtures/code-samples/Sniffs/PhpDocRequiredForInvalidClass.php', [8]]
29+
'interface' => ['PhpDocRequiredForInterfaceApi.php', [12]],
30+
'class' => ['PhpDocRequiredForClassApi.php', [14]],
31+
'parent' => ['PhpDocRequiredForParentApi.php', [8]],
32+
'invalid' => ['PhpDocRequiredForInvalidClass.php', [8]]
3833
];
3934
}
4035

0 commit comments

Comments
 (0)