Skip to content

Commit

Permalink
Prevent issue: $instance must not be accessed before initialization (#…
Browse files Browse the repository at this point in the history
…2578)

* Prevent issue:  must not be accessed before initialization

* Fix styling

* Fix styling

---------

Co-authored-by: CaReS0107 <[email protected]>
  • Loading branch information
CaReS0107 and CaReS0107 authored Feb 22, 2024
1 parent 83db24f commit 494c837
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/SchedulerManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function run(): void

public function __destruct()
{
if (! $this->instance->wasRecentlyCreated) {
if ($this->instance && ! $this->instance->wasRecentlyCreated) {
$this->instance->save();
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/Models/MailatorScheduleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function test_can_use_carbon_target_date_before(): void

// MailatorSchedule::run();
// Mail::assertNothingSent();

$this->travelTo(now()->addDays(6));
MailatorSchedule::run();

Expand Down

0 comments on commit 494c837

Please sign in to comment.