You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my laravel 11 application I've encountered a mismatch between return type in docblock and the actual value returned. I'm using database as the queue_connection.
In the following example
<?phpnamespaceApp\Jobs;
useIlluminate\Contracts\Queue\ShouldQueue;
useIlluminate\Foundation\Queue\Queueable;
class FooJob implements ShouldQueue
{
use Queueable;
/** * Create a new job instance. */publicfunction__construct()
{
}
/** * Execute the job. */publicfunctionhandle(): void
{
$baz = $this->job->getJobId();
var_dump($baz);
}
}
When job is dispatched $baz is assigned an integer from getJobId() even though the documentation specifies that it returns a string?
I get why DatabaseJob is specifying a return type string since it is implementing Illuminate\Contracts\Queue\Job which specifies that jobId should return a string.
And I get that the jobId returned is equilvalent to the id in jobs table in database. Since when dispatching the job with sync as queue_connection the value is an empty string.
But then I'm left wondering if the docblock here is potentially wrong or the return type is wrong?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
In my laravel 11 application I've encountered a mismatch between return type in docblock and the actual value returned. I'm using database as the queue_connection.
In the following example
When job is dispatched $baz is assigned an integer from
getJobId()
even though the documentation specifies that it returns a string?I get why
DatabaseJob
is specifying a return type string since it is implementingIlluminate\Contracts\Queue\Job
which specifies that jobId should return a string.And I get that the jobId returned is equilvalent to the id in jobs table in database. Since when dispatching the job with sync as queue_connection the value is an empty string.
But then I'm left wondering if the docblock here is potentially wrong or the return type is wrong?
Anything I have missed/misunderstood?
Beta Was this translation helpful? Give feedback.
All reactions