Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions tests/Core/Tokenizers/PHP/AnonClassParenthesisOwnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public function testAnonClassNoParentheses($testMarker)
$tokens = $this->phpcsFile->getTokens();

$anonClass = $this->getTargetToken($testMarker, T_ANON_CLASS);
$this->assertFalse(array_key_exists('parenthesis_owner', $tokens[$anonClass]));
$this->assertFalse(array_key_exists('parenthesis_opener', $tokens[$anonClass]));
$this->assertFalse(array_key_exists('parenthesis_closer', $tokens[$anonClass]));
$this->assertArrayNotHasKey('parenthesis_owner', $tokens[$anonClass]);
$this->assertArrayNotHasKey('parenthesis_opener', $tokens[$anonClass]);
$this->assertArrayNotHasKey('parenthesis_closer', $tokens[$anonClass]);

}//end testAnonClassNoParentheses()

Expand All @@ -54,11 +54,11 @@ public function testAnonClassNoParenthesesNextOpenClose($testMarker)
$function = $this->getTargetToken($testMarker, T_FUNCTION);

$opener = $this->getTargetToken($testMarker, T_OPEN_PARENTHESIS);
$this->assertTrue(array_key_exists('parenthesis_owner', $tokens[$opener]));
$this->assertArrayHasKey('parenthesis_owner', $tokens[$opener]);
$this->assertSame($function, $tokens[$opener]['parenthesis_owner']);

$closer = $this->getTargetToken($testMarker, T_CLOSE_PARENTHESIS);
$this->assertTrue(array_key_exists('parenthesis_owner', $tokens[$closer]));
$this->assertArrayHasKey('parenthesis_owner', $tokens[$closer]);
$this->assertSame($function, $tokens[$closer]['parenthesis_owner']);

}//end testAnonClassNoParenthesesNextOpenClose()
Expand Down Expand Up @@ -107,23 +107,23 @@ public function testAnonClassWithParentheses($testMarker)
$opener = $this->getTargetToken($testMarker, T_OPEN_PARENTHESIS);
$closer = $this->getTargetToken($testMarker, T_CLOSE_PARENTHESIS);

$this->assertTrue(array_key_exists('parenthesis_owner', $tokens[$anonClass]));
$this->assertTrue(array_key_exists('parenthesis_opener', $tokens[$anonClass]));
$this->assertTrue(array_key_exists('parenthesis_closer', $tokens[$anonClass]));
$this->assertArrayHasKey('parenthesis_owner', $tokens[$anonClass]);
$this->assertArrayHasKey('parenthesis_opener', $tokens[$anonClass]);
$this->assertArrayHasKey('parenthesis_closer', $tokens[$anonClass]);
$this->assertSame($anonClass, $tokens[$anonClass]['parenthesis_owner']);
$this->assertSame($opener, $tokens[$anonClass]['parenthesis_opener']);
$this->assertSame($closer, $tokens[$anonClass]['parenthesis_closer']);

$this->assertTrue(array_key_exists('parenthesis_owner', $tokens[$opener]));
$this->assertTrue(array_key_exists('parenthesis_opener', $tokens[$opener]));
$this->assertTrue(array_key_exists('parenthesis_closer', $tokens[$opener]));
$this->assertArrayHasKey('parenthesis_owner', $tokens[$opener]);
$this->assertArrayHasKey('parenthesis_opener', $tokens[$opener]);
$this->assertArrayHasKey('parenthesis_closer', $tokens[$opener]);
$this->assertSame($anonClass, $tokens[$opener]['parenthesis_owner']);
$this->assertSame($opener, $tokens[$opener]['parenthesis_opener']);
$this->assertSame($closer, $tokens[$opener]['parenthesis_closer']);

$this->assertTrue(array_key_exists('parenthesis_owner', $tokens[$closer]));
$this->assertTrue(array_key_exists('parenthesis_opener', $tokens[$closer]));
$this->assertTrue(array_key_exists('parenthesis_closer', $tokens[$closer]));
$this->assertArrayHasKey('parenthesis_owner', $tokens[$closer]);
$this->assertArrayHasKey('parenthesis_opener', $tokens[$closer]);
$this->assertArrayHasKey('parenthesis_closer', $tokens[$closer]);
$this->assertSame($anonClass, $tokens[$closer]['parenthesis_owner']);
$this->assertSame($opener, $tokens[$closer]['parenthesis_opener']);
$this->assertSame($closer, $tokens[$closer]['parenthesis_closer']);
Expand Down
28 changes: 14 additions & 14 deletions tests/Core/Tokenizers/PHP/BackfillFnTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -896,37 +896,37 @@ private function backfillHelper($token, $skipScopeCloserCheck=false)
{
$tokens = $this->phpcsFile->getTokens();

$this->assertTrue(array_key_exists('scope_condition', $tokens[$token]), 'Scope condition is not set');
$this->assertTrue(array_key_exists('scope_opener', $tokens[$token]), 'Scope opener is not set');
$this->assertTrue(array_key_exists('scope_closer', $tokens[$token]), 'Scope closer is not set');
$this->assertArrayHasKey('scope_condition', $tokens[$token], 'Scope condition is not set');
$this->assertArrayHasKey('scope_opener', $tokens[$token], 'Scope opener is not set');
$this->assertArrayHasKey('scope_closer', $tokens[$token], 'Scope closer is not set');
$this->assertSame($tokens[$token]['scope_condition'], $token, 'Scope condition is not the T_FN token');
$this->assertTrue(array_key_exists('parenthesis_owner', $tokens[$token]), 'Parenthesis owner is not set');
$this->assertTrue(array_key_exists('parenthesis_opener', $tokens[$token]), 'Parenthesis opener is not set');
$this->assertTrue(array_key_exists('parenthesis_closer', $tokens[$token]), 'Parenthesis closer is not set');
$this->assertArrayHasKey('parenthesis_owner', $tokens[$token], 'Parenthesis owner is not set');
$this->assertArrayHasKey('parenthesis_opener', $tokens[$token], 'Parenthesis opener is not set');
$this->assertArrayHasKey('parenthesis_closer', $tokens[$token], 'Parenthesis closer is not set');
$this->assertSame($tokens[$token]['parenthesis_owner'], $token, 'Parenthesis owner is not the T_FN token');

$opener = $tokens[$token]['scope_opener'];
$this->assertTrue(array_key_exists('scope_condition', $tokens[$opener]), 'Opener scope condition is not set');
$this->assertTrue(array_key_exists('scope_opener', $tokens[$opener]), 'Opener scope opener is not set');
$this->assertTrue(array_key_exists('scope_closer', $tokens[$opener]), 'Opener scope closer is not set');
$this->assertArrayHasKey('scope_condition', $tokens[$opener], 'Opener scope condition is not set');
$this->assertArrayHasKey('scope_opener', $tokens[$opener], 'Opener scope opener is not set');
$this->assertArrayHasKey('scope_closer', $tokens[$opener], 'Opener scope closer is not set');
$this->assertSame($tokens[$opener]['scope_condition'], $token, 'Opener scope condition is not the T_FN token');
$this->assertSame(T_FN_ARROW, $tokens[$opener]['code'], 'Arrow scope opener not tokenized as T_FN_ARROW (code)');
$this->assertSame('T_FN_ARROW', $tokens[$opener]['type'], 'Arrow scope opener not tokenized as T_FN_ARROW (type)');

$closer = $tokens[$token]['scope_closer'];
$this->assertTrue(array_key_exists('scope_condition', $tokens[$closer]), 'Closer scope condition is not set');
$this->assertTrue(array_key_exists('scope_opener', $tokens[$closer]), 'Closer scope opener is not set');
$this->assertTrue(array_key_exists('scope_closer', $tokens[$closer]), 'Closer scope closer is not set');
$this->assertArrayHasKey('scope_condition', $tokens[$closer], 'Closer scope condition is not set');
$this->assertArrayHasKey('scope_opener', $tokens[$closer], 'Closer scope opener is not set');
$this->assertArrayHasKey('scope_closer', $tokens[$closer], 'Closer scope closer is not set');
if ($skipScopeCloserCheck === false) {
$this->assertSame($tokens[$closer]['scope_condition'], $token, 'Closer scope condition is not the T_FN token');
}

$opener = $tokens[$token]['parenthesis_opener'];
$this->assertTrue(array_key_exists('parenthesis_owner', $tokens[$opener]), 'Opening parenthesis owner is not set');
$this->assertArrayHasKey('parenthesis_owner', $tokens[$opener], 'Opening parenthesis owner is not set');
$this->assertSame($tokens[$opener]['parenthesis_owner'], $token, 'Opening parenthesis owner is not the T_FN token');

$closer = $tokens[$token]['parenthesis_closer'];
$this->assertTrue(array_key_exists('parenthesis_owner', $tokens[$closer]), 'Closing parenthesis owner is not set');
$this->assertArrayHasKey('parenthesis_owner', $tokens[$closer], 'Closing parenthesis owner is not set');
$this->assertSame($tokens[$closer]['parenthesis_owner'], $token, 'Closing parenthesis owner is not the T_FN token');

}//end backfillHelper()
Expand Down