From 4fcaa149a68545a756826036573a70c178691e07 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Thu, 21 Jan 2021 17:51:44 +0100 Subject: [PATCH] Bump CronExpression minimum version --- composer.json | 2 +- src/Illuminate/Console/Scheduling/Event.php | 2 +- src/Illuminate/Console/Scheduling/ScheduleListCommand.php | 5 ++++- src/Illuminate/Console/composer.json | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 79bea59f041d..7c66b17ea08d 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "ext-mbstring": "*", "ext-openssl": "*", "doctrine/inflector": "^1.4|^2.0", - "dragonmantank/cron-expression": "^3.0.2", + "dragonmantank/cron-expression": "^3.1", "egulias/email-validator": "^2.1.10", "league/commonmark": "^1.3", "league/flysystem": "^2.0", diff --git a/src/Illuminate/Console/Scheduling/Event.php b/src/Illuminate/Console/Scheduling/Event.php index 0bfaeaf8c429..2e14fd56e4a2 100644 --- a/src/Illuminate/Console/Scheduling/Event.php +++ b/src/Illuminate/Console/Scheduling/Event.php @@ -328,7 +328,7 @@ protected function expressionPasses() $date->setTimezone($this->timezone); } - return CronExpression::factory($this->expression)->isDue($date->toDateTimeString()); + return (new CronExpression($this->expression))->isDue($date->toDateTimeString()); } /** diff --git a/src/Illuminate/Console/Scheduling/ScheduleListCommand.php b/src/Illuminate/Console/Scheduling/ScheduleListCommand.php index bc8cecfe0618..abd722dbfcb8 100644 --- a/src/Illuminate/Console/Scheduling/ScheduleListCommand.php +++ b/src/Illuminate/Console/Scheduling/ScheduleListCommand.php @@ -3,6 +3,7 @@ namespace Illuminate\Console\Scheduling; use Cron\CronExpression; +use DateTimeZone; use Illuminate\Console\Command; use Illuminate\Support\Carbon; @@ -47,7 +48,9 @@ public function handle(Schedule $schedule) $event->description, (new CronExpression($event->expression)) ->getNextRunDate(Carbon::now()) - ->setTimezone($this->option('timezone', config('app.timezone'))), + ->setTimezone( + new DateTimeZone($this->option('timezone') ?? config('app.timezone')) + ), ]; } diff --git a/src/Illuminate/Console/composer.json b/src/Illuminate/Console/composer.json index b3fae079a42c..fe6560a9465c 100755 --- a/src/Illuminate/Console/composer.json +++ b/src/Illuminate/Console/composer.json @@ -33,7 +33,7 @@ } }, "suggest": { - "dragonmantank/cron-expression": "Required to use scheduler (^3.0.2).", + "dragonmantank/cron-expression": "Required to use scheduler (^3.1).", "guzzlehttp/guzzle": "Required to use the ping methods on schedules (^7.2).", "illuminate/bus": "Required to use the scheduled job dispatcher (^9.0).", "illuminate/container": "Required to use the scheduler (^9.0).",