File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 22
33namespace Prokl \BitrixOrdinaryToolsBundle \Services \SymfonyEvents ;
44
5+ use Iterator ;
56use Prokl \BitrixOrdinaryToolsBundle \Services \SymfonyEvents \Interfaces \BitrixComponentEventHandlerInterface ;
67use stdClass ;
78use Symfony \Component \EventDispatcher \EventDispatcherInterface ;
1314class CustomEvents
1415{
1516 /**
16- * @var array $listenersCollection Коллекция слушателей событий.
17+ * @var BitrixComponentEventHandlerInterface[] $listenersCollection Слушатели событий.
1718 */
18- private $ listenersCollection ;
19+ private $ listenersCollection = [] ;
1920
2021 /**
21- * @var EventDispatcherInterface $dispatcher
22+ * @var EventDispatcherInterface $dispatcher Event dispatcher.
2223 */
2324 private $ dispatcher ;
2425
2526 /**
2627 * Events constructor.
2728 *
28- * @param EventDispatcherInterface $dispatcher
29- * @param ... $eventsHandlerBag
29+ * @param EventDispatcherInterface $dispatcher Event dispatcher.
30+ * @param mixed ... $eventsHandlerBag Сервисы, отмеченные тэгом bitrix.component.event.
3031 */
3132 public function __construct (
3233 EventDispatcherInterface $ dispatcher ,
@@ -41,7 +42,12 @@ public function __construct(
4142 $ handlers [] = $ array ;
4243 }
4344
44- $ this ->listenersCollection = $ handlers ;
45+
46+ $ handlers = array_filter ($ handlers );
47+
48+ if (count ($ handlers ) > 0 ) {
49+ $ this ->listenersCollection = $ handlers ;
50+ }
4551
4652 $ this ->dispatcher = $ dispatcher ;
4753 }
You can’t perform that action at this time.
0 commit comments