Skip to content

Conversation

@AhmedAlaa4611
Copy link
Contributor

@AhmedAlaa4611 AhmedAlaa4611 commented Oct 23, 2025

Description

The docblock referenced a $job parameter with types \Closure|string|object, but the constructor actually defines a $command parameter of type mixed.

This PR updates the docblock to reflect the constructor's parameters and types.

Note

@shaedrich
Copy link
Contributor

I'm not entirely sure about the accuracy of the new description for $command.

And that's why just blindly changing something to mixed is not exactly a good idea

@AhmedAlaa4611
Copy link
Contributor Author

And that's why just blindly changing something to mixed is not exactly a good idea

I think the entire line was copied from src/Illuminate/Queue/Events/JobQueued.php or src/Illuminate/Queue/Events/JobQueueing.php. So, I'll defer to Taylor for review.

See

https://github.com/search?q=repo%3Alaravel%2Fframework%20%22%40param%20%20%5CClosure%7Cstring%7Cobject%20%20%24job%20%20The%20job%20instance.%22&type=code

@shaedrich
Copy link
Contributor

That may be so, but there sure is something passed in. With some effort, this can be done better than degrading it to mixed, which is most unhelpful

@shaedrich
Copy link
Contributor

shaedrich commented Oct 23, 2025

The only two places where it is used—as a job as well, mind you—, string|object is passed in:

/**
* Push a new job onto the queue after (n) seconds.
*
* @param \DateTimeInterface|\DateInterval|int $delay
* @param string $job
* @param mixed $data
* @param string|null $queue
* @return mixed
*/
public function later($delay, $job, $data = '', $queue = null)
{
$lastException = null;
foreach ($this->connections as $connection) {
try {
return $this->manager->connection($connection)->later($delay, $job, $data, $queue);
} catch (Throwable $e) {
$lastException = $e;
$this->events->dispatch(new QueueFailedOver($connection, $job));
}
}
throw $lastException ?? new RuntimeException('All failover queue connections failed.');
}

/**
* Push a new job onto the queue.
*
* @param object|string $job
* @param mixed $data
* @param string|null $queue
* @return mixed
*/
public function push($job, $data = '', $queue = null)
{
$lastException = null;
foreach ($this->connections as $connection) {
try {
return $this->manager->connection($connection)->push($job, $data, $queue);
} catch (Throwable $e) {
$lastException = $e;
$this->events->dispatch(new QueueFailedOver($connection, $job));
}
}
throw $lastException ?? new RuntimeException('All failover queue connections failed.');
}

Thank me later.

@AhmedAlaa4611
Copy link
Contributor Author

Why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants