1 | <?php |
||
11 | class ErrorHandler implements ErrorHandlerInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var EmitterInterface |
||
15 | */ |
||
16 | protected $emitter; |
||
17 | |||
18 | /** |
||
19 | * @var callable[] |
||
20 | */ |
||
21 | protected $processors; |
||
22 | |||
23 | /** |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $options = [ |
||
27 | 'blockingErrors' => true, |
||
28 | ]; |
||
29 | |||
30 | /** |
||
31 | * @var bool |
||
32 | */ |
||
33 | protected $treatErrorsAsExceptions = false; |
||
34 | |||
35 | /** |
||
36 | * @var bool |
||
37 | */ |
||
38 | private $registered = false; |
||
39 | |||
40 | 11 | public function __construct(EmitterInterface $emitter, array $processors = [], array $options = []) |
|
48 | |||
49 | 6 | final public function register() : void |
|
61 | |||
62 | 6 | final public function unregister() : void |
|
73 | |||
74 | 2 | final public function isRegistered() : bool |
|
78 | |||
79 | 6 | public function handleError(int $level, string $message, string $file = null, int $line = null) : bool |
|
99 | |||
100 | 4 | public function handleException(Throwable $exception) : void |
|
106 | |||
107 | public function onShutdown() : void |
||
122 | |||
123 | 4 | protected function process(Throwable $exception) : Throwable |
|
131 | |||
132 | 4 | protected function emit(Throwable $exception) : void |
|
136 | |||
137 | 1 | final protected function isFatalError(int $errorLevel) : bool |
|
143 | |||
144 | final protected function terminate() : void |
||
148 | } |
||
149 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.