diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fe7ea1b..165fa4e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -41,7 +41,7 @@ jobs: strategy: fail-fast: false matrix: - php: [7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3] + php: [7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4] steps: - name: Checkout diff --git a/phpstan.neon b/phpstan.neon index bea9cb0..2e67762 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,4 @@ parameters: - checkMissingIterableValueType: false ignoreErrors: - '#Call to an undefined method DateTimeInterface::add\(\)#' @@ -8,6 +7,7 @@ parameters: - '#Call to an undefined method DateTimeInterface::setTime\(\)#' - '#Call to an undefined method DateTimeInterface::setTimezone\(\)#' - '#Call to an undefined method DateTimeInterface::sub\(\)#' + - identifier: missingType.iterableValue level: max diff --git a/src/Cron/AbstractField.php b/src/Cron/AbstractField.php index df2848d..58ebde1 100644 --- a/src/Cron/AbstractField.php +++ b/src/Cron/AbstractField.php @@ -139,6 +139,8 @@ public function isInIncrementsOfRanges(int $dateValue, string $value): bool return false; } + $step = (int)$step; + // Expand the * to a full range if ('*' === $range) { $range = $this->rangeStart . '-' . $this->rangeEnd; @@ -217,6 +219,7 @@ public function getRangeForExpression(string $expression, int $max): array $offset = $range[0]; $to = $range[1] ?? $max; } + $stepSize = (int)$stepSize; $offset = '*' === $offset ? $this->rangeStart : $offset; if ($stepSize >= $this->rangeEnd) { $values = [$this->fullRange[$stepSize % \count($this->fullRange)]]; diff --git a/src/Cron/DayOfWeekField.php b/src/Cron/DayOfWeekField.php index b9bbf48..e26306e 100644 --- a/src/Cron/DayOfWeekField.php +++ b/src/Cron/DayOfWeekField.php @@ -69,7 +69,7 @@ public function isSatisfiedBy(DateTimeInterface $date, $value, bool $invert): bo // Find out if this is the last specific weekday of the month if ($lPosition = strpos($value, 'L')) { - $weekday = $this->convertLiterals(substr($value, 0, $lPosition)); + $weekday = (int)$this->convertLiterals(substr($value, 0, $lPosition)); $weekday %= 7; $daysInMonth = (int) $date->format('t');