Skip to content

Better return types for Illuminate\Queue\Jobs\Job::getJobId() and Illuminate\Queue\Jobs\DatabaseJob::getJobId() methods #55138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

petrknap
Copy link
Contributor

Based on the silence at #55080 I guess the correct smallest data type from implementation. Based on observation and method Illuminate\Database\Query\Builder::find I changed Illuminate\Queue\Jobs\DatabaseJob::getJobId to string|int and based on all implementations of Illuminate\Queue\Jobs\Job::getJobId in this repository I changed its return type to string|int|null (as DB job returns stdClass::$id, both should be mixed).

Benefit to end users - this version will not lead to fatal errors (if other annotations are correct).

Children MUST respect it's parent. You can't expand parents return type in it's children, you only can make the children return more specific, for more information visit https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming).

…and `Illuminate\Queue\Jobs\DatabaseJob::getJobId()` methods

#55080
@taylorotwell taylorotwell merged commit 9bf2d35 into laravel:12.x Mar 22, 2025
41 checks passed
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.

None yet

2 participants