Skip to content

Commit 494c837

Browse files
authored
Prevent issue: $instance must not be accessed before initialization (#2578)
* Prevent issue: must not be accessed before initialization * Fix styling * Fix styling --------- Co-authored-by: CaReS0107 <[email protected]>
1 parent 83db24f commit 494c837

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: src/SchedulerManager.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function run(): void
2424

2525
public function __destruct()
2626
{
27-
if (! $this->instance->wasRecentlyCreated) {
27+
if ($this->instance && ! $this->instance->wasRecentlyCreated) {
2828
$this->instance->save();
2929
}
3030
}

Diff for: tests/Feature/Models/MailatorScheduleTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function test_can_use_carbon_target_date_before(): void
6262

6363
// MailatorSchedule::run();
6464
// Mail::assertNothingSent();
65-
65+
6666
$this->travelTo(now()->addDays(6));
6767
MailatorSchedule::run();
6868

0 commit comments

Comments
 (0)