public function expect(string $char): void
    {
        $this->latestExpectations = [$char];

        $taken = $this->take();

        if ($taken !== $char) {
            $this->lastTaken = null;

            throw new UnexpectedChar($this, [$char]);
        }
    }
public function expect(string $char): void
    {
        $this->latestExpectations = [$char];

        $taken = $this->take();

        if ($taken !== $char) {
            $this->lastTaken = null;

            throw new UnexpectedChar($this, [$char]);
        }
    }
public function expect ( string $ char ) : void { $ this -> latestExpectations = [ $ char ] ; $ taken = $ this -> take ( ) ; if ( $ taken !== $ char ) { $ this -> lastTaken = null ; throw new UnexpectedChar ( $ this , [ $ char ] ) ; } }
Removes the next character from the input. Fails if it's not the
expected one.

@param string $char
@throws UnexpectedChar
Removes the next character from the input . Fails if it s not the expected one .