@@ -64,31 +64,29 @@ final protected function doTest(string $expected, ?string $input = null, ?SplFil
6464 $ fileIsSupported = $ this ->fixer ->supports ($ file );
6565
6666 if (null !== $ input ) {
67- static ::assertNull ($ this ->lintSource ($ input ));
67+ self ::assertNull ($ this ->lintSource ($ input ));
6868
6969 Tokens::clearCache ();
7070 $ tokens = Tokens::fromCode ($ input );
7171
7272 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. ' );
7575 $ this ->fixer ->fix ($ file , $ tokens );
7676 }
7777
78- static ::assertSame (
78+ self ::assertSame (
7979 $ expected ,
8080 $ tokens ->generateCode (),
8181 'Code build on input code must match expected code. '
8282 );
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. ' );
8484
8585 $ tokens ->clearEmptyTokens ();
8686
87- static ::assertSame (
87+ self ::assertSame (
8888 \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 ()))),
9290 'Token items inside Tokens collection must be unique. '
9391 );
9492
@@ -97,7 +95,7 @@ final protected function doTest(string $expected, ?string $input = null, ?SplFil
9795 self ::assertTokens ($ expectedTokens , $ tokens );
9896 }
9997
100- static ::assertNull ($ this ->lintSource ($ expected ));
98+ self ::assertNull ($ this ->lintSource ($ expected ));
10199
102100 Tokens::clearCache ();
103101 $ tokens = Tokens::fromCode ($ expected );
@@ -106,12 +104,12 @@ final protected function doTest(string $expected, ?string $input = null, ?SplFil
106104 $ this ->fixer ->fix ($ file , $ tokens );
107105 }
108106
109- static ::assertSame (
107+ self ::assertSame (
110108 $ expected ,
111109 $ tokens ->generateCode (),
112110 'Code build on expected code must not change. '
113111 );
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. ' );
115113 }
116114
117115 private function lintSource (string $ source ): ?string
@@ -129,18 +127,18 @@ private static function assertTokens(Tokens $expectedTokens, Tokens $inputTokens
129127 {
130128 foreach ($ expectedTokens as $ index => $ expectedToken ) {
131129 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 ()));
133131 }
134132
135133 $ inputToken = $ inputTokens [$ index ];
136134
137- static ::assertTrue (
135+ self ::assertTrue (
138136 $ expectedToken ->equals ($ inputToken ),
139137 \sprintf ("The token at index %d must be: \n%s, \ngot: \n%s. " , $ index , $ expectedToken ->toJson (), $ inputToken ->toJson ())
140138 );
141139
142140 $ expectedTokenKind = $ expectedToken ->isArray () ? $ expectedToken ->getId () : $ expectedToken ->getContent ();
143- static ::assertTrue (
141+ self ::assertTrue (
144142 $ inputTokens ->isTokenKindFound ($ expectedTokenKind ),
145143 \sprintf (
146144 'The token kind %s (%s) must be found in tokens collection. ' ,
@@ -150,6 +148,6 @@ private static function assertTokens(Tokens $expectedTokens, Tokens $inputTokens
150148 );
151149 }
152150
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. ' );
154152 }
155153}
0 commit comments