diff --git a/src/Cron/DayOfMonthField.php b/src/Cron/DayOfMonthField.php index 60fa465..39ff597 100644 --- a/src/Cron/DayOfMonthField.php +++ b/src/Cron/DayOfMonthField.php @@ -94,9 +94,9 @@ public function isSatisfiedBy(DateTimeInterface $date, $value, bool $invert): bo } // Check to see if this is the nearest weekday to a particular value - if (strpos($value, 'W')) { + if ($wPosition = strpos($value, 'W')) { // Parse the target day - $targetDay = (int) substr($value, 0, strpos($value, 'W')); + $targetDay = (int) substr($value, 0, $wPosition); // Find out if the current day is the nearest day of the week $nearest = self::getNearestWeekday( (int) $date->format('Y'), diff --git a/src/Cron/DayOfWeekField.php b/src/Cron/DayOfWeekField.php index 5ac003d..b9bbf48 100644 --- a/src/Cron/DayOfWeekField.php +++ b/src/Cron/DayOfWeekField.php @@ -68,8 +68,8 @@ public function isSatisfiedBy(DateTimeInterface $date, $value, bool $invert): bo $lastDayOfMonth = (int) $date->format('t'); // Find out if this is the last specific weekday of the month - if (strpos($value, 'L')) { - $weekday = $this->convertLiterals(substr($value, 0, strpos($value, 'L'))); + if ($lPosition = strpos($value, 'L')) { + $weekday = $this->convertLiterals(substr($value, 0, $lPosition)); $weekday %= 7; $daysInMonth = (int) $date->format('t'); diff --git a/src/Cron/HoursField.php b/src/Cron/HoursField.php index a7f8f33..413d138 100644 --- a/src/Cron/HoursField.php +++ b/src/Cron/HoursField.php @@ -25,7 +25,7 @@ class HoursField extends AbstractField /** * @var array|null Transitions returned by DateTimeZone::getTransitions() */ - protected $transitions = null; + protected $transitions = []; /** * @var int|null Timestamp of the start of the transitions range @@ -92,7 +92,7 @@ public function getPastTransition(DateTimeInterface $date): ?array $dtLimitStart->getTimestamp(), $dtLimitEnd->getTimestamp() ); - if ($this->transitions === false) { + if (empty($this->transitions)) { return null; } $this->transitionsStart = $dtLimitStart->getTimestamp();