From 6797f03573106e1c9a4a4df4319dfa2141da62df 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:53:41 +0100 Subject: [PATCH] Add PHPDoc type hints (#53984) * Add PHPDoc type hints * Hours are 0-based * Fix spacing --- .../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..d3ffd79841ae 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, 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 $first - * @param int $second + * @param int<0, 23> $first + * @param int<0, 23> $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, 23> $first + * @param int<0, 23> $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, 23> $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) *