0 follower

Class Yiisoft\ErrorHandler\Exception\ErrorException

InheritanceYiisoft\ErrorHandler\Exception\ErrorException » ErrorException
ImplementsYiisoft\FriendlyException\FriendlyExceptionInterface

ErrorException represents a PHP error.

Psalm Types

Name Value
DebugBacktraceType list<array{args?: array, class?: class-string, file?: string, function?: string, line?: integer, object?: object, type?: string}>

Constants

Hide inherited 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

Hide inherited methods

__construct() public method

public mixed __construct ( string $message '', integer $code 0, integer $severity 1, string $filename __FILE__, integer $line __LINE__, Exception|null $previous null, array $backtrace = [] )
$message string
$code integer
$severity integer
$filename string
$line integer
$previous Exception|null
$backtrace array

                public function __construct(string $message = '', int $code = 0, int $severity = 1, string $filename = __FILE__, int $line = __LINE__, ?Exception $previous = null, private readonly array $backtrace = [])
{
    parent::__construct($message, $code, $severity, $filename, $line, $previous);
    $this->addXDebugTraceToFatalIfAvailable();
}

            
getBacktrace() public method

public array getBacktrace ( )

                public function getBacktrace(): array
{
    return $this->backtrace;
}

            
getName() public method

public string getName ( )
return string

The user-friendly name of this exception.

                public function getName(): string
{
    return self::ERROR_NAMES[$this->getCode()] ?? 'Error';
}

            
getSolution() public method

public string|null getSolution ( )

                public function getSolution(): ?string
{
    return null;
}

            
isFatalError() public static method

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,
    );
}