Class Yiisoft\ErrorHandler\Exception\ErrorException
| Inheritance | Yiisoft\ErrorHandler\Exception\ErrorException » ErrorException |
|---|---|
| Implements | Yiisoft\FriendlyException\FriendlyExceptionInterface |
ErrorException represents a PHP error.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ErrorHandler\Exception\ErrorException | |
| getBacktrace() | Yiisoft\ErrorHandler\Exception\ErrorException | |
| getName() | Yiisoft\ErrorHandler\Exception\ErrorException | |
| getSolution() | Yiisoft\ErrorHandler\Exception\ErrorException | |
| isFatalError() | Returns if error is one of fatal type. | Yiisoft\ErrorHandler\Exception\ErrorException |
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| ERROR_NAMES | [ \E_ERROR => 'PHP Fatal Error', \E_WARNING => 'PHP Warning', \E_PARSE => 'PHP Parse Error', \E_NOTICE => 'PHP Notice', \E_CORE_ERROR => 'PHP Core Error', \E_CORE_WARNING => 'PHP Core Warning', \E_COMPILE_ERROR => 'PHP Compile Error', \E_COMPILE_WARNING => 'PHP Compile Warning', \E_USER_ERROR => 'PHP User Error', \E_USER_WARNING => 'PHP User Warning', \E_USER_NOTICE => 'PHP User Notice', 2048 => 'PHP Strict Warning', \E_RECOVERABLE_ERROR => 'PHP Recoverable Error', \E_DEPRECATED => 'PHP Deprecated Warning', \E_USER_DEPRECATED => 'PHP User Deprecated Warning', ] | Yiisoft\ErrorHandler\Exception\ErrorException |
Method Details
| public mixed __construct ( string $message, integer $code, integer $severity, string $filename, integer $line, ?\Exception $previous, array $backtrace ) | ||
| $message | string | |
| $code | integer | |
| $severity | integer | |
| $filename | string | |
| $line | integer | |
| $previous | ?\Exception | |
| $backtrace | array | |
public function __construct(
string $message,
int $code,
int $severity,
string $filename,
int $line,
?Exception $previous,
private readonly array $backtrace,
) {
parent::__construct($message, $code, $severity, $filename, $line, $previous);
$this->addXDebugTraceToFatalIfAvailable();
}
| public string getName ( ) | ||
| return | string |
The user-friendly name of this exception. |
|---|---|---|
public function getName(): string
{
return self::ERROR_NAMES[$this->getCode()] ?? 'Error';
}
Returns if error is one of fatal type.
| public static boolean isFatalError ( array $error ) | ||
| $error | array |
Error got from error_get_last() |
| return | boolean |
If error is one of fatal type. |
|---|---|---|
public static function isFatalError(array $error): bool
{
return isset($error['type']) && in_array(
$error['type'],
[E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING],
true,
);
}
Signup or Login in order to comment.