Skip to content

Commit 4ebce1e

Browse files
[10.x] Fix Accepting nullable Parameters, updated doc block, and null 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]>
1 parent e0be50a commit 4ebce1e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Illuminate/Bus/Batchable.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function batch()
3535
}
3636

3737
if ($this->batchId) {
38-
return Container::getInstance()->make(BatchRepository::class)->find($this->batchId);
38+
return Container::getInstance()->make(BatchRepository::class)?->find($this->batchId);
3939
}
4040
}
4141

@@ -74,7 +74,7 @@ public function withBatchId(string $batchId)
7474
* @param int $failedJobs
7575
* @param array $failedJobIds
7676
* @param array $options
77-
* @param \Carbon\CarbonImmutable $createdAt
77+
* @param \Carbon\CarbonImmutable|null $createdAt
7878
* @param \Carbon\CarbonImmutable|null $cancelledAt
7979
* @param \Carbon\CarbonImmutable|null $finishedAt
8080
* @return array{0: $this, 1: \Illuminate\Support\Testing\Fakes\BatchFake}
@@ -86,7 +86,7 @@ public function withFakeBatch(string $id = '',
8686
int $failedJobs = 0,
8787
array $failedJobIds = [],
8888
array $options = [],
89-
CarbonImmutable $createdAt = null,
89+
?CarbonImmutable $createdAt = null,
9090
?CarbonImmutable $cancelledAt = null,
9191
?CarbonImmutable $finishedAt = null)
9292
{

0 commit comments

Comments
 (0)