@@ -40,7 +40,7 @@ class Dispatcher implements DispatcherContract
4040 /**
4141 * The registered event listeners.
4242 *
43- * @var array<string, array<callable |array|class-string|null >>
43+ * @var array<string, array<null |array|callable| class-string>>
4444 */
4545 protected array $ listeners = [];
4646
@@ -61,16 +61,16 @@ class Dispatcher implements DispatcherContract
6161 /**
6262 * The queue resolver instance.
6363 *
64- * @var (callable(): mixed)|null
64+ * @var null| (callable(): mixed)
6565 */
66- protected $ queueResolver = null ;
66+ protected $ queueResolver ;
6767
6868 /**
6969 * The database transaction manager resolver instance.
7070 *
71- * @var (callable(): mixed)|null
71+ * @var null| (callable(): mixed)
7272 */
73- protected $ transactionManagerResolver = null ;
73+ protected $ transactionManagerResolver ;
7474
7575 /**
7676 * The currently deferred events.
@@ -85,7 +85,7 @@ class Dispatcher implements DispatcherContract
8585 /**
8686 * The specific events to defer (null means defer all events).
8787 *
88- * @var string[]|null
88+ * @var null| string[]
8989 */
9090 protected ?array $ eventsToDefer = null ;
9191
@@ -148,9 +148,9 @@ protected function setupWildcardListen(string $event, Closure|string|array $list
148148 */
149149 public function hasListeners (string $ eventName ): bool
150150 {
151- return isset ($ this ->listeners [$ eventName ]) ||
152- isset ($ this ->wildcards [$ eventName ]) ||
153- $ this ->hasWildcardListeners ($ eventName );
151+ return isset ($ this ->listeners [$ eventName ])
152+ || isset ($ this ->wildcards [$ eventName ])
153+ || $ this ->hasWildcardListeners ($ eventName );
154154 }
155155
156156 /**
@@ -251,9 +251,9 @@ public function dispatch(string|object $event, mixed $payload = [], bool $halt =
251251 // If the event is not intended to be dispatched unless the current database
252252 // transaction is successful, we'll register a callback which will handle
253253 // dispatching this event on the next successful DB transaction commit.
254- if ($ isEventObject &&
255- $ parsedPayload [0 ] instanceof ShouldDispatchAfterCommit &&
256- ! is_null ($ transactions = $ this ->resolveTransactionManager ())) {
254+ if ($ isEventObject
255+ && $ parsedPayload [0 ] instanceof ShouldDispatchAfterCommit
256+ && ! is_null ($ transactions = $ this ->resolveTransactionManager ())) {
257257 $ transactions ->addCallback (
258258 fn () => $ this ->invokeListeners ($ parsedEvent , $ parsedPayload , $ halt )
259259 );
@@ -317,9 +317,9 @@ protected function parseEventAndPayload(mixed $event, mixed $payload): array
317317 */
318318 protected function shouldBroadcast (array $ payload ): bool
319319 {
320- return isset ($ payload [0 ]) &&
321- $ payload [0 ] instanceof ShouldBroadcast &&
322- $ this ->broadcastWhen ($ payload [0 ]);
320+ return isset ($ payload [0 ])
321+ && $ payload [0 ] instanceof ShouldBroadcast
322+ && $ this ->broadcastWhen ($ payload [0 ]);
323323 }
324324
325325 /**
@@ -516,9 +516,9 @@ protected function createQueuedHandlerCallable(string $class, string $method): C
516516 */
517517 protected function handlerShouldBeDispatchedAfterDatabaseTransactions (mixed $ listener ): bool
518518 {
519- return (($ listener ->afterCommit ?? null ) ||
520- $ listener instanceof ShouldHandleEventsAfterCommit) &&
521- $ this ->resolveTransactionManager ();
519+ return (($ listener ->afterCommit ?? null )
520+ || $ listener instanceof ShouldHandleEventsAfterCommit)
521+ && $ this ->resolveTransactionManager ();
522522 }
523523
524524 /**
@@ -531,7 +531,7 @@ protected function createCallbackForListenerRunningAfterCommits(mixed $listener,
531531
532532 $ this ->resolveTransactionManager ()->addCallback (
533533 function () use ($ listener , $ method , $ payload ) {
534- $ listener ->$ method (...$ payload );
534+ $ listener ->{ $ method} (...$ payload );
535535 }
536536 );
537537 };
@@ -600,7 +600,8 @@ protected function createListenerAndJob(string $class, string $method, array $ar
600600 $ listener = (new ReflectionClass ($ class ))->newInstanceWithoutConstructor ();
601601
602602 return [$ listener , $ this ->propagateListenerOptions (
603- $ listener , new CallQueuedListener ($ class , $ method , $ arguments )
603+ $ listener ,
604+ new CallQueuedListener ($ class , $ method , $ arguments )
604605 )];
605606 }
606607
@@ -627,7 +628,8 @@ protected function propagateListenerOptions(mixed $listener, CallQueuedListener
627628 $ job ->deleteWhenMissingModels = $ listener ->deleteWhenMissingModels ?? false ;
628629 $ job ->tries = method_exists ($ listener , 'tries ' ) ? $ listener ->tries (...$ data ) : ($ listener ->tries ?? null );
629630 $ job ->messageGroup = method_exists ($ listener , 'messageGroup ' ) ? $ listener ->messageGroup (...$ data ) : ($ listener ->messageGroup ?? null );
630- $ job ->withDeduplicator (method_exists ($ listener , 'deduplicator ' )
631+ $ job ->withDeduplicator (
632+ method_exists ($ listener , 'deduplicator ' )
631633 ? $ listener ->deduplicator (...$ data )
632634 : (method_exists ($ listener , 'deduplicationId ' ) ? $ listener ->deduplicationId (...) : null )
633635 );
@@ -713,7 +715,7 @@ public function setTransactionManagerResolver(callable $resolver): static
713715 * @template TResult
714716 *
715717 * @param callable(): TResult $callback
716- * @param string[]|null $events
718+ * @param null| string[] $events
717719 * @return TResult
718720 */
719721 public function defer (callable $ callback , ?array $ events = null ): mixed
@@ -731,7 +733,7 @@ public function defer(callable $callback, ?array $events = null): mixed
731733
732734 $ this ->deferringEvents = false ;
733735
734- /** @phpstan-ignore foreach.emptyArray (callback may add deferred events) */
736+ /* @phpstan-ignore foreach.emptyArray (callback may add deferred events) */
735737 foreach ($ this ->deferredEvents as $ args ) {
736738 $ this ->dispatch (...$ args );
737739 }
0 commit comments