@@ -155,21 +155,15 @@ private function getDispatchedEvents(CodeParser $codeParser): Collection
155155 $ events = [];
156156
157157 $ foundFunctionCalls = $ codeParser ->getFunctionCalls ('event ' );
158- if (count ($ foundFunctionCalls ) > 0 ) {
159- $ events = array_merge ($ events , $ foundFunctionCalls );
160- }
158+ $ events = array_merge ($ events , $ foundFunctionCalls );
161159
162160 foreach ($ classes as $ class ) {
163161 foreach ($ methods as $ method ) {
164162 $ foundStaticCalls = $ codeParser ->getStaticCalls ($ class , $ method );
165- if (count ($ foundStaticCalls ) !== 0 ) {
166- $ events = array_merge ($ events , $ foundStaticCalls );
167- }
163+ $ events = array_merge ($ events , $ foundStaticCalls );
168164
169165 $ foundMethodCalls = $ codeParser ->getMethodCalls ($ class , $ method );
170- if (count ($ foundMethodCalls ) !== 0 ) {
171- $ events = array_merge ($ events , $ foundMethodCalls );
172- }
166+ $ events = array_merge ($ events , $ foundMethodCalls );
173167 }
174168 }
175169
@@ -194,22 +188,19 @@ private function getDispatchedJobs(CodeParser $codeParser): Collection
194188
195189 $ jobs = [];
196190
197- $ foundFunctionCalls = $ codeParser ->getFunctionCalls ('dispatch ' );
198- if (count ($ foundFunctionCalls ) > 0 ) {
199- $ jobs = array_merge ($ jobs , $ foundFunctionCalls );
200- }
191+ $ foundFunctionCalls = array_merge (
192+ $ codeParser ->getFunctionCalls ('dispatch ' ),
193+ $ codeParser ->getFunctionCalls ('dispatch_sync ' ),
194+ );
195+ $ jobs = array_merge ($ jobs , $ foundFunctionCalls );
201196
202197 foreach ($ classes as $ class ) {
203198 foreach ($ methods as $ method ) {
204199 $ foundStaticCalls = $ codeParser ->getStaticCalls ($ class , $ method );
205- if (count ($ foundStaticCalls ) !== 0 ) {
206- $ jobs = array_merge ($ jobs , $ foundStaticCalls );
207- }
200+ $ jobs = array_merge ($ jobs , $ foundStaticCalls );
208201
209202 $ foundMethodCalls = $ codeParser ->getMethodCalls ($ class , $ method );
210- if (count ($ foundMethodCalls ) !== 0 ) {
211- $ jobs = array_merge ($ jobs , $ foundMethodCalls );
212- }
203+ $ jobs = array_merge ($ jobs , $ foundMethodCalls );
213204 }
214205 }
215206
0 commit comments