Skip to content

Commit

Permalink
Fixed tests for #2860
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Feb 9, 2020
1 parent 5bb5f83 commit ea810a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tests/Core/Tokenizer/BackfillFnTokenTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fn(array $a) : array => $a;
$fn = fn($a) => $a ? /* testTernaryThen */ fn() : string => 'a' : /* testTernaryElse */ fn() : string => 'b';

/* testConstantDeclaration */
const FN = 'a';
const fn = 'a';

class Foo {
/* testStaticMethodName */
Expand Down Expand Up @@ -102,10 +102,10 @@ $a = Foo::fn($param);
$a = Foo::fn($param)->another();

/* testNonArrowStaticConstant */
$a = MyClass::FN;
$a = MyClass::fn;

/* testNonArrowStaticConstantDeref */
$a = MyClass::FN[$a];
$a = MyClass::fn[$a];

/* testNonArrowObjectMethodCall */
$a = $obj->fn($param);
Expand Down
5 changes: 4 additions & 1 deletion tests/Core/Tokenizer/BackfillFnTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ public function testNotAnArrowFunction($testMarker)
{
$tokens = self::$phpcsFile->getTokens();

$token = $this->getTargetToken('/* testFunctionName */', [T_STRING, T_FN], 'fn');
$token = $this->getTargetToken($testMarker, [T_STRING, T_FN], 'fn');
$tokenArray = $tokens[$token];

$this->assertSame('T_STRING', $tokenArray['type'], 'Token tokenized as '.$tokenArray['type'].', not T_STRING');
Expand All @@ -598,11 +598,14 @@ public function testNotAnArrowFunction($testMarker)
public function dataNotAnArrowFunction()
{
return [
['/* testConstantDeclaration */'],
['/* testFunctionName */'],
['/* testStaticMethodName */'],
['/* testAnonClassMethodName */'],
['/* testNonArrowStaticMethodCall */'],
['/* testNonArrowStaticMethodCallWithChaining */'],
['/* testNonArrowStaticConstant */'],
['/* testNonArrowStaticConstantDeref */'],
['/* testNonArrowObjectMethodCall */'],
['/* testNonArrowNamespacedFunctionCall */'],
['/* testNonArrowNamespaceOperatorFunctionCall */'],
Expand Down

0 comments on commit ea810a2

Please sign in to comment.