Parser.php
protected function expectEnd(array $relatedToken = null)
    {

        foreach ($this->lookUpNext(['newLine']) as $token) {

            $this->handleToken($token);

            return;
        }

        if (!$this->expectNext(['newLine'])) {

            $this->throwException(
                "Nothing should be following this statement, the end of line is expected.",
                $relatedToken
            );
        } else
            $this->handleToken();
    }
protected function expectEnd(array $relatedToken = null)
    {

        foreach ($this->lookUpNext(['newLine']) as $token) {

            $this->handleToken($token);

            return;
        }

        if (!$this->expectNext(['newLine'])) {

            $this->throwException(
                "Nothing should be following this statement, the end of line is expected.",
                $relatedToken
            );
        } else
            $this->handleToken();
    }
protected function expectEnd ( array $ relatedToken = null ) { foreach ( $ this -> lookUpNext ( [ 'newLine' ] ) as $ token ) { $ this -> handleToken ( $ token ) ; return ; } if ( ! $ this -> expectNext ( [ 'newLine' ] ) ) { $ this -> throwException ( "Nothing should be following this statement, the end of line is expected." , $ relatedToken ) ; } else $ this -> handleToken ( ) ; }
Throws an exception if the next token is not a newLine token.

This states that "a line of instructions should end here"

Notice that if the next token is _not_ a newLine, it gets
handled through handleToken automatically

@param array|null $relatedToken the token to relate the exception to

@throws Exception when the next token is not a newLine token
Throws an exception if the next token is not a newLine token .