Error
extends RuntimeException
in package
Table of Contents
Properties
- $attributes : array<string, mixed>
- $rawMessage : string
Methods
- __construct() : mixed
- Creates an Exception signifying a parse error.
- getAttributes() : array<string, mixed>
- Gets the attributes of the node/token the error occurred at.
- getEndColumn() : int
- Gets the end column (1-based) into the line where the error ended.
- getEndLine() : int
- Gets the line the error ends in.
- getMessageWithColumnInfo() : string
- Formats message including line and column information.
- getRawMessage() : string
- Gets the error message
- getStartColumn() : int
- Gets the start column (1-based) into the line where the error started.
- getStartLine() : int
- Gets the line the error starts in.
- hasColumnInfo() : bool
- Returns whether the error has start and end column information.
- setAttributes() : void
- Sets the attributes of the node/token the error occurred at.
- setRawMessage() : void
- Sets the line of the PHP file the error occurred in.
- setStartLine() : void
- Sets the line the error starts in.
- updateMessage() : void
- Updates the exception message after a change to rawMessage or rawLine.
- toColumn() : int
- Converts a file offset into a column.
Properties
$attributes
protected
array<string, mixed>
$attributes
$rawMessage
protected
string
$rawMessage
Methods
__construct()
Creates an Exception signifying a parse error.
public
__construct(string $message[, array<string, mixed> $attributes = [] ]) : mixed
Parameters
- $message : string
-
Error message
- $attributes : array<string, mixed> = []
-
Attributes of node/token where error occurred
getAttributes()
Gets the attributes of the node/token the error occurred at.
public
getAttributes() : array<string, mixed>
Return values
array<string, mixed>getEndColumn()
Gets the end column (1-based) into the line where the error ended.
public
getEndColumn(string $code) : int
Parameters
- $code : string
-
Source code of the file
Return values
intgetEndLine()
Gets the line the error ends in.
public
getEndLine() : int
Return values
int —Error end line
getMessageWithColumnInfo()
Formats message including line and column information.
public
getMessageWithColumnInfo(string $code) : string
Parameters
- $code : string
-
Source code associated with the error, for calculation of the columns
Return values
string —Formatted message
getRawMessage()
Gets the error message
public
getRawMessage() : string
Return values
string —Error message
getStartColumn()
Gets the start column (1-based) into the line where the error started.
public
getStartColumn(string $code) : int
Parameters
- $code : string
-
Source code of the file
Return values
intgetStartLine()
Gets the line the error starts in.
public
getStartLine() : int
Return values
int —Error start line
hasColumnInfo()
Returns whether the error has start and end column information.
public
hasColumnInfo() : bool
For column information enable the startFilePos and endFilePos in the lexer options.
Return values
boolsetAttributes()
Sets the attributes of the node/token the error occurred at.
public
setAttributes(array<string, mixed> $attributes) : void
Parameters
- $attributes : array<string, mixed>
setRawMessage()
Sets the line of the PHP file the error occurred in.
public
setRawMessage(string $message) : void
Parameters
- $message : string
-
Error message
setStartLine()
Sets the line the error starts in.
public
setStartLine(int $line) : void
Parameters
- $line : int
-
Error start line
updateMessage()
Updates the exception message after a change to rawMessage or rawLine.
protected
updateMessage() : void
toColumn()
Converts a file offset into a column.
private
toColumn(string $code, int $pos) : int
Parameters
- $code : string
-
Source code that $pos indexes into
- $pos : int
-
0-based position in $code
Return values
int —1-based column (relative to start of line)