Skip to content

Conversation

@saMahmoudzadeh
Copy link
Contributor

This PR, in batchable trait :

  • fix accepting nullable Parameter (withFakeBatch method)
  • fix doc block (withFakeBatch method)
  • fix null pointer exception (batch method)

Fix Accepting Nullable Parameter in WithFakeBatch method

// before
CarbonImmutable $createdAt = null

// after
?CarbonImmutable $createdAt = null

CarbonImmutable::now()->toImmutable()

Modified the $createdAt assignment to explicitly convert the result of CarbonImmutable::now() to CarbonImmutable using toImmutable(). This guarantees that the type of $createdAt aligns with the expected CarbonImmutable type in the new BatchFake class.

$this->fakeBatch = new BatchFake(
   empty($id) ? (string) Str::uuid() : $id,
   $name,
   $totalJobs,
   $pendingJobs,
   $failedJobs,
   $failedJobIds,
   $options,
   $createdAt ?? CarbonImmutable::now()->toImmutable(),
   $cancelledAt,
   $finishedAt,
);

@saMahmoudzadeh
Copy link
Contributor Author

I corrected the commit title. It had a spelling mistake.

@taylorotwell taylorotwell merged commit 4ebce1e into laravel:10.x Feb 23, 2024
@saMahmoudzadeh saMahmoudzadeh deleted the fix/batchable-trait branch February 23, 2024 16:58
@saMahmoudzadeh
Copy link
Contributor Author

Thanks!

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.

2 participants