diff --git a/src/support/src/Functions.php b/src/support/src/Functions.php index 1648cf257..340108f3c 100644 --- a/src/support/src/Functions.php +++ b/src/support/src/Functions.php @@ -27,7 +27,7 @@ * Do not assign a value to the return value of this function unless you are very clear about the consequences of doing so. * @param Closure|JobInterface|ProduceMessage|ProducerMessageInterface|mixed $job * @param-closure-this ($job is Closure ? CallQueuedClosure : mixed) $job - * @return ($job is Closure ? PendingAsyncQueueDispatch : ($job is JobInterface ? PendingAsyncQueueDispatch : ($job is ProducerMessageInterface ? PendingAmqpProducerMessageDispatch : PendingKafkaProducerMessageDispatch))) + * @return ($job is Closure ? PendingAsyncQueueDispatch : ( $job is JobInterface ? PendingAsyncQueueDispatch : ( $job is ProducerMessageInterface ? PendingAmqpProducerMessageDispatch : ( $job is ProduceMessage ? PendingKafkaProducerMessageDispatch : never )))) * @throws InvalidArgumentException */ function dispatch($job) diff --git a/types/Support/Support.php b/types/Support/Support.php index fa9c1b160..ba09176aa 100644 --- a/types/Support/Support.php +++ b/types/Support/Support.php @@ -63,24 +63,30 @@ $command = new RedisCommand('SET', ['key', 'value']); assertType('string', (string) $command); -assertType('FriendsOfHyperf\Support\Bus\PendingAsyncQueueDispatch', dispatch(new class implements Hyperf\AsyncQueue\JobInterface { - public function handle(): void - { - } - - public function fail(Throwable $e): void - { - } - - public function getMaxAttempts(): int - { - return 0; - } - - public function setMaxAttempts(int $maxAttempts): static - { - return $this; - } -})); - -assertType('FriendsOfHyperf\Support\Bus\PendingAsyncQueueDispatch', dispatch(fn () => null)); +assertType( + 'FriendsOfHyperf\Support\Bus\PendingAsyncQueueDispatch', + dispatch(new class implements Hyperf\AsyncQueue\JobInterface { + public function handle(): void + { + } + + public function fail(Throwable $e): void + { + } + + public function getMaxAttempts(): int + { + return 0; + } + + public function setMaxAttempts(int $maxAttempts): static + { + return $this; + } + }) +); + +assertType( + 'FriendsOfHyperf\Support\Bus\PendingAsyncQueueDispatch', + dispatch(fn () => null) +);