Skip to content

Commit

Permalink
minor PHP-CS-Fixer#539 Tokens - little DRY, use Token::equalsAny (ker…
Browse files Browse the repository at this point in the history
…adus)

This PR was merged into the 1.0.x-dev branch.

Discussion
----------

Tokens - little DRY, use Token::equalsAny

Commits
-------

71216d7 Tokens - little DRY, use Token::equalsAny
  • Loading branch information
keradus committed Sep 10, 2014
2 parents 625dd27 + 71216d7 commit 7fe33a5
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions Symfony/CS/Tokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -665,12 +665,10 @@ public function getTokenOfKindSibling($index, $direction, array $tokens = array(

$token = $this[$index];

foreach ($tokens as $tokenKind) {
if ($token->equals($tokenKind)) {
$foundIndex = $index;
if ($token->equalsAny($tokens)) {
$foundIndex = $index;

return $token;
}
return $token;
}
}
}
Expand All @@ -696,10 +694,8 @@ public function getTokenNotOfKindSibling($index, $direction, array $tokens = arr

$token = $this[$index];

foreach ($tokens as $tokenKind) {
if ($token->equals($tokenKind)) {
continue 2;
}
if ($token->equalsAny($tokens)) {
continue;
}

$foundIndex = $index;
Expand Down

0 comments on commit 7fe33a5

Please sign in to comment.