diff --git a/Symfony/CS/Tokens.php b/Symfony/CS/Tokens.php index ad77d3b0101..752119b2649 100644 --- a/Symfony/CS/Tokens.php +++ b/Symfony/CS/Tokens.php @@ -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; } } } @@ -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;