2424
2525class NewActivity extends Subscriber
2626{
27- public function subscribe (Dispatcher $ events )
27+ public function subscribe (Dispatcher $ events ): void
2828 {
2929 $ this ->listen (Flagged::class, [$ this , 'flagged ' ]);
3030 $ this ->listen (FlagDismissed::class, [$ this , 'flagged ' ]);
3131
3232 $ this ->listen (PostWasLiked::class, [$ this , 'likes ' ]);
3333 $ this ->listen (PostWasUnliked::class, [$ this , 'likes ' ]);
3434
35- $ this ->listen (PostWasVoted::class, [$ this , 'voted ' ]);
35+ if (class_exists (PostWasVoted::class)) {
36+ /** @phpstan-ignore-next-line */
37+ $ this ->listen (PostWasVoted::class, [$ this , 'voted ' ]);
38+ }
3639
37- $ this ->listen (PostWasReacted::class, [$ this , 'reactions ' ]);
38- $ this ->listen (PostWasUnreacted::class, [$ this , 'reactions ' ]);
40+ if (class_exists (PostWasReacted::class) && class_exists (PostWasUnreacted::class)) {
41+ /** @phpstan-ignore-next-line */
42+ $ this ->listen (PostWasReacted::class, [$ this , 'reactions ' ]);
43+ /** @phpstan-ignore-next-line */
44+ $ this ->listen (PostWasUnreacted::class, [$ this , 'reactions ' ]);
45+ }
3946
4047 $ this ->listen (Revised::class, [$ this , 'revised ' ]);
4148 }
4249
4350 /**
4451 * @param Flagged|FlagDismissed $event
4552 */
46- public function flagged ($ event )
53+ public function flagged (object $ event ): void
4754 {
4855 $ discussion = $ event ->flag ->post ->discussion ;
4956
@@ -60,7 +67,7 @@ public function flagged($event)
6067 /**
6168 * @param PostWasUnliked|PostWasLiked $event
6269 */
63- public function likes ($ event )
70+ public function likes (object $ event ): void
6471 {
6572 $ this ->queue ()->push (new SendTriggerJob (
6673 'likesMutation ' ,
@@ -72,28 +79,38 @@ public function likes($event)
7279 /**
7380 * @param PostWasVoted $event
7481 * @return void
82+ * @phpstan-ignore-next-line
7583 */
76- public function voted (PostWasVoted $ event )
84+ public function voted (object $ event ): void
7785 {
86+ /** @phpstan-ignore-next-line */
87+ $ post = $ event ->vote ->post ;
88+
7889 $ this ->queue ()->push (new SendTriggerJob (
7990 'votedMutation ' ,
80- $ event -> vote -> post
91+ $ post
8192 ));
8293 }
8394
8495 /**
8596 * @param PostWasReacted|PostWasUnreacted $event
97+ * @phpstan-ignore-next-line
8698 */
87- public function reactions ($ event )
99+ public function reactions (object $ event ): void
88100 {
101+ /** @phpstan-ignore-next-line */
102+ $ post = $ event ->post ;
103+ /** @phpstan-ignore-next-line */
104+ $ user = $ event ->user ;
105+
89106 $ this ->queue ()->push (new SendTriggerJob (
90107 'reactionsMutation ' ,
91- $ event -> post ,
92- $ event -> user
108+ $ post ,
109+ $ user
93110 ));
94111 }
95112
96- public function revised (Revised $ event )
113+ public function revised (Revised $ event ): void
97114 {
98115 $ this ->queue ()->push (new SendTriggerJob (
99116 'revisedEvent ' ,
0 commit comments