Skip to content

Commit 72a2ee0

Browse files
committed
Tests: make dataproviders static
As of PHPUnit 10, data providers are (again) expected to be `static` methods. While the test suite does not (yet) support PHPUnit 10, it's still not a bad idea to already start complying with this.
1 parent ed6cff1 commit 72a2ee0

37 files changed

+82
-82
lines changed

tests/Core/Config/ReportWidthTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public function testReportWidthInputHandling($input, $expected)
267267
*
268268
* @return array
269269
*/
270-
public function dataReportWidthInputHandling()
270+
public static function dataReportWidthInputHandling()
271271
{
272272
return [
273273
'No value (empty string)' => [

tests/Core/ErrorSuppressionTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testSuppressError($before, $after, $expectedErrors=0)
6565
*
6666
* @return array
6767
*/
68-
public function dataSuppressError()
68+
public static function dataSuppressError()
6969
{
7070
return [
7171
'no suppression' => [
@@ -204,7 +204,7 @@ public function testSuppressSomeErrors($before, $between, $expectedErrors=1)
204204
*
205205
* @return array
206206
*/
207-
public function dataSuppressSomeErrors()
207+
public static function dataSuppressSomeErrors()
208208
{
209209
return [
210210
'no suppression' => [
@@ -296,7 +296,7 @@ public function testSuppressWarning($before, $after, $expectedWarnings=0)
296296
*
297297
* @return array
298298
*/
299-
public function dataSuppressWarning()
299+
public static function dataSuppressWarning()
300300
{
301301
return [
302302
'no suppression' => [
@@ -381,7 +381,7 @@ public function testSuppressLine($before, $after='', $expectedErrors=1)
381381
*
382382
* @return array
383383
*/
384-
public function dataSuppressLine()
384+
public static function dataSuppressLine()
385385
{
386386
return [
387387
'no suppression' => [
@@ -532,7 +532,7 @@ public function testNestedSuppressLine($before, $after)
532532
*
533533
* @return array
534534
*/
535-
public function dataNestedSuppressLine()
535+
public static function dataNestedSuppressLine()
536536
{
537537
return [
538538
// Process with disable/enable suppression and no single line suppression.
@@ -627,7 +627,7 @@ function myFunction() {
627627
*
628628
* @return array
629629
*/
630-
public function dataSuppressScope()
630+
public static function dataSuppressScope()
631631
{
632632
return [
633633
'no suppression' => [
@@ -722,7 +722,7 @@ class MyClass {}
722722
*
723723
* @return array
724724
*/
725-
public function dataSuppressFile()
725+
public static function dataSuppressFile()
726726
{
727727
return [
728728
'no suppression' => [
@@ -821,7 +821,7 @@ public function testDisableSelected($before, $expectedErrors=0, $expectedWarning
821821
*
822822
* @return array
823823
*/
824-
public function dataDisableSelected()
824+
public static function dataDisableSelected()
825825
{
826826
return [
827827
// Single sniff.
@@ -928,7 +928,7 @@ public function testEnableSelected($code, $expectedErrors, $expectedWarnings)
928928
*
929929
* @return array
930930
*/
931-
public function dataEnableSelected()
931+
public static function dataEnableSelected()
932932
{
933933
return [
934934
'disable/enable: a single sniff' => [
@@ -1108,7 +1108,7 @@ public function testIgnoreSelected($before, $expectedErrors, $expectedWarnings)
11081108
*
11091109
* @return array
11101110
*/
1111-
public function dataIgnoreSelected()
1111+
public static function dataIgnoreSelected()
11121112
{
11131113
return [
11141114
'no suppression' => [
@@ -1195,7 +1195,7 @@ public function testCommenting($code, $expectedErrors, $expectedWarnings)
11951195
*
11961196
* @return array
11971197
*/
1198-
public function dataCommenting()
1198+
public static function dataCommenting()
11991199
{
12001200
return [
12011201
'ignore: single sniff' => [

tests/Core/File/FindExtendedClassNameTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function testFindExtendedClassName($identifier, $expected)
7474
*
7575
* @return array<string, array<string, string|false>>
7676
*/
77-
public function dataExtendedClass()
77+
public static function dataExtendedClass()
7878
{
7979
return [
8080
'class does not extend' => [

tests/Core/File/FindImplementedInterfaceNamesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function testFindImplementedInterfaceNames($identifier, $expected)
7373
*
7474
* @return array<string, array<string, string|array<string>>>
7575
*/
76-
public function dataImplementedInterface()
76+
public static function dataImplementedInterface()
7777
{
7878
return [
7979
'interface declaration, no implements' => [

tests/Core/File/GetClassPropertiesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function testNotAClassException($testMarker, $tokenType)
4747
*
4848
* @return array<string, array<string, string|int>>
4949
*/
50-
public function dataNotAClassException()
50+
public static function dataNotAClassException()
5151
{
5252
return [
5353
'interface' => [
@@ -93,7 +93,7 @@ public function testGetClassProperties($testMarker, $expected)
9393
*
9494
* @return array<string, array<string, string|array<string, bool|int>>>
9595
*/
96-
public function dataGetClassProperties()
96+
public static function dataGetClassProperties()
9797
{
9898
return [
9999
'no-properties' => [

tests/Core/File/GetMemberPropertiesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function testGetMemberProperties($identifier, $expected)
6060
*
6161
* @return array<string, array<string|array<string, string|int|bool>>>
6262
*/
63-
public function dataGetMemberProperties()
63+
public static function dataGetMemberProperties()
6464
{
6565
return [
6666
'var-modifier' => [
@@ -1106,7 +1106,7 @@ public function testNotClassPropertyException($identifier)
11061106
*
11071107
* @return array<string, array<string>>
11081108
*/
1109-
public function dataNotClassProperty()
1109+
public static function dataNotClassProperty()
11101110
{
11111111
return [
11121112
'method parameter' => ['/* testMethodParam */'],

tests/Core/File/IsReferenceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function testIsReference($identifier, $expected)
5959
*
6060
* @return array<string, array<string, string|bool>>
6161
*/
62-
public function dataIsReference()
62+
public static function dataIsReference()
6363
{
6464
return [
6565
'issue-1971-list-first-in-file' => [

tests/Core/Ruleset/RuleInclusionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function testRegisteredSniffCodes($key, $value)
131131
*
132132
* @return array
133133
*/
134-
public function dataRegisteredSniffCodes()
134+
public static function dataRegisteredSniffCodes()
135135
{
136136
return [
137137
[
@@ -364,7 +364,7 @@ public function testSettingProperties($sniffClass, $propertyName, $expectedValue
364364
*
365365
* @return array
366366
*/
367-
public function dataSettingProperties()
367+
public static function dataSettingProperties()
368368
{
369369
return [
370370
'Set property for complete standard: PSR2 ClassDeclaration' => [
@@ -455,7 +455,7 @@ public function testSettingInvalidPropertiesOnStandardsAndCategoriesSilentlyFail
455455
*
456456
* @return array
457457
*/
458-
public function dataSettingInvalidPropertiesOnStandardsAndCategoriesSilentlyFails()
458+
public static function dataSettingInvalidPropertiesOnStandardsAndCategoriesSilentlyFails()
459459
{
460460
return [
461461
'Set property for complete standard: PSR2 ClassDeclaration' => [

tests/Core/Ruleset/SetSniffPropertyTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function testSniffPropertiesGetSetWhenAllowed($name)
7474
*
7575
* @return array
7676
*/
77-
public function dataSniffPropertiesGetSetWhenAllowed()
77+
public static function dataSniffPropertiesGetSetWhenAllowed()
7878
{
7979
return [
8080
'Property allowed as explicitly declared' => ['SetPropertyAllowedAsDeclared'],
@@ -315,7 +315,7 @@ public function testDirectCallWithOldArrayFormatSetsProperty($propertyValue)
315315
*
316316
* @return array
317317
*/
318-
public function dataDirectCallWithOldArrayFormatSetsProperty()
318+
public static function dataDirectCallWithOldArrayFormatSetsProperty()
319319
{
320320
return [
321321
'Property value is not an array (boolean)' => [false],

tests/Core/Tokenizer/AnonClassParenthesisOwnerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function testAnonClassNoParenthesesNextOpenClose($testMarker)
7272
*
7373
* @return array
7474
*/
75-
public function dataAnonClassNoParentheses()
75+
public static function dataAnonClassNoParentheses()
7676
{
7777
return [
7878
['/* testNoParentheses */'],
@@ -131,7 +131,7 @@ public function testAnonClassWithParentheses($testMarker)
131131
*
132132
* @return array
133133
*/
134-
public function dataAnonClassWithParentheses()
134+
public static function dataAnonClassWithParentheses()
135135
{
136136
return [
137137
['/* testWithParentheses */'],

0 commit comments

Comments
 (0)