@@ -64,31 +64,29 @@ final protected function doTest(string $expected, ?string $input = null, ?SplFil
64
64
$ fileIsSupported = $ this ->fixer ->supports ($ file );
65
65
66
66
if (null !== $ input ) {
67
- static ::assertNull ($ this ->lintSource ($ input ));
67
+ self ::assertNull ($ this ->lintSource ($ input ));
68
68
69
69
Tokens::clearCache ();
70
70
$ tokens = Tokens::fromCode ($ input );
71
71
72
72
if ($ fileIsSupported ) {
73
- static ::assertTrue ($ this ->fixer ->isCandidate ($ tokens ), 'Fixer must be a candidate for input code. ' );
74
- static ::assertFalse ($ tokens ->isChanged (), 'Fixer must not touch Tokens on candidate check. ' );
73
+ self ::assertTrue ($ this ->fixer ->isCandidate ($ tokens ), 'Fixer must be a candidate for input code. ' );
74
+ self ::assertFalse ($ tokens ->isChanged (), 'Fixer must not touch Tokens on candidate check. ' );
75
75
$ this ->fixer ->fix ($ file , $ tokens );
76
76
}
77
77
78
- static ::assertSame (
78
+ self ::assertSame (
79
79
$ expected ,
80
80
$ tokens ->generateCode (),
81
81
'Code build on input code must match expected code. '
82
82
);
83
- static ::assertTrue ($ tokens ->isChanged (), 'Tokens collection built on input code must be marked as changed after fixing. ' );
83
+ self ::assertTrue ($ tokens ->isChanged (), 'Tokens collection built on input code must be marked as changed after fixing. ' );
84
84
85
85
$ tokens ->clearEmptyTokens ();
86
86
87
- static ::assertSame (
87
+ self ::assertSame (
88
88
\count ($ tokens ),
89
- \count (\array_unique (\array_map (static function (Token $ token ) {
90
- return \spl_object_hash ($ token );
91
- }, $ tokens ->toArray ()))),
89
+ \count (\array_unique (\array_map (static fn (Token $ token ) => \spl_object_hash ($ token ), $ tokens ->toArray ()))),
92
90
'Token items inside Tokens collection must be unique. '
93
91
);
94
92
@@ -97,7 +95,7 @@ final protected function doTest(string $expected, ?string $input = null, ?SplFil
97
95
self ::assertTokens ($ expectedTokens , $ tokens );
98
96
}
99
97
100
- static ::assertNull ($ this ->lintSource ($ expected ));
98
+ self ::assertNull ($ this ->lintSource ($ expected ));
101
99
102
100
Tokens::clearCache ();
103
101
$ tokens = Tokens::fromCode ($ expected );
@@ -106,12 +104,12 @@ final protected function doTest(string $expected, ?string $input = null, ?SplFil
106
104
$ this ->fixer ->fix ($ file , $ tokens );
107
105
}
108
106
109
- static ::assertSame (
107
+ self ::assertSame (
110
108
$ expected ,
111
109
$ tokens ->generateCode (),
112
110
'Code build on expected code must not change. '
113
111
);
114
- static ::assertFalse ($ tokens ->isChanged (), 'Tokens collection built on expected code must not be marked as changed after fixing. ' );
112
+ self ::assertFalse ($ tokens ->isChanged (), 'Tokens collection built on expected code must not be marked as changed after fixing. ' );
115
113
}
116
114
117
115
private function lintSource (string $ source ): ?string
@@ -129,18 +127,18 @@ private static function assertTokens(Tokens $expectedTokens, Tokens $inputTokens
129
127
{
130
128
foreach ($ expectedTokens as $ index => $ expectedToken ) {
131
129
if (! isset ($ inputTokens [$ index ])) {
132
- static ::fail (\sprintf ("The token at index %d must be: \n%s, but is not set in the input collection. " , $ index , $ expectedToken ->toJson ()));
130
+ self ::fail (\sprintf ("The token at index %d must be: \n%s, but is not set in the input collection. " , $ index , $ expectedToken ->toJson ()));
133
131
}
134
132
135
133
$ inputToken = $ inputTokens [$ index ];
136
134
137
- static ::assertTrue (
135
+ self ::assertTrue (
138
136
$ expectedToken ->equals ($ inputToken ),
139
137
\sprintf ("The token at index %d must be: \n%s, \ngot: \n%s. " , $ index , $ expectedToken ->toJson (), $ inputToken ->toJson ())
140
138
);
141
139
142
140
$ expectedTokenKind = $ expectedToken ->isArray () ? $ expectedToken ->getId () : $ expectedToken ->getContent ();
143
- static ::assertTrue (
141
+ self ::assertTrue (
144
142
$ inputTokens ->isTokenKindFound ($ expectedTokenKind ),
145
143
\sprintf (
146
144
'The token kind %s (%s) must be found in tokens collection. ' ,
@@ -150,6 +148,6 @@ private static function assertTokens(Tokens $expectedTokens, Tokens $inputTokens
150
148
);
151
149
}
152
150
153
- static ::assertSame ($ expectedTokens ->count (), $ inputTokens ->count (), 'Both collections must have the same length. ' );
151
+ self ::assertSame ($ expectedTokens ->count (), $ inputTokens ->count (), 'Both collections must have the same length. ' );
154
152
}
155
153
}
0 commit comments