diff --git a/composer.json b/composer.json index c7780cc..0828f9e 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "require": { "php": ">=8.1", "ext-mbstring": "*", - "dragonmantank/cron-expression": "^2.0 || ^3.0" + "dragonmantank/cron-expression": "^2.3 || ^3.0" }, "require-dev": { "infection/infection": "^0.27.11", diff --git a/src/CronJob.php b/src/CronJob.php index 40b0dd1..150fad8 100644 --- a/src/CronJob.php +++ b/src/CronJob.php @@ -4,13 +4,20 @@ namespace Setono\CronBuilder; +use Cron\CronExpression; + final class CronJob implements \Stringable { + public readonly string $schedule; + public function __construct( - public readonly string $schedule, + string $schedule, public readonly string $command, public readonly ?string $description = null, ) { + new CronExpression($schedule); + + $this->schedule = $schedule; } public function toString(): string