Skip to content

Commit

Permalink
[10.x] Fix Accepting nullable Parameters, updated doc block, and null…
Browse files Browse the repository at this point in the history
… pointer exception handling in batchable trait (#50209)

* fix(Reachable Trait): fix parameters type and doc block in With withFakeBatch method

* fix(Reachable Trait): fix null pointer exception

* fix(Batchable Trait): fix parameters type and doc block in With withFakeBatch method

* fix(Batchable Trait): fix null pointer exception

* Update Batchable.php

---------

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
saMahmoudzadeh and taylorotwell authored Feb 23, 2024
1 parent 1996308 commit 33993b8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Batchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function batch()
}

if ($this->batchId) {
return Container::getInstance()->make(BatchRepository::class)->find($this->batchId);
return Container::getInstance()->make(BatchRepository::class)?->find($this->batchId);
}
}

Expand Down Expand Up @@ -74,7 +74,7 @@ public function withBatchId(string $batchId)
* @param int $failedJobs
* @param array $failedJobIds
* @param array $options
* @param \Carbon\CarbonImmutable $createdAt
* @param \Carbon\CarbonImmutable|null $createdAt
* @param \Carbon\CarbonImmutable|null $cancelledAt
* @param \Carbon\CarbonImmutable|null $finishedAt
* @return array{0: $this, 1: \Illuminate\Support\Testing\Fakes\BatchFake}
Expand All @@ -86,7 +86,7 @@ public function withFakeBatch(string $id = '',
int $failedJobs = 0,
array $failedJobIds = [],
array $options = [],
CarbonImmutable $createdAt = null,
?CarbonImmutable $createdAt = null,
?CarbonImmutable $cancelledAt = null,
?CarbonImmutable $finishedAt = null)
{
Expand Down

0 comments on commit 33993b8

Please sign in to comment.