Skip to content

Commit 8185b3a

Browse files
committed
Code enhancement.
1 parent 282f727 commit 8185b3a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/ErrorException.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
*/
99
class ErrorException extends \ErrorException implements NamedException
1010
{
11+
//--------------------------------------------------------------------------------------------------------------------
12+
/**
13+
* Map from error codes to error descriptions.
14+
*
15+
* @var array
16+
*/
1117
protected static array $ourNames = [E_COMPILE_ERROR => 'PHP Compile Error',
1218
E_COMPILE_WARNING => 'PHP Compile Warning',
1319
E_CORE_ERROR => 'PHP Core Error',
@@ -25,7 +31,6 @@ class ErrorException extends \ErrorException implements NamedException
2531
E_WARNING => 'PHP Warning'];
2632

2733
//--------------------------------------------------------------------------------------------------------------------
28-
2934
/**
3035
* {@inheritdoc}
3136
*
@@ -34,7 +39,7 @@ class ErrorException extends \ErrorException implements NamedException
3439
*/
3540
public function getName(): string
3641
{
37-
return isset(self::$ourNames[$this->getCode()]) ? self::$ourNames[$this->getCode()] : 'Error';
42+
return self::$ourNames[$this->getCode()] ?? 'Error';
3843
}
3944

4045
//--------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)