Error
extends RuntimeException
in package
Table of Contents
- $attributes : mixed
- $rawMessage : mixed
- __construct() : mixed
- Creates an Exception signifying a parse error.
- getAttributes() : array<string|int, 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() : mixed
- Sets the attributes of the node/token the error occurred at.
- setRawMessage() : mixed
- Sets the line of the PHP file the error occurred in.
- setStartLine() : mixed
- Sets the line the error starts in.
- updateMessage() : mixed
- Updates the exception message after a change to rawMessage or rawLine.
- toColumn() : int
- Converts a file offset into a column.
Properties
$attributes
protected
mixed
$attributes
$rawMessage
protected
mixed
$rawMessage
Methods
__construct()
Creates an Exception signifying a parse error.
public
__construct(string $message[, array<string|int, mixed>|int $attributes = [] ]) : mixed
Parameters
- $message : string
-
Error message
- $attributes : array<string|int, mixed>|int = []
-
Attributes of node/token where error occurred (or start line of error -- deprecated)
Return values
mixed —getAttributes()
Gets the attributes of the node/token the error occurred at.
public
getAttributes() : array<string|int, mixed>
Return values
array<string|int, 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
int —getEndLine()
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
int —getStartLine()
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
bool —setAttributes()
Sets the attributes of the node/token the error occurred at.
public
setAttributes(array<string|int, mixed> $attributes) : mixed
Parameters
- $attributes : array<string|int, mixed>
Return values
mixed —setRawMessage()
Sets the line of the PHP file the error occurred in.
public
setRawMessage(string $message) : mixed
Parameters
- $message : string
-
Error message
Return values
mixed —setStartLine()
Sets the line the error starts in.
public
setStartLine(int $line) : mixed
Parameters
- $line : int
-
Error start line
Return values
mixed —updateMessage()
Updates the exception message after a change to rawMessage or rawLine.
protected
updateMessage() : mixed
Return values
mixed —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)