/** * SyntaxErrorException constructor. * @param StringStream $stream * @param int $code * @param Exception|null $previous */ public function __construct(StringStream $stream, int $code = 0, Exception $previous = null) { if ($stream->isEnd()) { $stream->end(); } $this->unexpected_char = $stream->current(); $this->error_line = $this->getParseErrorLineNumber($stream); $message = sprintf($this->messageTemplate, $this->unexpected_char, $this->error_line); parent::__construct($message, $code, $previous); }