public function peekNextValidToken($startPos = null, $stopOnNewLine = false) {
		// define the start position
		$pos = $this->getCurrentPosition() + 1; // default position for the search
		if ($startPos !== null) {
			$pos = $startPos; // if defined, set the start position
		}

		// search for the next valid token
		$token = null;
		$nbTokens = count($this->tokens);

		while ($pos < $nbTokens) {
			$token = $this->tokens[$pos];
			$pos ++;

			if (isset($this->ignoreTokens[$token->id])) {
				continue;
			} else if ($token->id === T_NEW_LINE) {
				if ($stopOnNewLine) {
					break;
				} else {
					continue;
				}
			} else {
				break;
			}
		}

		return $token;
	}
public function peekNextValidToken($startPos = null, $stopOnNewLine = false) {
		// define the start position
		$pos = $this->getCurrentPosition() + 1; // default position for the search
		if ($startPos !== null) {
			$pos = $startPos; // if defined, set the start position
		}

		// search for the next valid token
		$token = null;
		$nbTokens = count($this->tokens);

		while ($pos < $nbTokens) {
			$token = $this->tokens[$pos];
			$pos ++;

			if (isset($this->ignoreTokens[$token->id])) {
				continue;
			} else if ($token->id === T_NEW_LINE) {
				if ($stopOnNewLine) {
					break;
				} else {
					continue;
				}
			} else {
				break;
			}
		}

		return $token;
	}
public function peekNextValidToken ( $ startPos = null , $ stopOnNewLine = false ) { // define the start position $ pos = $ this -> getCurrentPosition ( ) + 1 ; // default position for the search if ( $ startPos !== null ) { $ pos = $ startPos ; // if defined, set the start position } // search for the next valid token $ token = null ; $ nbTokens = count ( $ this -> tokens ) ; while ( $ pos < $ nbTokens ) { $ token = $ this -> tokens [ $ pos ] ; $ pos ++ ; if ( isset ( $ this -> ignoreTokens [ $ token -> id ] ) ) { continue ; } else if ( $ token -> id === T_NEW_LINE ) { if ( $ stopOnNewLine ) { break ; } else { continue ; } } else { break ; } } return $ token ; }
Peeks at the next valid token.
A valid token is one that is neither a whitespace or a comment

@param Integer $startPos
the start position for the search (if the item on this position is valid, it will be returned)
@param Boolean $stopOnNewLine
Indicate if we need to stop when we meet a new line
@return TokenInfo the info about the token found
Peeks at the next valid token . A valid token is one that is neither a whitespace or a comment