Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/support/src/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
48 changes: 27 additions & 21 deletions types/Support/Support.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
Loading