44 parent::__construct($this->message, 0, $previous);
120 if (
'.' === substr($this->message, -1)) {
121 $this->message = substr($this->message, 0, -1);
125 if (
null !== $this->parsedFile) {
126 $this->message .= sprintf(
' in %s', json_encode($this->parsedFile, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
129 if ($this->parsedLine >= 0) {
130 $this->message .= sprintf(
' at line %d', $this->parsedLine);
133 if ($this->snippet) {
134 $this->message .= sprintf(
' (near "%s")', $this->snippet);
138 $this->message .=
'.';
An exception for terminatinating execution or to throw for unit testing.
Exception class thrown when an error occurs during parsing.
getParsedLine()
Gets the line where the error occurred.
getSnippet()
Gets the snippet of code near the error.
getParsedFile()
Gets the filename where the error occurred.
__construct($message, $parsedLine=-1, $snippet=null, $parsedFile=null, \Exception $previous=null)
Constructor.
setParsedLine($parsedLine)
Sets the line where the error occurred.
setSnippet($snippet)
Sets the snippet of code near the error.
setParsedFile($parsedFile)
Sets the filename where the error occurred.
Exception class thrown when an error occurs during parsing.
catch(Exception $e) $message