| Conditions | 2 |
| Paths | 2 |
| Total Lines | 9 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function on(string $eventName, callable $callable, int $priority = 100) |
||
| 30 | { |
||
| 31 | if (!isset($this->listeners[$eventName])) { |
||
| 32 | $this->listeners[$eventName] = []; |
||
| 33 | } |
||
| 34 | |||
| 35 | $this->listeners[$eventName][] = [$priority, $callable]; |
||
| 36 | \uasort($this->listeners[$eventName], function ($event1, $event2) { |
||
| 37 | return $event1[0] <=> $event2[0]; |
||
| 38 | }); |
||
| 57 |
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.