-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathErrorException.php
More file actions
48 lines (43 loc) · 2.08 KB
/
ErrorException.php
File metadata and controls
48 lines (43 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
declare(strict_types=1);
namespace SetBased\Exception;
/**
* Class for PHP errors.
*/
class ErrorException extends \ErrorException implements NamedException
{
//--------------------------------------------------------------------------------------------------------------------
/**
* Map from error codes to error descriptions.
*
* @var array
*/
protected static array $ourNames = [E_COMPILE_ERROR => 'PHP Compile Error',
E_COMPILE_WARNING => 'PHP Compile Warning',
E_CORE_ERROR => 'PHP Core Error',
E_CORE_WARNING => 'PHP Core Warning',
E_DEPRECATED => 'PHP Deprecated Warning',
E_ERROR => 'PHP Fatal Error',
E_NOTICE => 'PHP Notice',
E_PARSE => 'PHP Parse Error',
E_RECOVERABLE_ERROR => 'PHP Recoverable Error',
E_STRICT => 'PHP Strict Warning',
E_USER_DEPRECATED => 'PHP User Deprecated Warning',
E_USER_ERROR => 'PHP User Error',
E_USER_NOTICE => 'PHP User Notice',
E_USER_WARNING => 'PHP User Warning',
E_WARNING => 'PHP Warning'];
//--------------------------------------------------------------------------------------------------------------------
/**
* {@inheritdoc}
*
* @since 1.0.0
* @api
*/
public function getName(): string
{
return self::$ourNames[$this->getCode()] ?? 'Error';
}
//--------------------------------------------------------------------------------------------------------------------
}
//----------------------------------------------------------------------------------------------------------------------