PhpError
in package
Object wrapper around PHP errors that are emitted by `trigger_error()`
Table of Contents
Properties
- $code : int
- $file : string|null
- $levelMap : array<int, string>
- $line : int|null
- $logMap : array<string, int>
- $message : string
- $trace : array<string|int, array<string, int>>
- Stack trace data. Each item should have a `reference`, `file` and `line` keys.
Methods
- __construct() : mixed
- Constructor
- getCode() : int
- Get the PHP error constant.
- getFile() : string|null
- Get the error file
- getLabel() : string
- Get the error code label
- getLine() : int|null
- Get the error line number.
- getLogLevel() : int
- Get the mapped LOG_ constant.
- getMessage() : string
- Get the error message.
- getTrace() : array<string|int, mixed>
- Get the stacktrace as an array.
- getTraceAsString() : string
- Get the stacktrace as a string.
Properties
$code
private
int
$code
$file
private
string|null
$file
$levelMap
private
array<int, string>
$levelMap
= [E_PARSE => 'error', E_ERROR => 'error', E_CORE_ERROR => 'error', E_COMPILE_ERROR => 'error', E_USER_ERROR => 'error', E_WARNING => 'warning', E_USER_WARNING => 'warning', E_COMPILE_WARNING => 'warning', E_RECOVERABLE_ERROR => 'warning', E_NOTICE => 'notice', E_USER_NOTICE => 'notice', E_STRICT => 'strict', E_DEPRECATED => 'deprecated', E_USER_DEPRECATED => 'deprecated']
$line
private
int|null
$line
$logMap
private
array<string, int>
$logMap
= ['error' => LOG_ERR, 'warning' => LOG_WARNING, 'notice' => LOG_NOTICE, 'strict' => LOG_NOTICE, 'deprecated' => LOG_NOTICE]
$message
private
string
$message
$trace
Stack trace data. Each item should have a `reference`, `file` and `line` keys.
private
array<string|int, array<string, int>>
$trace
Methods
__construct()
Constructor
public
__construct(int $code, string $message[, string|null $file = null ][, int|null $line = null ][, array<string|int, mixed> $trace = [] ]) : mixed
Parameters
- $code : int
-
The PHP error code constant
- $message : string
-
The error message.
- $file : string|null = null
-
The filename of the error.
- $line : int|null = null
-
The line number for the error.
- $trace : array<string|int, mixed> = []
-
The backtrace for the error.
getCode()
Get the PHP error constant.
public
getCode() : int
Return values
intgetFile()
Get the error file
public
getFile() : string|null
Return values
string|nullgetLabel()
Get the error code label
public
getLabel() : string
Return values
stringgetLine()
Get the error line number.
public
getLine() : int|null
Return values
int|nullgetLogLevel()
Get the mapped LOG_ constant.
public
getLogLevel() : int
Return values
intgetMessage()
Get the error message.
public
getMessage() : string
Return values
stringgetTrace()
Get the stacktrace as an array.
public
getTrace() : array<string|int, mixed>
Return values
array<string|int, mixed>getTraceAsString()
Get the stacktrace as a string.
public
getTraceAsString() : string