PDepend\Source\Language\PHP\PHPTokenizerInternal::next PHP Method

next() public method

Returns the next token or {@link \PDepend\Source\Tokenizer\Tokenizer::T_EOF} if there is no next token.
public next ( ) : PDepend\Source\Tokenizer\Token | integer
return PDepend\Source\Tokenizer\Token | integer
    public function next()
    {
        $this->tokenize();
        if ($this->index < $this->count) {
            return $this->tokens[$this->index++];
        }
        return self::T_EOF;
    }

Usage Example

 /**
  * This method tests that the parser does not substitute keyword tokens in
  * a class or object operator chain.
  *
  * @param string         $sourceFile Name of the text file.
  * @param array(integer) $tokenTypes List of all expected token types.
  *
  * @return void
  * @dataProvider dataProviderTokenizerKeywordSubstitutionInOperatorChain
  */
 public function testTokenizerKeywordSubstitutionInOperatorChain($sourceFile, array $tokenTypes)
 {
     $tokenizer = new PHPTokenizerInternal();
     $tokenizer->setSourceFile($this->createCodeResourceURI($sourceFile));
     $actual = array();
     while (is_object($token = $tokenizer->next())) {
         $actual[] = $token->type;
     }
     $this->assertEquals($tokenTypes, $actual);
 }
All Usage Examples Of PDepend\Source\Language\PHP\PHPTokenizerInternal::next