src/Mutator/MutatorAbstract.php
protected static function getNextToken(array &$tokens, $index, array $excludeTokens = [])
    {
        $tokenCount = count($tokens);
        while ($index < $tokenCount && isset($tokens[$index+1])
        && self::shouldSkip($tokens[$index + 1], $excludeTokens)) {
            $index++;
        }

        if (! isset($tokens[$index+1])) {
            return false;
        }

        return is_array($tokens[$index+1]) ? $tokens[$index+1][0] : $tokens[$index+1];
    }
protected static function getNextToken(array &$tokens, $index, array $excludeTokens = [])
    {
        $tokenCount = count($tokens);
        while ($index < $tokenCount && isset($tokens[$index+1])
        && self::shouldSkip($tokens[$index + 1], $excludeTokens)) {
            $index++;
        }

        if (! isset($tokens[$index+1])) {
            return false;
        }

        return is_array($tokens[$index+1]) ? $tokens[$index+1][0] : $tokens[$index+1];
    }
Finds the next token in token array after a given index.
@param array $tokens Token array to lookup
@param int $index Position to start lookup at
@param array $excludeTokens Excluded tokens list

@return int|string|false The next match if found, or false. Token is guaranteed to be a scalar if a match is found.