Skip to content

Commit 1703a6b

Browse files
authored
Merge pull request #255 from PHPCSStandards/feature/tests-static-dataproviders
Tests: make dataproviders `static`
2 parents ed6cff1 + 72a2ee0 commit 1703a6b

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 */'],

tests/Core/Tokenizer/ArrayKeywordTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testArrayKeyword($testMarker, $testContent='array')
5151
*
5252
* @return array
5353
*/
54-
public function dataArrayKeyword()
54+
public static function dataArrayKeyword()
5555
{
5656
return [
5757
'empty array' => ['/* testEmptyArray */'],
@@ -103,7 +103,7 @@ public function testArrayType($testMarker, $testContent='array')
103103
*
104104
* @return array
105105
*/
106-
public function dataArrayType()
106+
public static function dataArrayType()
107107
{
108108
return [
109109
'closure return type' => [
@@ -154,7 +154,7 @@ public function testNotArrayKeyword($testMarker, $testContent='array')
154154
*
155155
* @return array
156156
*/
157-
public function dataNotArrayKeyword()
157+
public static function dataNotArrayKeyword()
158158
{
159159
return [
160160
'class-constant-name' => [

tests/Core/Tokenizer/AttributesTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function ($token) use ($attribute, $length) {
6666
*
6767
* @return array
6868
*/
69-
public function dataAttribute()
69+
public static function dataAttribute()
7070
{
7171
return [
7272
[
@@ -345,7 +345,7 @@ function ($token) use ($attribute, $length) {
345345
*
346346
* @return array
347347
*/
348-
public function dataAttributeOnParameters()
348+
public static function dataAttributeOnParameters()
349349
{
350350
return [
351351
[
@@ -451,7 +451,7 @@ public function testAttributeContainingTextLookingLikeCloseTag($testMarker, $len
451451
*
452452
* @return array
453453
*/
454-
public function dataAttributeOnTextLookingLikeCloseTag()
454+
public static function dataAttributeOnTextLookingLikeCloseTag()
455455
{
456456
return [
457457
[

tests/Core/Tokenizer/BackfillEnumTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function testEnums($testMarker, $testContent, $openerOffset, $closerOffse
7575
*
7676
* @return array
7777
*/
78-
public function dataEnums()
78+
public static function dataEnums()
7979
{
8080
return [
8181
[
@@ -154,7 +154,7 @@ public function testNotEnums($testMarker, $testContent)
154154
*
155155
* @return array
156156
*/
157-
public function dataNotEnums()
157+
public static function dataNotEnums()
158158
{
159159
return [
160160
[

tests/Core/Tokenizer/BackfillExplicitOctalNotationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function testExplicitOctalNotation($marker, $value, $nextToken, $nextCont
4949
*
5050
* @return array
5151
*/
52-
public function dataExplicitOctalNotation()
52+
public static function dataExplicitOctalNotation()
5353
{
5454
return [
5555
[

tests/Core/Tokenizer/BackfillFnTokenTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ public function testInMatchValue($testMarker, $openerOffset, $closerOffset, $exp
581581
*
582582
* @return array
583583
*/
584-
public function dataInMatchValue()
584+
public static function dataInMatchValue()
585585
{
586586
return [
587587
'not_last_value' => [
@@ -671,7 +671,7 @@ public function testNotAnArrowFunction($testMarker, $testContent='fn')
671671
*
672672
* @return array
673673
*/
674-
public function dataNotAnArrowFunction()
674+
public static function dataNotAnArrowFunction()
675675
{
676676
return [
677677
['/* testFunctionName */'],

tests/Core/Tokenizer/BackfillMatchTokenTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testMatchExpression($testMarker, $openerOffset, $closerOffset, $
5353
*
5454
* @return array
5555
*/
56-
public function dataMatchExpression()
56+
public static function dataMatchExpression()
5757
{
5858
return [
5959
'simple_match' => [
@@ -243,7 +243,7 @@ public function testNotAMatchStructure($testMarker, $testContent='match')
243243
*
244244
* @return array
245245
*/
246-
public function dataNotAMatchStructure()
246+
public static function dataNotAMatchStructure()
247247
{
248248
return [
249249
'static_method_call' => ['/* testNoMatchStaticMethodCall */'],
@@ -346,7 +346,7 @@ public function testSwitchExpression($testMarker, $openerOffset, $closerOffset)
346346
*
347347
* @return array
348348
*/
349-
public function dataSwitchExpression()
349+
public static function dataSwitchExpression()
350350
{
351351
return [
352352
'switch_containing_match' => [
@@ -399,7 +399,7 @@ public function testSwitchCaseVersusMatch($testMarker, $openerOffset, $closerOff
399399
*
400400
* @return array
401401
*/
402-
public function dataSwitchCaseVersusMatch()
402+
public static function dataSwitchCaseVersusMatch()
403403
{
404404
return [
405405
'switch_with_nested_match_case_1' => [

tests/Core/Tokenizer/BackfillNumericSeparatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testBackfill($testData)
4444
*
4545
* @return array
4646
*/
47-
public function dataTestBackfill()
47+
public static function dataTestBackfill()
4848
{
4949
$testHexType = 'T_LNUMBER';
5050
if (PHP_INT_MAX < 0xCAFEF00D) {
@@ -191,7 +191,7 @@ public function testNoBackfill($testMarker, $expectedTokens)
191191
*
192192
* @return array
193193
*/
194-
public function dataNoBackfill()
194+
public static function dataNoBackfill()
195195
{
196196
return [
197197
[

0 commit comments

Comments
 (0)