1 | <?php |
||
21 | class DomainEventPublisher implements EventSubscriber |
||
22 | { |
||
23 | /** |
||
24 | * @var EventPuller |
||
25 | */ |
||
26 | private $puller; |
||
27 | |||
28 | /** |
||
29 | * @var EventBus |
||
30 | */ |
||
31 | private $bus; |
||
32 | |||
33 | /** |
||
34 | * @var bool |
||
35 | */ |
||
36 | private $enable; |
||
37 | |||
38 | /** |
||
39 | * @var Event[] |
||
40 | */ |
||
41 | private $events = []; |
||
42 | |||
43 | /** |
||
44 | * @param EventPuller $puller |
||
45 | * @param EventBus $bus |
||
46 | * @param bool $enable |
||
47 | */ |
||
48 | 8 | public function __construct(EventPuller $puller, EventBus $bus, $enable) |
|
54 | |||
55 | /** |
||
56 | * @return array |
||
57 | */ |
||
58 | 2 | public function getSubscribedEvents() |
|
69 | |||
70 | /** |
||
71 | * @param OnFlushEventArgs $args |
||
72 | */ |
||
73 | 6 | public function onFlush(OnFlushEventArgs $args) |
|
78 | |||
79 | /** |
||
80 | * @param PostFlushEventArgs $args |
||
81 | */ |
||
82 | 5 | public function postFlush(PostFlushEventArgs $args) |
|
101 | } |
||
102 |
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.