1 | <?php declare(strict_types = 1); |
||
14 | class ErrorHandler implements ErrorHandlerContract |
||
15 | { |
||
16 | |||
17 | /** |
||
18 | * PHP is shutdown flag. |
||
19 | * |
||
20 | * @var bool |
||
21 | */ |
||
22 | protected $shutdown = false; |
||
23 | |||
24 | /** |
||
25 | * ThrowableHandlers to pass caught $throwable for handling. |
||
26 | * |
||
27 | * @var HandlerStack |
||
28 | */ |
||
29 | protected $stack; |
||
30 | |||
31 | /** |
||
32 | * Runner constructor registers runner as soon as possible. |
||
33 | * |
||
34 | * @param HandlerStack $stack |
||
35 | */ |
||
36 | public function __construct(HandlerStack $stack) |
||
41 | |||
42 | /** |
||
43 | * @inheritdoc |
||
44 | * @throws ErrorException |
||
45 | */ |
||
46 | public function handleError(int $severity, string $message, string $filename, int $lineNumber): bool |
||
65 | |||
66 | /** |
||
67 | * {@inheritDoc} |
||
68 | */ |
||
69 | public function handleShutdown() |
||
78 | |||
79 | /** |
||
80 | * {@inheritDoc} |
||
81 | */ |
||
82 | public function handleThrowable(Throwable $throwable) |
||
88 | |||
89 | /** |
||
90 | * Registers runner as error/exception handler and shutdown function. |
||
91 | * |
||
92 | * @return void |
||
93 | */ |
||
94 | protected function register() |
||
100 | |||
101 | } |
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.