Skip to content

Commit 17f5e17

Browse files
committed
Moved test to FindEndOfStatementTest file
1 parent 1be4196 commit 17f5e17

File tree

4 files changed

+23
-24
lines changed

4 files changed

+23
-24
lines changed

tests/Core/File/FindEndOfStatementTest.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,8 @@ $a = [
3535
'a' => fn() => return 1,
3636
'b' => fn() => return 1,
3737
];
38+
39+
/* testArrowFunctionEndOfStatement */
40+
static fn ($a) => $a;
41+
42+
return 0;

tests/Core/File/FindEndOfStatementTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,22 @@ public function testArrowFunctionArrayValue()
188188
}//end testArrowFunctionArrayValue()
189189

190190

191+
/**
192+
* Test end of statement for fn closure.
193+
*
194+
* @return void
195+
*/
196+
public function testArrayFunctionEndOfStatement()
197+
{
198+
$static = (self::$phpcsFile->findNext(T_COMMENT, 0, null, false, '/* testArrowFunctionEndOfStatement */') + 2);
199+
$fn = self::$phpcsFile->findNext(T_FN, ($static + 1));
200+
201+
$endOfStatementStatic = self::$phpcsFile->findEndOfStatement($static);
202+
$endOfStatementFn = self::$phpcsFile->findEndOfStatement($fn);
203+
204+
$this->assertSame($endOfStatementFn, $endOfStatementStatic);
205+
206+
}//end testArrayFunctionEndOfStatement()
207+
208+
191209
}//end class

tests/Core/Tokenizer/BackfillFnTokenTest.inc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,3 @@ fn(callable $a) : callable => $a;
6969

7070
/* testTernary */
7171
$fn = fn($a) => $a ? /* testTernaryThen */ fn() : string => 'a' : /* testTernaryElse */ fn() : string => 'b';
72-
73-
/* testEndOfStatement */
74-
static fn ($a) => $a;
75-
76-
return 0;

tests/Core/Tokenizer/BackfillFnTokenTest.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -594,23 +594,4 @@ private function backfillHelper($token)
594594
}//end backfillHelper()
595595

596596

597-
/**
598-
* Test end of statement for fn closure.
599-
*
600-
* @return void
601-
*/
602-
public function testEndOfStatement()
603-
{
604-
$token = $this->getTargetToken('/* testEndOfStatement */', T_FN);
605-
$this->backfillHelper($token);
606-
607-
$static = self::$phpcsFile->findPrevious(T_STATIC, ($token - 1));
608-
$endOfStatementStatic = self::$phpcsFile->findEndOfStatement($static);
609-
$endOfStatementFn = self::$phpcsFile->findEndOfStatement($token);
610-
611-
$this->assertSame($endOfStatementFn, $endOfStatementStatic);
612-
613-
}//end testEndOfStatement()
614-
615-
616597
}//end class

0 commit comments

Comments
 (0)