File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed
src/Symfony/Component/Scheduler Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,8 @@ public static function getInvalidIntervals(): iterable
7373 yield ['3600.5 ' ];
7474 yield ['-3600 ' ];
7575 yield [-3600 ];
76+ yield ['0 ' ];
77+ yield [0 ];
7678 }
7779
7880 /**
Original file line number Diff line number Diff line change @@ -30,18 +30,11 @@ public function __construct(
3030 $ this ->from = \is_string ($ from ) ? new \DateTimeImmutable ($ from ) : $ from ;
3131 $ this ->until = \is_string ($ until ) ? new \DateTimeImmutable ($ until ) : $ until ;
3232
33- if (\is_int ($ interval ) || \is_float ($ interval )) {
34- if (0 >= $ interval ) {
33+ if (\is_int ($ interval ) || \is_float ($ interval ) || \is_string ( $ interval ) && ctype_digit ( $ interval ) ) {
34+ if (0 >= ( int ) $ interval ) {
3535 throw new InvalidArgumentException ('The "$interval" argument must be greater than zero. ' );
3636 }
3737
38- $ this ->intervalInSeconds = $ interval ;
39- $ this ->description = sprintf ('every %d seconds ' , $ this ->intervalInSeconds );
40-
41- return ;
42- }
43-
44- if (\is_string ($ interval ) && ctype_digit ($ interval )) {
4538 $ this ->intervalInSeconds = (int ) $ interval ;
4639 $ this ->description = sprintf ('every %d seconds ' , $ this ->intervalInSeconds );
4740
You can’t perform that action at this time.
0 commit comments