|
9 | 9 |
|
10 | 10 | namespace PHP_CodeSniffer\Tests\Core\Tokenizer; |
11 | 11 |
|
12 | | -use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest; |
13 | | - |
14 | | -final class BackfillFnTokenTest extends AbstractMethodUnitTest |
| 12 | +final class BackfillFnTokenTest extends AbstractTokenizerTestCase |
15 | 13 | { |
16 | 14 |
|
17 | 15 |
|
@@ -106,7 +104,7 @@ public function testNestedOuter() |
106 | 104 | */ |
107 | 105 | public function testNestedInner() |
108 | 106 | { |
109 | | - $tokens = self::$phpcsFile->getTokens(); |
| 107 | + $tokens = $this->phpcsFile->getTokens(); |
110 | 108 |
|
111 | 109 | $token = $this->getTargetToken('/* testNestedInner */', T_FN); |
112 | 110 | $this->backfillHelper($token, true); |
@@ -137,7 +135,7 @@ public function testNestedInner() |
137 | 135 | */ |
138 | 136 | public function testNestedSharedCloser() |
139 | 137 | { |
140 | | - $tokens = self::$phpcsFile->getTokens(); |
| 138 | + $tokens = $this->phpcsFile->getTokens(); |
141 | 139 |
|
142 | 140 | $token = $this->getTargetToken('/* testNestedSharedCloserOuter */', T_FN); |
143 | 141 | $this->backfillHelper($token); |
@@ -380,7 +378,7 @@ public function testNamespaceOperatorInTypes() |
380 | 378 | */ |
381 | 379 | public function testKeywordReturnTypes() |
382 | 380 | { |
383 | | - $tokens = self::$phpcsFile->getTokens(); |
| 381 | + $tokens = $this->phpcsFile->getTokens(); |
384 | 382 |
|
385 | 383 | $testMarkers = [ |
386 | 384 | 'Self', |
@@ -453,7 +451,7 @@ public function testUnionReturnType() |
453 | 451 | */ |
454 | 452 | public function testTernary() |
455 | 453 | { |
456 | | - $tokens = self::$phpcsFile->getTokens(); |
| 454 | + $tokens = $this->phpcsFile->getTokens(); |
457 | 455 |
|
458 | 456 | $token = $this->getTargetToken('/* testTernary */', T_FN); |
459 | 457 | $this->backfillHelper($token); |
@@ -505,7 +503,7 @@ public function testTernary() |
505 | 503 | */ |
506 | 504 | public function testTernaryWithTypes() |
507 | 505 | { |
508 | | - $tokens = self::$phpcsFile->getTokens(); |
| 506 | + $tokens = $this->phpcsFile->getTokens(); |
509 | 507 |
|
510 | 508 | $token = $this->getTargetToken('/* testTernaryWithTypes */', T_FN); |
511 | 509 | $this->backfillHelper($token); |
@@ -563,7 +561,7 @@ public function testWithMatchValueAndMore() |
563 | 561 | */ |
564 | 562 | public function testInMatchValue($testMarker, $openerOffset, $closerOffset, $expectedCloserType, $expectedCloserFriendlyName) |
565 | 563 | { |
566 | | - $tokens = self::$phpcsFile->getTokens(); |
| 564 | + $tokens = $this->phpcsFile->getTokens(); |
567 | 565 |
|
568 | 566 | $token = $this->getTargetToken($testMarker, T_FN); |
569 | 567 | $this->backfillHelper($token); |
@@ -647,7 +645,7 @@ public function testNestedInMethod() |
647 | 645 | */ |
648 | 646 | public function testNotAnArrowFunction($testMarker, $testContent='fn') |
649 | 647 | { |
650 | | - $tokens = self::$phpcsFile->getTokens(); |
| 648 | + $tokens = $this->phpcsFile->getTokens(); |
651 | 649 |
|
652 | 650 | $token = $this->getTargetToken($testMarker, [T_STRING, T_FN], $testContent); |
653 | 651 | $tokenArray = $tokens[$token]; |
@@ -745,7 +743,7 @@ public static function dataNotAnArrowFunction() |
745 | 743 | */ |
746 | 744 | private function backfillHelper($token, $skipScopeCloserCheck=false) |
747 | 745 | { |
748 | | - $tokens = self::$phpcsFile->getTokens(); |
| 746 | + $tokens = $this->phpcsFile->getTokens(); |
749 | 747 |
|
750 | 748 | $this->assertTrue(array_key_exists('scope_condition', $tokens[$token]), 'Scope condition is not set'); |
751 | 749 | $this->assertTrue(array_key_exists('scope_opener', $tokens[$token]), 'Scope opener is not set'); |
@@ -797,7 +795,7 @@ private function backfillHelper($token, $skipScopeCloserCheck=false) |
797 | 795 | */ |
798 | 796 | private function scopePositionTestHelper($token, $openerOffset, $closerOffset, $expectedCloserType='semicolon') |
799 | 797 | { |
800 | | - $tokens = self::$phpcsFile->getTokens(); |
| 798 | + $tokens = $this->phpcsFile->getTokens(); |
801 | 799 | $expectedScopeOpener = ($token + $openerOffset); |
802 | 800 | $expectedScopeCloser = ($token + $closerOffset); |
803 | 801 |
|
|
0 commit comments