public function findNextToken($matcher)
    {
        $nextToken = $this->nextToken;
        while (null !== $nextToken) {
            if ($nextToken->matches($matcher)) {
                return new Some($nextToken);
            }

            $nextToken = $nextToken->nextToken;
        }

        return None::create();
    }
public function findNextToken($matcher)
    {
        $nextToken = $this->nextToken;
        while (null !== $nextToken) {
            if ($nextToken->matches($matcher)) {
                return new Some($nextToken);
            }

            $nextToken = $nextToken->nextToken;
        }

        return None::create();
    }
public function findNextToken ( $ matcher ) { $ nextToken = $ this -> nextToken ; while ( null !== $ nextToken ) { if ( $ nextToken -> matches ( $ matcher ) ) { return new Some ( $ nextToken ) ; } $ nextToken = $ nextToken -> nextToken ; } return None :: create ( ) ; }
Finds the next token that satisfies the passed matcher.

Eligible matchers are:

- T_??? constants such as T_WHITESPACE
- Literal values such as ";"
- A Closure which receives an AbstractToken as first argument
- Some special built-in matchers: "END_OF_LINE", "END_OF_NAME" (see matches())

@param string|integer|\Closure $matcher

@return Option<AbstractToken>
Finds the next token that satisfies the passed matcher .