Copied!
Instantiable
Methods
public __construct(string $message, array $attributes = [])
 

Creates an Exception signifying a parse error.

  • param string $message Error message
  • param array<string,mixed> $attributes Attributes of node/token where error occurred
public Exception::__toString() : string
public Exception::__wakeup()
public getAttributes() : array
 

Gets the attributes of the node/token the error occurred at.

  • return array<string,mixed>
public final Exception::getCode()
public getEndColumn(string $code) : int
 

Gets the end column (1-based) into the line where the error ended.

  • param string $code Source code of the file
public getEndLine() : int
 

Gets the line the error ends in.

  • return int Error end line
  • phpstan-return -1|positive-int
public final Exception::getFile() : string
public final Exception::getLine() : int
public final Exception::getMessage() : string
public getMessageWithColumnInfo(string $code) : string
 

Formats message including line and column information.

  • param string $code Source code associated with the error, for calculation of the columns
  • return string Formatted message
public final Exception::getPrevious() : ?Throwable
public getRawMessage() : string
 

Gets the error message

  • return string Error message
public getStartColumn(string $code) : int
 

Gets the start column (1-based) into the line where the error started.

  • param string $code Source code of the file
public getStartLine() : int
 

Gets the line the error starts in.

  • return int Error start line
  • phpstan-return -1|positive-int
public final Exception::getTrace() : array
public final Exception::getTraceAsString() : string
public hasColumnInfo() : bool
 

Returns whether the error has start and end column information.

For column information enable the startFilePos and endFilePos in the lexer options.

public setAttributes(array $attributes) : void
 

Sets the attributes of the node/token the error occurred at.

  • param array<string,mixed> $attributes
public setRawMessage(string $message) : void
 

Sets the line of the PHP file the error occurred in.

  • param string $message Error message
public setStartLine(int $line) : void
 

Sets the line the error starts in.

  • param int $line Error start line
Properties
protected array $attributes
 
  • var array<string,mixed>
protected Exception::$code = 0
protected string Exception::$file = ''
protected int Exception::$line = 0
protected Exception::$message = ''
protected string $rawMessage
Methods
protected updateMessage() : void
 

Updates the exception message after a change to rawMessage or rawLine.

Methods
private toColumn(string $code, int $pos) : int
 

Converts a file offset into a column.

  • param string $code Source code that $pos indexes into
  • param int $pos 0-based position in $code
  • return int 1-based column (relative to start of line)
© 2025 Bruce Wells
Search Namespaces \ Classes
Configuration