From 2a8bde84486ea3094b841cdbe999e64f0114cdd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Thu, 19 Dec 2024 22:27:12 +0100 Subject: [PATCH 1/3] Add PHPDoc type hints --- .../Console/Scheduling/ManagesFrequencies.php | 26 +++++++++---------- src/Illuminate/Support/Facades/Schedule.php | 12 ++++----- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index d974a91b769e..6b8a18f43e83 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -143,7 +143,7 @@ public function everyThirtySeconds() /** * Schedule the event to run multiple times per minute. * - * @param int $seconds + * @param int<0, 59> $seconds * @return $this */ protected function repeatEvery($seconds) @@ -250,7 +250,7 @@ public function hourly() /** * Schedule the event to run hourly at a given offset in the hour. * - * @param array|string|int $offset + * @param array|string|int<0, 24>|int<0, 24>[] $offset * @return $this */ public function hourlyAt($offset) @@ -353,8 +353,8 @@ public function dailyAt($time) /** * Schedule the event to run twice daily. * - * @param int $first - * @param int $second + * @param int<0, 24> $first + * @param int<0, 24> $second * @return $this */ public function twiceDaily($first = 1, $second = 13) @@ -365,9 +365,9 @@ public function twiceDaily($first = 1, $second = 13) /** * Schedule the event to run twice daily at a given offset. * - * @param int $first - * @param int $second - * @param int $offset + * @param int<0, 24> $first + * @param int<0, 24> $second + * @param int<0, 59> $offset * @return $this */ public function twiceDailyAt($first = 1, $second = 13, $offset = 0) @@ -380,8 +380,8 @@ public function twiceDailyAt($first = 1, $second = 13, $offset = 0) /** * Schedule the event to run at the given minutes and hours. * - * @param array|string|int $minutes - * @param array|string|int $hours + * @param array|string|int<0, 59> $minutes + * @param array|string|int<0, 24> $hours * @return $this */ protected function hourBasedSchedule($minutes, $hours) @@ -525,7 +525,7 @@ public function monthly() /** * Schedule the event to run monthly on a given day and time. * - * @param int $dayOfMonth + * @param int<0, 31> $dayOfMonth * @param string $time * @return $this */ @@ -539,8 +539,8 @@ public function monthlyOn($dayOfMonth = 1, $time = '0:0') /** * Schedule the event to run twice monthly at a given time. * - * @param int $first - * @param int $second + * @param int $first<0, 31> + * @param int $second<0, 31> * @param string $time * @return $this */ @@ -611,7 +611,7 @@ public function yearly() * Schedule the event to run yearly on a given month, day, and time. * * @param int $month - * @param int|string $dayOfMonth + * @param int<0, 31>|string $dayOfMonth * @param string $time * @return $this */ diff --git a/src/Illuminate/Support/Facades/Schedule.php b/src/Illuminate/Support/Facades/Schedule.php index 3c22681f5fca..29da6f53db0b 100644 --- a/src/Illuminate/Support/Facades/Schedule.php +++ b/src/Illuminate/Support/Facades/Schedule.php @@ -50,7 +50,7 @@ * @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyFifteenMinutes() * @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyThirtyMinutes() * @method static \Illuminate\Console\Scheduling\PendingEventAttributes hourly() - * @method static \Illuminate\Console\Scheduling\PendingEventAttributes hourlyAt(array|string|int $offset) + * @method static \Illuminate\Console\Scheduling\PendingEventAttributes hourlyAt(array|string|int<0, 23> $offset) * @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyOddHour(array|string|int $offset = 0) * @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyTwoHours(array|string|int $offset = 0) * @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyThreeHours(array|string|int $offset = 0) @@ -59,8 +59,8 @@ * @method static \Illuminate\Console\Scheduling\PendingEventAttributes daily() * @method static \Illuminate\Console\Scheduling\PendingEventAttributes at(string $time) * @method static \Illuminate\Console\Scheduling\PendingEventAttributes dailyAt(string $time) - * @method static \Illuminate\Console\Scheduling\PendingEventAttributes twiceDaily(int $first = 1, int $second = 13) - * @method static \Illuminate\Console\Scheduling\PendingEventAttributes twiceDailyAt(int $first = 1, int $second = 13, int $offset = 0) + * @method static \Illuminate\Console\Scheduling\PendingEventAttributes twiceDaily(int<0, 23> $first = 1, int<0, 23> $second = 13) + * @method static \Illuminate\Console\Scheduling\PendingEventAttributes twiceDailyAt(int<0, 23> $first = 1, int<0, 23> $second = 13, int $offset = 0) * @method static \Illuminate\Console\Scheduling\PendingEventAttributes weekdays() * @method static \Illuminate\Console\Scheduling\PendingEventAttributes weekends() * @method static \Illuminate\Console\Scheduling\PendingEventAttributes mondays() @@ -73,13 +73,13 @@ * @method static \Illuminate\Console\Scheduling\PendingEventAttributes weekly() * @method static \Illuminate\Console\Scheduling\PendingEventAttributes weeklyOn(array|mixed $dayOfWeek, string $time = '0:0') * @method static \Illuminate\Console\Scheduling\PendingEventAttributes monthly() - * @method static \Illuminate\Console\Scheduling\PendingEventAttributes monthlyOn(int $dayOfMonth = 1, string $time = '0:0') - * @method static \Illuminate\Console\Scheduling\PendingEventAttributes twiceMonthly(int $first = 1, int $second = 16, string $time = '0:0') + * @method static \Illuminate\Console\Scheduling\PendingEventAttributes monthlyOn(int<0, 31> $dayOfMonth = 1, string $time = '0:0') + * @method static \Illuminate\Console\Scheduling\PendingEventAttributes twiceMonthly(int<0, 31> $first = 1, int<0, 31> $second = 16, string $time = '0:0') * @method static \Illuminate\Console\Scheduling\PendingEventAttributes lastDayOfMonth(string $time = '0:0') * @method static \Illuminate\Console\Scheduling\PendingEventAttributes quarterly() * @method static \Illuminate\Console\Scheduling\PendingEventAttributes quarterlyOn(int $dayOfQuarter = 1, string $time = '0:0') * @method static \Illuminate\Console\Scheduling\PendingEventAttributes yearly() - * @method static \Illuminate\Console\Scheduling\PendingEventAttributes yearlyOn(int $month = 1, int|string $dayOfMonth = 1, string $time = '0:0') + * @method static \Illuminate\Console\Scheduling\PendingEventAttributes yearlyOn(int $month = 1, int<0, 31>|string $dayOfMonth = 1, string $time = '0:0') * @method static \Illuminate\Console\Scheduling\PendingEventAttributes days(array|mixed $days) * @method static \Illuminate\Console\Scheduling\PendingEventAttributes timezone(\DateTimeZone|string $timezone) * From 546d8c6bba2bbb1876d832cf42bf4adb371f8a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Thu, 19 Dec 2024 22:28:11 +0100 Subject: [PATCH 2/3] Hours are 0-based --- .../Console/Scheduling/ManagesFrequencies.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index 6b8a18f43e83..80fcc4ab5124 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -250,7 +250,7 @@ public function hourly() /** * Schedule the event to run hourly at a given offset in the hour. * - * @param array|string|int<0, 24>|int<0, 24>[] $offset + * @param array|string|int<0, 23>|int<0, 23>[] $offset * @return $this */ public function hourlyAt($offset) @@ -353,8 +353,8 @@ public function dailyAt($time) /** * Schedule the event to run twice daily. * - * @param int<0, 24> $first - * @param int<0, 24> $second + * @param int<0, 23> $first + * @param int<0, 23> $second * @return $this */ public function twiceDaily($first = 1, $second = 13) @@ -365,8 +365,8 @@ public function twiceDaily($first = 1, $second = 13) /** * Schedule the event to run twice daily at a given offset. * - * @param int<0, 24> $first - * @param int<0, 24> $second + * @param int<0, 23> $first + * @param int<0, 23> $second * @param int<0, 59> $offset * @return $this */ @@ -381,7 +381,7 @@ public function twiceDailyAt($first = 1, $second = 13, $offset = 0) * Schedule the event to run at the given minutes and hours. * * @param array|string|int<0, 59> $minutes - * @param array|string|int<0, 24> $hours + * @param array|string|int<0, 23> $hours * @return $this */ protected function hourBasedSchedule($minutes, $hours) From 38c058a71eb7802f0930e99d47588369144230e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Thu, 19 Dec 2024 22:30:09 +0100 Subject: [PATCH 3/3] Fix spacing --- src/Illuminate/Console/Scheduling/ManagesFrequencies.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index 80fcc4ab5124..d3ffd79841ae 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -539,8 +539,8 @@ public function monthlyOn($dayOfMonth = 1, $time = '0:0') /** * Schedule the event to run twice monthly at a given time. * - * @param int $first<0, 31> - * @param int $second<0, 31> + * @param int $first<0, 31> + * @param int $second<0, 31> * @param string $time * @return $this */