From 3a251cf9546bf3d050904aba200ee54e1aa9ee3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:13:15 +0100 Subject: [PATCH 01/43] const to enum --- src/Illuminate/Auth/Enums/PasswordStatus.php | 31 +++++++++++++++++ .../Auth/Passwords/PasswordBroker.php | 18 +++++----- src/Illuminate/Console/Enums/ScheduleOn.php | 20 +++++++++++ .../Console/Scheduling/ManagesFrequencies.php | 19 +++++++---- .../Console/Scheduling/Schedule.php | 22 ++++++++---- .../Contracts/Auth/PasswordBroker.php | 14 ++++---- src/Illuminate/Queue/Enums/WorkerExitCode.php | 10 ++++++ src/Illuminate/Queue/Worker.php | 34 ++++++++++++------- src/Illuminate/Support/Facades/Password.php | 14 ++++---- 9 files changed, 133 insertions(+), 49 deletions(-) create mode 100644 src/Illuminate/Auth/Enums/PasswordStatus.php create mode 100644 src/Illuminate/Console/Enums/ScheduleOn.php create mode 100644 src/Illuminate/Queue/Enums/WorkerExitCode.php diff --git a/src/Illuminate/Auth/Enums/PasswordStatus.php b/src/Illuminate/Auth/Enums/PasswordStatus.php new file mode 100644 index 000000000000..9ec7bd1b346a --- /dev/null +++ b/src/Illuminate/Auth/Enums/PasswordStatus.php @@ -0,0 +1,31 @@ +<?php + +namespace Illuminate\Auth\Enums; + +enum PasswordStatus: string +{ + /** + * Constant representing a successfully sent reminder. + */ + case RESET_LINK_SENT = 'passwords.sent'; + + /** + * Constant representing a successfully reset password. + */ + case PASSWORD_RESET = 'passwords.reset'; + + /** + * Constant representing the user not found response. + */ + case INVALID_USER = 'passwords.user'; + + /** + * Constant representing an invalid token. + */ + case INVALID_TOKEN = 'passwords.token'; + + /** + * Constant representing a throttled reset attempt. + */ + case RESET_THROTTLED = 'passwords.throttled'; +} \ No newline at end of file diff --git a/src/Illuminate/Auth/Passwords/PasswordBroker.php b/src/Illuminate/Auth/Passwords/PasswordBroker.php index 29ef2f9cbce6..890d4fe3f4b1 100755 --- a/src/Illuminate/Auth/Passwords/PasswordBroker.php +++ b/src/Illuminate/Auth/Passwords/PasswordBroker.php @@ -54,7 +54,7 @@ public function __construct(#[\SensitiveParameter] TokenRepositoryInterface $tok * * @param array $credentials * @param \Closure|null $callback - * @return string + * @return \Illuminate\Auth\Enums\PasswordStatus */ public function sendResetLink(#[\SensitiveParameter] array $credentials, ?Closure $callback = null) { @@ -64,17 +64,17 @@ public function sendResetLink(#[\SensitiveParameter] array $credentials, ?Closur $user = $this->getUser($credentials); if (is_null($user)) { - return static::INVALID_USER; + return PasswordStatus::INVALID_USER; } if ($this->tokens->recentlyCreatedToken($user)) { - return static::RESET_THROTTLED; + return PasswordStatus::RESET_THROTTLED; } $token = $this->tokens->create($user); if ($callback) { - return $callback($user, $token) ?? static::RESET_LINK_SENT; + return $callback($user, $token) ?? PasswordStatus::RESET_LINK_SENT; } // Once we have the reset token, we are ready to send the message out to this @@ -84,7 +84,7 @@ public function sendResetLink(#[\SensitiveParameter] array $credentials, ?Closur $this->events?->dispatch(new PasswordResetLinkSent($user)); - return static::RESET_LINK_SENT; + return PasswordStatus::RESET_LINK_SENT; } /** @@ -114,23 +114,23 @@ public function reset(#[\SensitiveParameter] array $credentials, Closure $callba $this->tokens->delete($user); - return static::PASSWORD_RESET; + return PasswordStatus::PASSWORD_RESET; } /** * Validate a password reset for the given credentials. * * @param array $credentials - * @return \Illuminate\Contracts\Auth\CanResetPassword|string + * @return \Illuminate\Contracts\Auth\CanResetPassword|\Illuminate\Auth\Enums\PasswordStatus */ protected function validateReset(#[\SensitiveParameter] array $credentials) { if (is_null($user = $this->getUser($credentials))) { - return static::INVALID_USER; + return PasswordStatus::INVALID_USER; } if (! $this->tokens->exists($user, $credentials['token'])) { - return static::INVALID_TOKEN; + return PasswordStatus::INVALID_TOKEN; } return $user; diff --git a/src/Illuminate/Console/Enums/ScheduleOn.php b/src/Illuminate/Console/Enums/ScheduleOn.php new file mode 100644 index 000000000000..c5a9c7029414 --- /dev/null +++ b/src/Illuminate/Console/Enums/ScheduleOn.php @@ -0,0 +1,20 @@ +<?php + +namespace Illuminate\Console\Enums; + +enum ScheduleOn: int +{ + case SUNDAY = 0; + + case MONDAY = 1; + + case TUESDAY = 2; + + case WEDNESDAY = 3; + + case THURSDAY = 4; + + case FRIDAY = 5; + + case SATURDAY = 6; +} diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index d974a91b769e..2d291942f93a 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -2,9 +2,12 @@ namespace Illuminate\Console\Scheduling; +use Illuminate\Console\Enums\ScheduleOn; use Illuminate\Support\Carbon; use InvalidArgumentException; +use function Illuminate\Support\enum_value; + trait ManagesFrequencies { /** @@ -421,7 +424,7 @@ public function weekends() */ public function mondays() { - return $this->days(Schedule::MONDAY); + return $this->days(ScheduleOn::MONDAY); } /** @@ -431,7 +434,7 @@ public function mondays() */ public function tuesdays() { - return $this->days(Schedule::TUESDAY); + return $this->days(ScheduleOn::TUESDAY); } /** @@ -441,7 +444,7 @@ public function tuesdays() */ public function wednesdays() { - return $this->days(Schedule::WEDNESDAY); + return $this->days(ScheduleOn::WEDNESDAY); } /** @@ -451,7 +454,7 @@ public function wednesdays() */ public function thursdays() { - return $this->days(Schedule::THURSDAY); + return $this->days(ScheduleOn::THURSDAY); } /** @@ -461,7 +464,7 @@ public function thursdays() */ public function fridays() { - return $this->days(Schedule::FRIDAY); + return $this->days(ScheduleOn::FRIDAY); } /** @@ -471,7 +474,7 @@ public function fridays() */ public function saturdays() { - return $this->days(Schedule::SATURDAY); + return $this->days(ScheduleOn::SATURDAY); } /** @@ -481,7 +484,7 @@ public function saturdays() */ public function sundays() { - return $this->days(Schedule::SUNDAY); + return $this->days(Schedule::SUNDAYOn); } /** @@ -633,6 +636,8 @@ public function days($days) { $days = is_array($days) ? $days : func_get_args(); + $days = array_map(enum_value(...), $days); + return $this->spliceIntoPosition(5, implode(',', $days)); } diff --git a/src/Illuminate/Console/Scheduling/Schedule.php b/src/Illuminate/Console/Scheduling/Schedule.php index 839d36272122..80c8d4596fb2 100644 --- a/src/Illuminate/Console/Scheduling/Schedule.php +++ b/src/Illuminate/Console/Scheduling/Schedule.php @@ -7,6 +7,7 @@ use DateTimeInterface; use Illuminate\Bus\UniqueLock; use Illuminate\Console\Application; +use Illuminate\Console\Enums\ScheduleOn; use Illuminate\Container\Container; use Illuminate\Contracts\Bus\Dispatcher; use Illuminate\Contracts\Cache\Repository as Cache; @@ -28,19 +29,26 @@ class Schedule __call as macroCall; } - const SUNDAY = 0; + /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::SUNDAY instead */ + const SUNDAY = ScheduleOn::SUNDAY; - const MONDAY = 1; + /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::MONDAY instead */ + const MONDAY = ScheduleOn::MONDAY; - const TUESDAY = 2; + /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::TUESDAY instead */ + const TUESDAY = ScheduleOn::TUESDAY; - const WEDNESDAY = 3; + /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::WEDNESDAY instead */ + const WEDNESDAY = ScheduleOn::WEDNESDAY; - const THURSDAY = 4; + /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::THURSDAY instead */ + const THURSDAY = ScheduleOn::THURSDAY; - const FRIDAY = 5; + /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::FRIDAY instead */ + const FRIDAY = ScheduleOn::FRIDAY; - const SATURDAY = 6; + /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::SATURDAY instead */ + const SATURDAY = ScheduleOn::SATURDAY; /** * All of the events on the schedule. diff --git a/src/Illuminate/Contracts/Auth/PasswordBroker.php b/src/Illuminate/Contracts/Auth/PasswordBroker.php index c6b202329e39..a16845652b6f 100644 --- a/src/Illuminate/Contracts/Auth/PasswordBroker.php +++ b/src/Illuminate/Contracts/Auth/PasswordBroker.php @@ -2,6 +2,8 @@ namespace Illuminate\Contracts\Auth; +use Illuminate\Auth\Enums\PasswordStatus; + use Closure; interface PasswordBroker @@ -11,42 +13,42 @@ interface PasswordBroker * * @var string */ - const RESET_LINK_SENT = 'passwords.sent'; + const RESET_LINK_SENT = PasswordStatus::RESET_LINK_SENT; /** * Constant representing a successfully reset password. * * @var string */ - const PASSWORD_RESET = 'passwords.reset'; + const PASSWORD_RESET = PasswordStatus::PASSWORD_RESET; /** * Constant representing the user not found response. * * @var string */ - const INVALID_USER = 'passwords.user'; + const INVALID_USER = PasswordStatus::INVALID_USER; /** * Constant representing an invalid token. * * @var string */ - const INVALID_TOKEN = 'passwords.token'; + const INVALID_TOKEN = PasswordStatus::INVALID_TOKEN; /** * Constant representing a throttled reset attempt. * * @var string */ - const RESET_THROTTLED = 'passwords.throttled'; + const RESET_THROTTLED = PasswordStatus::RESET_THROTTLED; /** * Send a password reset link to a user. * * @param array $credentials * @param \Closure|null $callback - * @return string + * @return \Illuminate\Auth\Enums\PasswordStatus */ public function sendResetLink(array $credentials, ?Closure $callback = null); diff --git a/src/Illuminate/Queue/Enums/WorkerExitCode.php b/src/Illuminate/Queue/Enums/WorkerExitCode.php new file mode 100644 index 000000000000..3d19f178444e --- /dev/null +++ b/src/Illuminate/Queue/Enums/WorkerExitCode.php @@ -0,0 +1,10 @@ +<?php + +namespace Illuminate\Queue\Enums; + +enum WorkerExitCode: int +{ + case SUCCESS = 0; + case ERROR = 1; + case MEMORY_LIMIT = 12; +} diff --git a/src/Illuminate/Queue/Worker.php b/src/Illuminate/Queue/Worker.php index 1dd228fb907d..bddeb4be326c 100644 --- a/src/Illuminate/Queue/Worker.php +++ b/src/Illuminate/Queue/Worker.php @@ -7,6 +7,7 @@ use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Queue\Factory as QueueManager; use Illuminate\Database\DetectsLostConnections; +use Illuminate\Queue\Enums\WorkerExitCode; use Illuminate\Queue\Events\JobAttempted; use Illuminate\Queue\Events\JobExceptionOccurred; use Illuminate\Queue\Events\JobPopped; @@ -20,13 +21,20 @@ use Illuminate\Support\Carbon; use Throwable; +use function Illuminate\Support\enum_value; + class Worker { use DetectsLostConnections; - const EXIT_SUCCESS = 0; - const EXIT_ERROR = 1; - const EXIT_MEMORY_LIMIT = 12; + /** @deprecated Use \Illuminate\Queue\Enums\WorkerExitCode::SUCCESS instead */ + const EXIT_SUCCESS = WorkerExitCode::SUCCESS; + + /** @deprecated Use \Illuminate\Queue\Enums\WorkerExitCode::ERROR instead */ + const EXIT_ERROR = WorkerExitCode::ERROR; + + /** @deprecated Use \Illuminate\Queue\Enums\WorkerExitCode::MEMORY_LIMIT instead */ + const EXIT_MEMORY_LIMIT = WorkerExitCode::MEMORY_LIMIT; /** * The name of the worker. @@ -232,7 +240,7 @@ protected function registerTimeoutHandler($job, WorkerOptions $options) )); } - $this->kill(static::EXIT_ERROR, $options); + $this->kill(WorkerExitCode::EXIT_ERROR, $options); }, true); pcntl_alarm( @@ -299,17 +307,17 @@ protected function pauseWorker(WorkerOptions $options, $lastRestart) * @param int $startTime * @param int $jobsProcessed * @param mixed $job - * @return int|null + * @return \Illuminate\Queue\Enums\WorkerExitCode|null */ protected function stopIfNecessary(WorkerOptions $options, $lastRestart, $startTime = 0, $jobsProcessed = 0, $job = null) { return match (true) { - $this->shouldQuit => static::EXIT_SUCCESS, - $this->memoryExceeded($options->memory) => static::EXIT_MEMORY_LIMIT, - $this->queueShouldRestart($lastRestart) => static::EXIT_SUCCESS, - $options->stopWhenEmpty && is_null($job) => static::EXIT_SUCCESS, - $options->maxTime && hrtime(true) / 1e9 - $startTime >= $options->maxTime => static::EXIT_SUCCESS, - $options->maxJobs && $jobsProcessed >= $options->maxJobs => static::EXIT_SUCCESS, + $this->shouldQuit => WorkerExitCode::EXIT_SUCCESS, + $this->memoryExceeded($options->memory) => WorkerExitCode::EXIT_MEMORY_LIMIT, + $this->queueShouldRestart($lastRestart) => WorkerExitCode::EXIT_SUCCESS, + $options->stopWhenEmpty && is_null($job) => WorkerExitCode::EXIT_SUCCESS, + $options->maxTime && hrtime(true) / 1e9 - $startTime >= $options->maxTime => WorkerExitCode::EXIT_SUCCESS, + $options->maxJobs && $jobsProcessed >= $options->maxJobs => WorkerExitCode::EXIT_SUCCESS, default => null }; } @@ -767,13 +775,13 @@ public function stop($status = 0, $options = null) /** * Kill the process. * - * @param int $status + * @param \Illuminate\Queue\Enums\WorkerExitCode|int $status * @param \Illuminate\Queue\WorkerOptions|null $options * @return never */ public function kill($status = 0, $options = null) { - $this->events->dispatch(new WorkerStopping($status, $options)); + $this->events->dispatch(new WorkerStopping(enum_value($status), $options)); if (extension_loaded('posix')) { posix_kill(getmypid(), SIGKILL); diff --git a/src/Illuminate/Support/Facades/Password.php b/src/Illuminate/Support/Facades/Password.php index 87d9daf6fb11..65489b68645c 100755 --- a/src/Illuminate/Support/Facades/Password.php +++ b/src/Illuminate/Support/Facades/Password.php @@ -2,13 +2,13 @@ namespace Illuminate\Support\Facades; -use Illuminate\Contracts\Auth\PasswordBroker; +use Illuminate\Auth\Enums\PasswordStatus; /** * @method static \Illuminate\Contracts\Auth\PasswordBroker broker(string|null $name = null) * @method static string getDefaultDriver() * @method static void setDefaultDriver(string $name) - * @method static string sendResetLink(array $credentials, \Closure|null $callback = null) + * @method static \Illuminate\Auth\Enums\PasswordStatus sendResetLink(array $credentials, \Closure|null $callback = null) * @method static mixed reset(array $credentials, \Closure $callback) * @method static \Illuminate\Contracts\Auth\CanResetPassword|null getUser(array $credentials) * @method static string createToken(\Illuminate\Contracts\Auth\CanResetPassword $user) @@ -26,35 +26,35 @@ class Password extends Facade * * @var string */ - const RESET_LINK_SENT = PasswordBroker::RESET_LINK_SENT; + const RESET_LINK_SENT = = PasswordStatus::RESET_LINK_SENT; /** * Constant representing a successfully reset password. * * @var string */ - const PASSWORD_RESET = PasswordBroker::PASSWORD_RESET; + const PASSWORD_RESET = PasswordStatus::PASSWORD_RESET; /** * Constant representing the user not found response. * * @var string */ - const INVALID_USER = PasswordBroker::INVALID_USER; + const INVALID_USER = PasswordStatus::INVALID_USER; /** * Constant representing an invalid token. * * @var string */ - const INVALID_TOKEN = PasswordBroker::INVALID_TOKEN; + const INVALID_TOKEN = PasswordStatus::INVALID_TOKEN; /** * Constant representing a throttled reset attempt. * * @var string */ - const RESET_THROTTLED = PasswordBroker::RESET_THROTTLED; + const RESET_THROTTLED = PasswordStatus::RESET_THROTTLED; /** * Get the registered name of the component. From 5bf6f6939d3ebb5ed075262421c5143f620c1baf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:17:13 +0100 Subject: [PATCH 02/43] Fix syntax error --- src/Illuminate/Support/Facades/Password.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Support/Facades/Password.php b/src/Illuminate/Support/Facades/Password.php index 65489b68645c..aa1f18e22577 100755 --- a/src/Illuminate/Support/Facades/Password.php +++ b/src/Illuminate/Support/Facades/Password.php @@ -26,7 +26,7 @@ class Password extends Facade * * @var string */ - const RESET_LINK_SENT = = PasswordStatus::RESET_LINK_SENT; + const RESET_LINK_SENT = PasswordStatus::RESET_LINK_SENT; /** * Constant representing a successfully reset password. From dbf51457bb93771d379c294a75db4aa604f1c7fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:18:09 +0100 Subject: [PATCH 03/43] Fix StyleCI --- src/Illuminate/Auth/Enums/PasswordStatus.php | 2 +- src/Illuminate/Contracts/Auth/PasswordBroker.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Auth/Enums/PasswordStatus.php b/src/Illuminate/Auth/Enums/PasswordStatus.php index 9ec7bd1b346a..3efb8da4b173 100644 --- a/src/Illuminate/Auth/Enums/PasswordStatus.php +++ b/src/Illuminate/Auth/Enums/PasswordStatus.php @@ -28,4 +28,4 @@ enum PasswordStatus: string * Constant representing a throttled reset attempt. */ case RESET_THROTTLED = 'passwords.throttled'; -} \ No newline at end of file +} diff --git a/src/Illuminate/Contracts/Auth/PasswordBroker.php b/src/Illuminate/Contracts/Auth/PasswordBroker.php index a16845652b6f..6b9e86c722c9 100644 --- a/src/Illuminate/Contracts/Auth/PasswordBroker.php +++ b/src/Illuminate/Contracts/Auth/PasswordBroker.php @@ -2,9 +2,8 @@ namespace Illuminate\Contracts\Auth; -use Illuminate\Auth\Enums\PasswordStatus; - use Closure; +use Illuminate\Auth\Enums\PasswordStatus; interface PasswordBroker { From 86733fd01743f780af8cd3fcbf99ac5d7fea6da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:19:30 +0100 Subject: [PATCH 04/43] More linting fixes --- src/Illuminate/Support/Facades/Password.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Support/Facades/Password.php b/src/Illuminate/Support/Facades/Password.php index aa1f18e22577..8b723780389a 100755 --- a/src/Illuminate/Support/Facades/Password.php +++ b/src/Illuminate/Support/Facades/Password.php @@ -33,28 +33,28 @@ class Password extends Facade * * @var string */ - const PASSWORD_RESET = PasswordStatus::PASSWORD_RESET; + const PASSWORD_RESET = PasswordStatus::PASSWORD_RESET; /** * Constant representing the user not found response. * * @var string */ - const INVALID_USER = PasswordStatus::INVALID_USER; + const INVALID_USER = PasswordStatus::INVALID_USER; /** * Constant representing an invalid token. * * @var string */ - const INVALID_TOKEN = PasswordStatus::INVALID_TOKEN; + const INVALID_TOKEN = PasswordStatus::INVALID_TOKEN; /** * Constant representing a throttled reset attempt. * * @var string */ - const RESET_THROTTLED = PasswordStatus::RESET_THROTTLED; + const RESET_THROTTLED = PasswordStatus::RESET_THROTTLED; /** * Get the registered name of the component. From 7ccc3870676fa16e390ea5638d6c2ef2217db331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:24:00 +0100 Subject: [PATCH 05/43] Fix Typo --- src/Illuminate/Queue/Worker.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Illuminate/Queue/Worker.php b/src/Illuminate/Queue/Worker.php index bddeb4be326c..39349e33a556 100644 --- a/src/Illuminate/Queue/Worker.php +++ b/src/Illuminate/Queue/Worker.php @@ -240,7 +240,7 @@ protected function registerTimeoutHandler($job, WorkerOptions $options) )); } - $this->kill(WorkerExitCode::EXIT_ERROR, $options); + $this->kill(WorkerExitCode::ERROR, $options); }, true); pcntl_alarm( @@ -312,12 +312,12 @@ protected function pauseWorker(WorkerOptions $options, $lastRestart) protected function stopIfNecessary(WorkerOptions $options, $lastRestart, $startTime = 0, $jobsProcessed = 0, $job = null) { return match (true) { - $this->shouldQuit => WorkerExitCode::EXIT_SUCCESS, + $this->shouldQuit => WorkerExitCode::SUCCESS, $this->memoryExceeded($options->memory) => WorkerExitCode::EXIT_MEMORY_LIMIT, - $this->queueShouldRestart($lastRestart) => WorkerExitCode::EXIT_SUCCESS, - $options->stopWhenEmpty && is_null($job) => WorkerExitCode::EXIT_SUCCESS, - $options->maxTime && hrtime(true) / 1e9 - $startTime >= $options->maxTime => WorkerExitCode::EXIT_SUCCESS, - $options->maxJobs && $jobsProcessed >= $options->maxJobs => WorkerExitCode::EXIT_SUCCESS, + $this->queueShouldRestart($lastRestart) => WorkerExitCode::SUCCESS, + $options->stopWhenEmpty && is_null($job) => WorkerExitCode::SUCCESS, + $options->maxTime && hrtime(true) / 1e9 - $startTime >= $options->maxTime => WorkerExitCode::SUCCESS, + $options->maxJobs && $jobsProcessed >= $options->maxJobs => WorkerExitCode::SUCCESS, default => null }; } From 2ebb039991e166f74dd1be71aa95d950e8871892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:27:53 +0100 Subject: [PATCH 06/43] Fix typo --- src/Illuminate/Console/Scheduling/ManagesFrequencies.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index 2d291942f93a..8275177f01ad 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -484,7 +484,7 @@ public function saturdays() */ public function sundays() { - return $this->days(Schedule::SUNDAYOn); + return $this->days(ScheduleOn::SUNDAY); } /** From af63fddc73989f3a644aa5cbe46c099a419a7786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:30:18 +0100 Subject: [PATCH 07/43] Add missing input --- src/Illuminate/Auth/Passwords/PasswordBroker.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Illuminate/Auth/Passwords/PasswordBroker.php b/src/Illuminate/Auth/Passwords/PasswordBroker.php index 890d4fe3f4b1..5b9ea849d93d 100755 --- a/src/Illuminate/Auth/Passwords/PasswordBroker.php +++ b/src/Illuminate/Auth/Passwords/PasswordBroker.php @@ -3,6 +3,7 @@ namespace Illuminate\Auth\Passwords; use Closure; +use Illuminate\Auth\Enums\PasswordStatus; use Illuminate\Auth\Events\PasswordResetLinkSent; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; use Illuminate\Contracts\Auth\PasswordBroker as PasswordBrokerContract; From 053c72aee9f273ccb8c6508bf775ae15cda7c1f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:43:07 +0100 Subject: [PATCH 08/43] stringify enums --- src/Illuminate/Console/Scheduling/ManagesFrequencies.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index 8275177f01ad..a1c0c74e62e7 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -13,12 +13,12 @@ trait ManagesFrequencies /** * The Cron expression representing the event's frequency. * - * @param string $expression + * @param string|\Illuminate\Console\Enums\ScheduleOn $expression * @return $this */ public function cron($expression) { - $this->expression = $expression; + $this->expression = enum_value($expression); return $this; } @@ -404,7 +404,7 @@ protected function hourBasedSchedule($minutes, $hours) */ public function weekdays() { - return $this->days(Schedule::MONDAY.'-'.Schedule::FRIDAY); + return $this->days(ScheduleOn::MONDAY->value.'-'.ScheduleOn::FRIDAY->value); } /** @@ -414,7 +414,7 @@ public function weekdays() */ public function weekends() { - return $this->days(Schedule::SATURDAY.','.Schedule::SUNDAY); + return $this->days(ScheduleOn::SATURDAY->value.','.ScheduleOn::SUNDAY->value); } /** From 7d04309f3ba49c114d65f3996b815df796ab4907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:45:00 +0100 Subject: [PATCH 09/43] Fix typo --- src/Illuminate/Queue/Worker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/Worker.php b/src/Illuminate/Queue/Worker.php index 39349e33a556..2e57a1e81877 100644 --- a/src/Illuminate/Queue/Worker.php +++ b/src/Illuminate/Queue/Worker.php @@ -313,7 +313,7 @@ protected function stopIfNecessary(WorkerOptions $options, $lastRestart, $startT { return match (true) { $this->shouldQuit => WorkerExitCode::SUCCESS, - $this->memoryExceeded($options->memory) => WorkerExitCode::EXIT_MEMORY_LIMIT, + $this->memoryExceeded($options->memory) => WorkerExitCode::MEMORY_LIMIT, $this->queueShouldRestart($lastRestart) => WorkerExitCode::SUCCESS, $options->stopWhenEmpty && is_null($job) => WorkerExitCode::SUCCESS, $options->maxTime && hrtime(true) / 1e9 - $startTime >= $options->maxTime => WorkerExitCode::SUCCESS, From eaa84c03672f2776a341bc65c2f81b6744acb6b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:58:16 +0100 Subject: [PATCH 10/43] enum_value --- src/Illuminate/Queue/Worker.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/Worker.php b/src/Illuminate/Queue/Worker.php index 2e57a1e81877..9ec87b235f39 100644 --- a/src/Illuminate/Queue/Worker.php +++ b/src/Illuminate/Queue/Worker.php @@ -781,7 +781,8 @@ public function stop($status = 0, $options = null) */ public function kill($status = 0, $options = null) { - $this->events->dispatch(new WorkerStopping(enum_value($status), $options)); + $status = enum_value($status); + $this->events->dispatch(new WorkerStopping($status, $options)); if (extension_loaded('posix')) { posix_kill(getmypid(), SIGKILL); From 8712ba952e37761f66bf7f0b0fe970ba37b41078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:05:46 +0100 Subject: [PATCH 11/43] Fix test --- tests/Queue/QueueWorkerTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Queue/QueueWorkerTest.php b/tests/Queue/QueueWorkerTest.php index 33aa4c8dc785..a6d3e218f5a5 100755 --- a/tests/Queue/QueueWorkerTest.php +++ b/tests/Queue/QueueWorkerTest.php @@ -72,7 +72,7 @@ public function testWorkerCanWorkUntilQueueIsEmpty() $this->assertTrue($secondJob->fired); - $this->assertSame(0, $status); + $this->assertSame(0, $status->value); $this->events->shouldHaveReceived('dispatch')->with(m::type(JobProcessing::class))->twice(); @@ -93,7 +93,7 @@ public function testWorkerStopsWhenMemoryExceeded() $this->assertTrue($firstJob->fired); $this->assertFalse($secondJob->fired); - $this->assertSame(12, $status); + $this->assertSame(12, $status->value); $this->events->shouldHaveReceived('dispatch')->with(m::type(JobProcessing::class))->once(); From 01468a4e72b3f6a7f3d8f825de1e7117a9769216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:38:48 +0100 Subject: [PATCH 12/43] Another enum_value --- src/Illuminate/Queue/Console/WorkCommand.php | 4 +++- src/Illuminate/Queue/Events/WorkerStopping.php | 7 +++++-- src/Illuminate/Queue/Worker.php | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Queue/Console/WorkCommand.php b/src/Illuminate/Queue/Console/WorkCommand.php index 4e3b94202f94..b76ad6014804 100644 --- a/src/Illuminate/Queue/Console/WorkCommand.php +++ b/src/Illuminate/Queue/Console/WorkCommand.php @@ -17,6 +17,7 @@ use Symfony\Component\Console\Terminal; use Throwable; +use function Illuminate\Support\enum_value; use function Termwind\terminal; #[AsCommand(name: 'queue:work')] @@ -142,12 +143,13 @@ public function handle() */ protected function runWorker($connection, $queue) { - return $this->worker + $exitCode = $this->worker ->setName($this->option('name')) ->setCache($this->cache) ->{$this->option('once') ? 'runNextJob' : 'daemon'}( $connection, $queue, $this->gatherWorkerOptions() ); + return enum_value($exitCode); } /** diff --git a/src/Illuminate/Queue/Events/WorkerStopping.php b/src/Illuminate/Queue/Events/WorkerStopping.php index 6d862bac3c25..aa258a5acbad 100644 --- a/src/Illuminate/Queue/Events/WorkerStopping.php +++ b/src/Illuminate/Queue/Events/WorkerStopping.php @@ -4,16 +4,19 @@ class WorkerStopping { + public WorkerExitCode; + /** * Create a new event instance. * - * @param int $status The worker exit status. + * @param int|\Illuminate\Queue\Enums\WorkerExitCode $status The worker exit status. * @param \Illuminate\Queue\WorkerOptions|null $workerOptions The worker options. * @return void */ public function __construct( - public $status = 0, + $status = 0, public $workerOptions = null ) { + $this->status = WorkerExitCode::from($status); } } diff --git a/src/Illuminate/Queue/Worker.php b/src/Illuminate/Queue/Worker.php index 9ec87b235f39..b0b1be0179f3 100644 --- a/src/Illuminate/Queue/Worker.php +++ b/src/Illuminate/Queue/Worker.php @@ -290,7 +290,7 @@ protected function daemonShouldRun(WorkerOptions $options, $connectionName, $que * * @param \Illuminate\Queue\WorkerOptions $options * @param int $lastRestart - * @return int|null + * @return \Illuminate\Queue\Enums\WorkerExitCode|null */ protected function pauseWorker(WorkerOptions $options, $lastRestart) { @@ -761,7 +761,7 @@ public function memoryExceeded($memoryLimit) /** * Stop listening and bail out of the script. * - * @param int $status + * @param int|\Illuminate\Queue\Enums\WorkerExitCode $status * @param WorkerOptions|null $options * @return int */ From a7fd3e9968baa97a5765d62b870bd22788753b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:40:09 +0100 Subject: [PATCH 13/43] FIx StyleCI --- src/Illuminate/Queue/Console/WorkCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Illuminate/Queue/Console/WorkCommand.php b/src/Illuminate/Queue/Console/WorkCommand.php index b76ad6014804..12b79c666c76 100644 --- a/src/Illuminate/Queue/Console/WorkCommand.php +++ b/src/Illuminate/Queue/Console/WorkCommand.php @@ -149,6 +149,7 @@ protected function runWorker($connection, $queue) ->{$this->option('once') ? 'runNextJob' : 'daemon'}( $connection, $queue, $this->gatherWorkerOptions() ); + return enum_value($exitCode); } From 52ed299f225360d2dc259d8f64b4b24eda89fd60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:42:17 +0100 Subject: [PATCH 14/43] Fix syntax error --- src/Illuminate/Queue/Events/WorkerStopping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/Events/WorkerStopping.php b/src/Illuminate/Queue/Events/WorkerStopping.php index aa258a5acbad..76a78580e056 100644 --- a/src/Illuminate/Queue/Events/WorkerStopping.php +++ b/src/Illuminate/Queue/Events/WorkerStopping.php @@ -4,7 +4,7 @@ class WorkerStopping { - public WorkerExitCode; + public WorkerExitCode $status; /** * Create a new event instance. From a248b4e428be79253ff40592ac3d2d6e8c5dddef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:46:45 +0100 Subject: [PATCH 15/43] Add missing import --- src/Illuminate/Queue/Events/WorkerStopping.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Illuminate/Queue/Events/WorkerStopping.php b/src/Illuminate/Queue/Events/WorkerStopping.php index 76a78580e056..b5d608615cd8 100644 --- a/src/Illuminate/Queue/Events/WorkerStopping.php +++ b/src/Illuminate/Queue/Events/WorkerStopping.php @@ -2,6 +2,8 @@ namespace Illuminate\Queue\Events; +use \Illuminate\Queue\Enums\WorkerExitCode; + class WorkerStopping { public WorkerExitCode $status; From 27da74a282490c2d9a7c67bb87c90fa0befb4447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:49:04 +0100 Subject: [PATCH 16/43] Fix StyleCI --- src/Illuminate/Queue/Events/WorkerStopping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/Events/WorkerStopping.php b/src/Illuminate/Queue/Events/WorkerStopping.php index b5d608615cd8..7d9325401ad0 100644 --- a/src/Illuminate/Queue/Events/WorkerStopping.php +++ b/src/Illuminate/Queue/Events/WorkerStopping.php @@ -2,7 +2,7 @@ namespace Illuminate\Queue\Events; -use \Illuminate\Queue\Enums\WorkerExitCode; +use Illuminate\Queue\Enums\WorkerExitCode; class WorkerStopping { From 201a5e278630f2ecb325f6b01193a288e4b1f4ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:53:19 +0100 Subject: [PATCH 17/43] Only wrap in enum if it is none --- src/Illuminate/Queue/Events/WorkerStopping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/Events/WorkerStopping.php b/src/Illuminate/Queue/Events/WorkerStopping.php index 7d9325401ad0..edfa001a5565 100644 --- a/src/Illuminate/Queue/Events/WorkerStopping.php +++ b/src/Illuminate/Queue/Events/WorkerStopping.php @@ -19,6 +19,6 @@ public function __construct( $status = 0, public $workerOptions = null ) { - $this->status = WorkerExitCode::from($status); + $this->status = $status instanceof WorkerExitCode ? $status : WorkerExitCode::from($status); } } From a8eca1bd6c2934d341630ed70225757b9b18587a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 23:28:39 +0100 Subject: [PATCH 18/43] Remove worker-related enum as per https://github.com/laravel/framework/pull/53961#issuecomment-2552043551 Co-authored by: Taylor Otwell <taylor@laravel.com> --- src/Illuminate/Queue/Console/WorkCommand.php | 4 +- src/Illuminate/Queue/Enums/WorkerExitCode.php | 10 ----- .../Queue/Events/WorkerStopping.php | 6 +-- src/Illuminate/Queue/Worker.php | 37 +++++++------------ tests/Queue/QueueWorkerTest.php | 4 +- 5 files changed, 19 insertions(+), 42 deletions(-) delete mode 100644 src/Illuminate/Queue/Enums/WorkerExitCode.php diff --git a/src/Illuminate/Queue/Console/WorkCommand.php b/src/Illuminate/Queue/Console/WorkCommand.php index 12b79c666c76..7565dfdb844a 100644 --- a/src/Illuminate/Queue/Console/WorkCommand.php +++ b/src/Illuminate/Queue/Console/WorkCommand.php @@ -143,14 +143,12 @@ public function handle() */ protected function runWorker($connection, $queue) { - $exitCode = $this->worker + return $this->worker ->setName($this->option('name')) ->setCache($this->cache) ->{$this->option('once') ? 'runNextJob' : 'daemon'}( $connection, $queue, $this->gatherWorkerOptions() ); - - return enum_value($exitCode); } /** diff --git a/src/Illuminate/Queue/Enums/WorkerExitCode.php b/src/Illuminate/Queue/Enums/WorkerExitCode.php deleted file mode 100644 index 3d19f178444e..000000000000 --- a/src/Illuminate/Queue/Enums/WorkerExitCode.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -namespace Illuminate\Queue\Enums; - -enum WorkerExitCode: int -{ - case SUCCESS = 0; - case ERROR = 1; - case MEMORY_LIMIT = 12; -} diff --git a/src/Illuminate/Queue/Events/WorkerStopping.php b/src/Illuminate/Queue/Events/WorkerStopping.php index edfa001a5565..6e45a2b6edb0 100644 --- a/src/Illuminate/Queue/Events/WorkerStopping.php +++ b/src/Illuminate/Queue/Events/WorkerStopping.php @@ -2,8 +2,6 @@ namespace Illuminate\Queue\Events; -use Illuminate\Queue\Enums\WorkerExitCode; - class WorkerStopping { public WorkerExitCode $status; @@ -11,7 +9,7 @@ class WorkerStopping /** * Create a new event instance. * - * @param int|\Illuminate\Queue\Enums\WorkerExitCode $status The worker exit status. + * @param int $status The worker exit status. * @param \Illuminate\Queue\WorkerOptions|null $workerOptions The worker options. * @return void */ @@ -19,6 +17,6 @@ public function __construct( $status = 0, public $workerOptions = null ) { - $this->status = $status instanceof WorkerExitCode ? $status : WorkerExitCode::from($status); + $this->status = $status; } } diff --git a/src/Illuminate/Queue/Worker.php b/src/Illuminate/Queue/Worker.php index b0b1be0179f3..c63f91f914c6 100644 --- a/src/Illuminate/Queue/Worker.php +++ b/src/Illuminate/Queue/Worker.php @@ -7,7 +7,6 @@ use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Queue\Factory as QueueManager; use Illuminate\Database\DetectsLostConnections; -use Illuminate\Queue\Enums\WorkerExitCode; use Illuminate\Queue\Events\JobAttempted; use Illuminate\Queue\Events\JobExceptionOccurred; use Illuminate\Queue\Events\JobPopped; @@ -21,20 +20,13 @@ use Illuminate\Support\Carbon; use Throwable; -use function Illuminate\Support\enum_value; - class Worker { use DetectsLostConnections; - /** @deprecated Use \Illuminate\Queue\Enums\WorkerExitCode::SUCCESS instead */ - const EXIT_SUCCESS = WorkerExitCode::SUCCESS; - - /** @deprecated Use \Illuminate\Queue\Enums\WorkerExitCode::ERROR instead */ - const EXIT_ERROR = WorkerExitCode::ERROR; - - /** @deprecated Use \Illuminate\Queue\Enums\WorkerExitCode::MEMORY_LIMIT instead */ - const EXIT_MEMORY_LIMIT = WorkerExitCode::MEMORY_LIMIT; + const EXIT_SUCCESS = 0; + const EXIT_ERROR = 1; + const EXIT_MEMORY_LIMIT = 12; /** * The name of the worker. @@ -240,7 +232,7 @@ protected function registerTimeoutHandler($job, WorkerOptions $options) )); } - $this->kill(WorkerExitCode::ERROR, $options); + $this->kill(self::EXIT_ERROR, $options); }, true); pcntl_alarm( @@ -290,7 +282,7 @@ protected function daemonShouldRun(WorkerOptions $options, $connectionName, $que * * @param \Illuminate\Queue\WorkerOptions $options * @param int $lastRestart - * @return \Illuminate\Queue\Enums\WorkerExitCode|null + * @return int|null */ protected function pauseWorker(WorkerOptions $options, $lastRestart) { @@ -307,17 +299,17 @@ protected function pauseWorker(WorkerOptions $options, $lastRestart) * @param int $startTime * @param int $jobsProcessed * @param mixed $job - * @return \Illuminate\Queue\Enums\WorkerExitCode|null + * @return int|null */ protected function stopIfNecessary(WorkerOptions $options, $lastRestart, $startTime = 0, $jobsProcessed = 0, $job = null) { return match (true) { - $this->shouldQuit => WorkerExitCode::SUCCESS, - $this->memoryExceeded($options->memory) => WorkerExitCode::MEMORY_LIMIT, - $this->queueShouldRestart($lastRestart) => WorkerExitCode::SUCCESS, - $options->stopWhenEmpty && is_null($job) => WorkerExitCode::SUCCESS, - $options->maxTime && hrtime(true) / 1e9 - $startTime >= $options->maxTime => WorkerExitCode::SUCCESS, - $options->maxJobs && $jobsProcessed >= $options->maxJobs => WorkerExitCode::SUCCESS, + $this->shouldQuit => self::EXIT_SUCCESS, + $this->memoryExceeded($options->memory) => self::EXIT_MEMORY_LIMIT, + $this->queueShouldRestart($lastRestart) => self::EXIT_SUCCESS, + $options->stopWhenEmpty && is_null($job) => self::EXIT_SUCCESS, + $options->maxTime && hrtime(true) / 1e9 - $startTime >= $options->maxTime => self::EXIT_SUCCESS, + $options->maxJobs && $jobsProcessed >= $options->maxJobs => self::EXIT_SUCCESS, default => null }; } @@ -761,7 +753,7 @@ public function memoryExceeded($memoryLimit) /** * Stop listening and bail out of the script. * - * @param int|\Illuminate\Queue\Enums\WorkerExitCode $status + * @param int $status * @param WorkerOptions|null $options * @return int */ @@ -775,13 +767,12 @@ public function stop($status = 0, $options = null) /** * Kill the process. * - * @param \Illuminate\Queue\Enums\WorkerExitCode|int $status + * @param int $status * @param \Illuminate\Queue\WorkerOptions|null $options * @return never */ public function kill($status = 0, $options = null) { - $status = enum_value($status); $this->events->dispatch(new WorkerStopping($status, $options)); if (extension_loaded('posix')) { diff --git a/tests/Queue/QueueWorkerTest.php b/tests/Queue/QueueWorkerTest.php index a6d3e218f5a5..33aa4c8dc785 100755 --- a/tests/Queue/QueueWorkerTest.php +++ b/tests/Queue/QueueWorkerTest.php @@ -72,7 +72,7 @@ public function testWorkerCanWorkUntilQueueIsEmpty() $this->assertTrue($secondJob->fired); - $this->assertSame(0, $status->value); + $this->assertSame(0, $status); $this->events->shouldHaveReceived('dispatch')->with(m::type(JobProcessing::class))->twice(); @@ -93,7 +93,7 @@ public function testWorkerStopsWhenMemoryExceeded() $this->assertTrue($firstJob->fired); $this->assertFalse($secondJob->fired); - $this->assertSame(12, $status->value); + $this->assertSame(12, $status); $this->events->shouldHaveReceived('dispatch')->with(m::type(JobProcessing::class))->once(); From 935efcc71cdb37fde4da68e2c70b8815f4f2c9fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 23:38:40 +0100 Subject: [PATCH 19/43] Change casing for enum cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Džuris <juris@glaive.pro> --- src/Illuminate/Auth/Enums/PasswordStatus.php | 10 +++++----- src/Illuminate/Auth/Passwords/PasswordBroker.php | 14 +++++++------- src/Illuminate/Contracts/Auth/PasswordBroker.php | 10 +++++----- src/Illuminate/Support/Facades/Password.php | 10 +++++----- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Illuminate/Auth/Enums/PasswordStatus.php b/src/Illuminate/Auth/Enums/PasswordStatus.php index 3efb8da4b173..bb76407f8fa6 100644 --- a/src/Illuminate/Auth/Enums/PasswordStatus.php +++ b/src/Illuminate/Auth/Enums/PasswordStatus.php @@ -7,25 +7,25 @@ enum PasswordStatus: string /** * Constant representing a successfully sent reminder. */ - case RESET_LINK_SENT = 'passwords.sent'; + case ResetLinkSent = 'passwords.sent'; /** * Constant representing a successfully reset password. */ - case PASSWORD_RESET = 'passwords.reset'; + case PasswordReset = 'passwords.reset'; /** * Constant representing the user not found response. */ - case INVALID_USER = 'passwords.user'; + case InvalidUser = 'passwords.user'; /** * Constant representing an invalid token. */ - case INVALID_TOKEN = 'passwords.token'; + case InvalidToken = 'passwords.token'; /** * Constant representing a throttled reset attempt. */ - case RESET_THROTTLED = 'passwords.throttled'; + case ResetThrottled = 'passwords.throttled'; } diff --git a/src/Illuminate/Auth/Passwords/PasswordBroker.php b/src/Illuminate/Auth/Passwords/PasswordBroker.php index 5b9ea849d93d..5e7af490cd26 100755 --- a/src/Illuminate/Auth/Passwords/PasswordBroker.php +++ b/src/Illuminate/Auth/Passwords/PasswordBroker.php @@ -65,17 +65,17 @@ public function sendResetLink(#[\SensitiveParameter] array $credentials, ?Closur $user = $this->getUser($credentials); if (is_null($user)) { - return PasswordStatus::INVALID_USER; + return PasswordStatus::InvalidUser; } if ($this->tokens->recentlyCreatedToken($user)) { - return PasswordStatus::RESET_THROTTLED; + return PasswordStatus::ResetThrottled; } $token = $this->tokens->create($user); if ($callback) { - return $callback($user, $token) ?? PasswordStatus::RESET_LINK_SENT; + return $callback($user, $token) ?? PasswordStatus::ResetLinkSent; } // Once we have the reset token, we are ready to send the message out to this @@ -85,7 +85,7 @@ public function sendResetLink(#[\SensitiveParameter] array $credentials, ?Closur $this->events?->dispatch(new PasswordResetLinkSent($user)); - return PasswordStatus::RESET_LINK_SENT; + return PasswordStatus::ResetLinkSent; } /** @@ -115,7 +115,7 @@ public function reset(#[\SensitiveParameter] array $credentials, Closure $callba $this->tokens->delete($user); - return PasswordStatus::PASSWORD_RESET; + return PasswordStatus::PasswordReset; } /** @@ -127,11 +127,11 @@ public function reset(#[\SensitiveParameter] array $credentials, Closure $callba protected function validateReset(#[\SensitiveParameter] array $credentials) { if (is_null($user = $this->getUser($credentials))) { - return PasswordStatus::INVALID_USER; + return PasswordStatus::InvalidUser; } if (! $this->tokens->exists($user, $credentials['token'])) { - return PasswordStatus::INVALID_TOKEN; + return PasswordStatus::InvalidToken; } return $user; diff --git a/src/Illuminate/Contracts/Auth/PasswordBroker.php b/src/Illuminate/Contracts/Auth/PasswordBroker.php index 6b9e86c722c9..1c9d76cca41d 100644 --- a/src/Illuminate/Contracts/Auth/PasswordBroker.php +++ b/src/Illuminate/Contracts/Auth/PasswordBroker.php @@ -12,35 +12,35 @@ interface PasswordBroker * * @var string */ - const RESET_LINK_SENT = PasswordStatus::RESET_LINK_SENT; + const RESET_LINK_SENT = PasswordStatus::ResetLinkSent; /** * Constant representing a successfully reset password. * * @var string */ - const PASSWORD_RESET = PasswordStatus::PASSWORD_RESET; + const PASSWORD_RESET = PasswordStatus::PasswordReset; /** * Constant representing the user not found response. * * @var string */ - const INVALID_USER = PasswordStatus::INVALID_USER; + const INVALID_USER = PasswordStatus::InvalidUser; /** * Constant representing an invalid token. * * @var string */ - const INVALID_TOKEN = PasswordStatus::INVALID_TOKEN; + const INVALID_TOKEN = PasswordStatus::InvalidToken; /** * Constant representing a throttled reset attempt. * * @var string */ - const RESET_THROTTLED = PasswordStatus::RESET_THROTTLED; + const RESET_THROTTLED = PasswordStatus::ResetThrottled; /** * Send a password reset link to a user. diff --git a/src/Illuminate/Support/Facades/Password.php b/src/Illuminate/Support/Facades/Password.php index 8b723780389a..3ea4081a5761 100755 --- a/src/Illuminate/Support/Facades/Password.php +++ b/src/Illuminate/Support/Facades/Password.php @@ -26,35 +26,35 @@ class Password extends Facade * * @var string */ - const RESET_LINK_SENT = PasswordStatus::RESET_LINK_SENT; + const RESET_LINK_SENT = PasswordStatus::ResetLinkSent; /** * Constant representing a successfully reset password. * * @var string */ - const PASSWORD_RESET = PasswordStatus::PASSWORD_RESET; + const PASSWORD_RESET = PasswordStatus::PasswordReset; /** * Constant representing the user not found response. * * @var string */ - const INVALID_USER = PasswordStatus::INVALID_USER; + const INVALID_USER = PasswordStatus::InvalidUser; /** * Constant representing an invalid token. * * @var string */ - const INVALID_TOKEN = PasswordStatus::INVALID_TOKEN; + const INVALID_TOKEN = PasswordStatus::InvalidToken; /** * Constant representing a throttled reset attempt. * * @var string */ - const RESET_THROTTLED = PasswordStatus::RESET_THROTTLED; + const RESET_THROTTLED = PasswordStatus::ResetThrottled; /** * Get the registered name of the component. From 31cc1b38961b3b25f6e8b2a5b48bdd2126057d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 23:41:18 +0100 Subject: [PATCH 20/43] Remove unused function Follow-up to a8eca1b Co-authored-by: Taylor Otwell <taylor@laravel.com> --- src/Illuminate/Queue/Console/WorkCommand.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Illuminate/Queue/Console/WorkCommand.php b/src/Illuminate/Queue/Console/WorkCommand.php index 7565dfdb844a..4e3b94202f94 100644 --- a/src/Illuminate/Queue/Console/WorkCommand.php +++ b/src/Illuminate/Queue/Console/WorkCommand.php @@ -17,7 +17,6 @@ use Symfony\Component\Console\Terminal; use Throwable; -use function Illuminate\Support\enum_value; use function Termwind\terminal; #[AsCommand(name: 'queue:work')] From 7f0bda78c532c29bb5b739809233ed1ee1541ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 23:46:00 +0100 Subject: [PATCH 21/43] Revert to promoted property Follow-up to a8eca1b --- src/Illuminate/Queue/Events/WorkerStopping.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Illuminate/Queue/Events/WorkerStopping.php b/src/Illuminate/Queue/Events/WorkerStopping.php index 6e45a2b6edb0..03b0a41b04de 100644 --- a/src/Illuminate/Queue/Events/WorkerStopping.php +++ b/src/Illuminate/Queue/Events/WorkerStopping.php @@ -4,8 +4,6 @@ class WorkerStopping { - public WorkerExitCode $status; - /** * Create a new event instance. * @@ -14,7 +12,7 @@ class WorkerStopping * @return void */ public function __construct( - $status = 0, + public $status = 0, public $workerOptions = null ) { $this->status = $status; From f49854ad933b02268816d64f74c6ffa866ff9563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 23:47:16 +0100 Subject: [PATCH 22/43] Remove enum_value to the proper location --- 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 a1c0c74e62e7..6e41c3271a7d 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -13,7 +13,7 @@ trait ManagesFrequencies /** * The Cron expression representing the event's frequency. * - * @param string|\Illuminate\Console\Enums\ScheduleOn $expression + * @param string $expression * @return $this */ public function cron($expression) @@ -665,7 +665,7 @@ protected function spliceIntoPosition($position, $value) { $segments = preg_split("/\s+/", $this->expression); - $segments[$position - 1] = $value; + $segments[$position - 1] = enum_value($value); return $this->cron(implode(' ', $segments)); } From 4c17dcdab589755c32b0f7f411a9b663bae39ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 18 Dec 2024 23:54:12 +0100 Subject: [PATCH 23/43] Cron expression is not an enum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to f49854a Co-Authored-By: rodrigopedra <rodrigo.pedra@gmail.com> Co-authored-by: Džuris <juris@glaive.pro> --- src/Illuminate/Console/Scheduling/ManagesFrequencies.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index 6e41c3271a7d..82e4b022d355 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -18,7 +18,7 @@ trait ManagesFrequencies */ public function cron($expression) { - $this->expression = enum_value($expression); + $this->expression = $expression; return $this; } From f44b034bd4fea0687e701f6d6a12307129d40757 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 08:15:29 +0100 Subject: [PATCH 24/43] Also make ScheduleOn cases PascalCase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to 935efcc Co-Authored-By: rodrigopedra <rodrigo.pedra@gmail.com> Co-authored-by: Džuris <juris@glaive.pro> --- src/Illuminate/Console/Enums/ScheduleOn.php | 14 +++++++------- src/Illuminate/Console/Scheduling/Schedule.php | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Illuminate/Console/Enums/ScheduleOn.php b/src/Illuminate/Console/Enums/ScheduleOn.php index c5a9c7029414..e53e07aae39d 100644 --- a/src/Illuminate/Console/Enums/ScheduleOn.php +++ b/src/Illuminate/Console/Enums/ScheduleOn.php @@ -4,17 +4,17 @@ enum ScheduleOn: int { - case SUNDAY = 0; + case Sunday = 0; - case MONDAY = 1; + case Monday = 1; - case TUESDAY = 2; + case Tuesday = 2; - case WEDNESDAY = 3; + case Wednesday = 3; - case THURSDAY = 4; + case Thursday = 4; - case FRIDAY = 5; + case Friday = 5; - case SATURDAY = 6; + case Saturday = 6; } diff --git a/src/Illuminate/Console/Scheduling/Schedule.php b/src/Illuminate/Console/Scheduling/Schedule.php index 80c8d4596fb2..828a18163028 100644 --- a/src/Illuminate/Console/Scheduling/Schedule.php +++ b/src/Illuminate/Console/Scheduling/Schedule.php @@ -30,25 +30,25 @@ class Schedule } /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::SUNDAY instead */ - const SUNDAY = ScheduleOn::SUNDAY; + const SUNDAY = ScheduleOn::Sunday; /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::MONDAY instead */ - const MONDAY = ScheduleOn::MONDAY; + const MONDAY = ScheduleOn::Monday; /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::TUESDAY instead */ - const TUESDAY = ScheduleOn::TUESDAY; + const TUESDAY = ScheduleOn::Tuesday; /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::WEDNESDAY instead */ - const WEDNESDAY = ScheduleOn::WEDNESDAY; + const WEDNESDAY = ScheduleOn::Wednesday; /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::THURSDAY instead */ - const THURSDAY = ScheduleOn::THURSDAY; + const THURSDAY = ScheduleOn::Thursday; /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::FRIDAY instead */ - const FRIDAY = ScheduleOn::FRIDAY; + const FRIDAY = ScheduleOn::Friday; /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::SATURDAY instead */ - const SATURDAY = ScheduleOn::SATURDAY; + const SATURDAY = ScheduleOn::Saturday; /** * All of the events on the schedule. From e0656565d764619de413fdf34ac45160cf13a7dd 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 08:17:55 +0100 Subject: [PATCH 25/43] More casing Follow-up to f44b034 --- .../Console/Scheduling/ManagesFrequencies.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index 82e4b022d355..2aceed78cff6 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -404,7 +404,7 @@ protected function hourBasedSchedule($minutes, $hours) */ public function weekdays() { - return $this->days(ScheduleOn::MONDAY->value.'-'.ScheduleOn::FRIDAY->value); + return $this->days(ScheduleOn::Monday->value.'-'.ScheduleOn::Friday->value); } /** @@ -414,7 +414,7 @@ public function weekdays() */ public function weekends() { - return $this->days(ScheduleOn::SATURDAY->value.','.ScheduleOn::SUNDAY->value); + return $this->days(ScheduleOn::Saturday->value.','.ScheduleOn::Sunday->value); } /** @@ -424,7 +424,7 @@ public function weekends() */ public function mondays() { - return $this->days(ScheduleOn::MONDAY); + return $this->days(ScheduleOn::Monday); } /** @@ -434,7 +434,7 @@ public function mondays() */ public function tuesdays() { - return $this->days(ScheduleOn::TUESDAY); + return $this->days(ScheduleOn::Tuesday); } /** @@ -444,7 +444,7 @@ public function tuesdays() */ public function wednesdays() { - return $this->days(ScheduleOn::WEDNESDAY); + return $this->days(ScheduleOn::Wednesday); } /** @@ -454,7 +454,7 @@ public function wednesdays() */ public function thursdays() { - return $this->days(ScheduleOn::THURSDAY); + return $this->days(ScheduleOn::Thursday); } /** @@ -464,7 +464,7 @@ public function thursdays() */ public function fridays() { - return $this->days(ScheduleOn::FRIDAY); + return $this->days(ScheduleOn::Friday); } /** @@ -474,7 +474,7 @@ public function fridays() */ public function saturdays() { - return $this->days(ScheduleOn::SATURDAY); + return $this->days(ScheduleOn::Saturday); } /** @@ -484,7 +484,7 @@ public function saturdays() */ public function sundays() { - return $this->days(ScheduleOn::SUNDAY); + return $this->days(ScheduleOn::Sunday); } /** From a0a2ee923ad055359abca36433ab81c540b49200 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 08:19:50 +0100 Subject: [PATCH 26/43] Remove manually setting argument that has been reverted to a promited property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to 7f0bda7 Co-Authored-By: rodrigopedra <rodrigo.pedra@gmail.com> Co-authored-by: Džuris <juris@glaive.pro> --- src/Illuminate/Queue/Events/WorkerStopping.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Illuminate/Queue/Events/WorkerStopping.php b/src/Illuminate/Queue/Events/WorkerStopping.php index 03b0a41b04de..6d862bac3c25 100644 --- a/src/Illuminate/Queue/Events/WorkerStopping.php +++ b/src/Illuminate/Queue/Events/WorkerStopping.php @@ -15,6 +15,5 @@ public function __construct( public $status = 0, public $workerOptions = null ) { - $this->status = $status; } } From 41a889a6acfc5eb255df6a20f066bf0732a917fd 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 08:34:58 +0100 Subject: [PATCH 27/43] Deprecation messages and correct PHPDoc types Follow-up to 3a251cf9546bf3d050904aba200ee54e1aa9ee3c --- src/Illuminate/Contracts/Auth/PasswordBroker.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Contracts/Auth/PasswordBroker.php b/src/Illuminate/Contracts/Auth/PasswordBroker.php index 1c9d76cca41d..f2a46870ca28 100644 --- a/src/Illuminate/Contracts/Auth/PasswordBroker.php +++ b/src/Illuminate/Contracts/Auth/PasswordBroker.php @@ -10,35 +10,40 @@ interface PasswordBroker /** * Constant representing a successfully sent reminder. * - * @var string + * @var \Illuminate\Auth\Enums\PasswordStatus + * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::ResetLinkSent instead */ const RESET_LINK_SENT = PasswordStatus::ResetLinkSent; /** * Constant representing a successfully reset password. * - * @var string + * @var \Illuminate\Auth\Enums\PasswordStatus + * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::PasswordReset instead */ const PASSWORD_RESET = PasswordStatus::PasswordReset; /** * Constant representing the user not found response. * - * @var string + * @var \Illuminate\Auth\Enums\PasswordStatus + * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::InvalidUser instead */ const INVALID_USER = PasswordStatus::InvalidUser; /** * Constant representing an invalid token. * - * @var string + * @var \Illuminate\Auth\Enums\PasswordStatus + * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::InvalidToken instead */ const INVALID_TOKEN = PasswordStatus::InvalidToken; /** * Constant representing a throttled reset attempt. * - * @var string + * @var \Illuminate\Auth\Enums\PasswordStatus + * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::ResetThrottled instead */ const RESET_THROTTLED = PasswordStatus::ResetThrottled; From 1b19e79f1fc8f7aff081f5c29fe803a327d204a9 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 08:43:40 +0100 Subject: [PATCH 28/43] Improve type-hint for days --- 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 2aceed78cff6..ec20fab4c916 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -502,7 +502,7 @@ public function weekly() /** * Schedule the event to run weekly on a given day and time. * - * @param array|mixed $dayOfWeek + * @param array|int|int[]|\|\Illuminate\Console\Enums\ScheduleOn|Illuminate\Console\Enums\ScheduleOn|mixed $dayOfWeek * @param string $time * @return $this */ @@ -629,7 +629,7 @@ public function yearlyOn($month = 1, $dayOfMonth = 1, $time = '0:0') /** * Set the days of the week the command should run on. * - * @param array|mixed $days + * @param array|\Illuminate\Console\Enums\ScheduleOn|Illuminate\Console\Enums\ScheduleOn[]|int|int[]|string|string[]|mixed $days * @return $this */ public function days($days) From 8ce6e6ca6c9ccd1de7920ea81a8e55ef4febfe92 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 08:53:18 +0100 Subject: [PATCH 29/43] More PHPDocs --- .../Console/Scheduling/ManagesFrequencies.php | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index ec20fab4c916..4aa27799b3d9 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -253,7 +253,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> $offset * @return $this */ public function hourlyAt($offset) @@ -356,8 +356,8 @@ public function dailyAt($time) /** * Schedule the event to run twice daily. * - * @param int $first - * @param int $second + * @param int $first<0, 24> + * @param int $second<0, 24> * @return $this */ public function twiceDaily($first = 1, $second = 13) @@ -368,9 +368,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 $first<0, 24> + * @param int $second<0, 24> + * @param int $offset<0, 59> * @return $this */ public function twiceDailyAt($first = 1, $second = 13, $offset = 0) @@ -383,8 +383,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) @@ -502,7 +502,7 @@ public function weekly() /** * Schedule the event to run weekly on a given day and time. * - * @param array|int|int[]|\|\Illuminate\Console\Enums\ScheduleOn|Illuminate\Console\Enums\ScheduleOn|mixed $dayOfWeek + * @param array|int|int[]|\|\Illuminate\Console\Enums\ScheduleOn|Illuminate\Console\Enums\ScheduleOn[]|mixed $dayOfWeek * @param string $time * @return $this */ @@ -528,7 +528,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 */ @@ -542,8 +542,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 */ @@ -613,8 +613,8 @@ 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, 12> $month + * @param int<0, 31>|string $dayOfMonth * @param string $time * @return $this */ From f384afdb569c5fff0c606c98a76e5682ecb9cb9f 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 08:54:09 +0100 Subject: [PATCH 30/43] Fix StyleCI https://github.styleci.io/analyses/KoMvmA --- src/Illuminate/Contracts/Auth/PasswordBroker.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Illuminate/Contracts/Auth/PasswordBroker.php b/src/Illuminate/Contracts/Auth/PasswordBroker.php index f2a46870ca28..7f5e994be1bf 100644 --- a/src/Illuminate/Contracts/Auth/PasswordBroker.php +++ b/src/Illuminate/Contracts/Auth/PasswordBroker.php @@ -11,6 +11,7 @@ interface PasswordBroker * Constant representing a successfully sent reminder. * * @var \Illuminate\Auth\Enums\PasswordStatus + * * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::ResetLinkSent instead */ const RESET_LINK_SENT = PasswordStatus::ResetLinkSent; @@ -19,6 +20,7 @@ interface PasswordBroker * Constant representing a successfully reset password. * * @var \Illuminate\Auth\Enums\PasswordStatus + * * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::PasswordReset instead */ const PASSWORD_RESET = PasswordStatus::PasswordReset; @@ -27,6 +29,7 @@ interface PasswordBroker * Constant representing the user not found response. * * @var \Illuminate\Auth\Enums\PasswordStatus + * * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::InvalidUser instead */ const INVALID_USER = PasswordStatus::InvalidUser; @@ -35,6 +38,7 @@ interface PasswordBroker * Constant representing an invalid token. * * @var \Illuminate\Auth\Enums\PasswordStatus + * * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::InvalidToken instead */ const INVALID_TOKEN = PasswordStatus::InvalidToken; @@ -43,6 +47,7 @@ interface PasswordBroker * Constant representing a throttled reset attempt. * * @var \Illuminate\Auth\Enums\PasswordStatus + * * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::ResetThrottled instead */ const RESET_THROTTLED = PasswordStatus::ResetThrottled; From c66a58128a05c6acc0a456e38c4650ee9077e4c1 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 08:56:25 +0100 Subject: [PATCH 31/43] More StyleCI https://github.styleci.io/analyses/xgyApB --- .../Console/Scheduling/ManagesFrequencies.php | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index 4aa27799b3d9..b4ca7c8924b0 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -253,7 +253,7 @@ public function hourly() /** * Schedule the event to run hourly at a given offset in the hour. * - * @param array|string|int<0, 24> $offset + * @param array|string|int<0, 24> $offset * @return $this */ public function hourlyAt($offset) @@ -356,8 +356,8 @@ public function dailyAt($time) /** * Schedule the event to run twice daily. * - * @param int $first<0, 24> - * @param int $second<0, 24> + * @param int $first<0, 24> + * @param int $second<0, 24> * @return $this */ public function twiceDaily($first = 1, $second = 13) @@ -368,9 +368,9 @@ public function twiceDaily($first = 1, $second = 13) /** * Schedule the event to run twice daily at a given offset. * - * @param int $first<0, 24> - * @param int $second<0, 24> - * @param int $offset<0, 59> + * @param int $first<0, 24> + * @param int $second<0, 24> + * @param int $offset<0, 59> * @return $this */ public function twiceDailyAt($first = 1, $second = 13, $offset = 0) @@ -383,8 +383,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<0, 59> $minutes - * @param array|string|int<0, 24> $hours + * @param array|string|int<0, 59> $minutes + * @param array|string|int<0, 24> $hours * @return $this */ protected function hourBasedSchedule($minutes, $hours) @@ -528,7 +528,7 @@ public function monthly() /** * Schedule the event to run monthly on a given day and time. * - * @param int<0, 31> $dayOfMonth + * @param int<0, 31> $dayOfMonth * @param string $time * @return $this */ @@ -542,8 +542,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 */ @@ -614,7 +614,7 @@ public function yearly() * Schedule the event to run yearly on a given month, day, and time. * * @param int<0, 12> $month - * @param int<0, 31>|string $dayOfMonth + * @param int<0, 31>|string $dayOfMonth * @param string $time * @return $this */ From 0e26932c771e2d02a4784009e35bb578f1e001f6 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 08:56:53 +0100 Subject: [PATCH 32/43] Remove accidentally added spacing https://github.styleci.io/analyses/xgyApB --- src/Illuminate/Contracts/Auth/PasswordBroker.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Contracts/Auth/PasswordBroker.php b/src/Illuminate/Contracts/Auth/PasswordBroker.php index 7f5e994be1bf..b6b581181b0c 100644 --- a/src/Illuminate/Contracts/Auth/PasswordBroker.php +++ b/src/Illuminate/Contracts/Auth/PasswordBroker.php @@ -11,7 +11,7 @@ interface PasswordBroker * Constant representing a successfully sent reminder. * * @var \Illuminate\Auth\Enums\PasswordStatus - * + * * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::ResetLinkSent instead */ const RESET_LINK_SENT = PasswordStatus::ResetLinkSent; @@ -29,7 +29,7 @@ interface PasswordBroker * Constant representing the user not found response. * * @var \Illuminate\Auth\Enums\PasswordStatus - * + * * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::InvalidUser instead */ const INVALID_USER = PasswordStatus::InvalidUser; @@ -38,7 +38,7 @@ interface PasswordBroker * Constant representing an invalid token. * * @var \Illuminate\Auth\Enums\PasswordStatus - * + * * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::InvalidToken instead */ const INVALID_TOKEN = PasswordStatus::InvalidToken; @@ -47,7 +47,7 @@ interface PasswordBroker * Constant representing a throttled reset attempt. * * @var \Illuminate\Auth\Enums\PasswordStatus - * + * * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::ResetThrottled instead */ const RESET_THROTTLED = PasswordStatus::ResetThrottled; From 76cc1d6a1e53382991c1b976c18cb081abbfed13 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 09:00:41 +0100 Subject: [PATCH 33/43] StyleCI leftovers Follow-up to 0e26932 and f384afdb569c5fff0c606c98a76e5682ecb9cb9f https://github.styleci.io/analyses/O3wGZ0 Co-authored-by: StyleCI Bot <bot@styleci.io> --- src/Illuminate/Contracts/Auth/PasswordBroker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Contracts/Auth/PasswordBroker.php b/src/Illuminate/Contracts/Auth/PasswordBroker.php index b6b581181b0c..8500360a6fab 100644 --- a/src/Illuminate/Contracts/Auth/PasswordBroker.php +++ b/src/Illuminate/Contracts/Auth/PasswordBroker.php @@ -20,7 +20,7 @@ interface PasswordBroker * Constant representing a successfully reset password. * * @var \Illuminate\Auth\Enums\PasswordStatus - * + * * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::PasswordReset instead */ const PASSWORD_RESET = PasswordStatus::PasswordReset; From ddfacc2d20d4d1792dd52c635fff6867c167620f 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 11:26:32 +0100 Subject: [PATCH 34/43] Months are 1-indexed --- src/Illuminate/Console/Scheduling/ManagesFrequencies.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index b4ca7c8924b0..dcaa46b48d31 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -613,7 +613,7 @@ public function yearly() /** * Schedule the event to run yearly on a given month, day, and time. * - * @param int<0, 12> $month + * @param int<1, 12> $month * @param int<0, 31>|string $dayOfMonth * @param string $time * @return $this From 2ddbab165e3af5581d59c99505993cdf46e455a4 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 15:43:29 +0100 Subject: [PATCH 35/43] Add type-hints to respective facade --- src/Illuminate/Support/Facades/Schedule.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Illuminate/Support/Facades/Schedule.php b/src/Illuminate/Support/Facades/Schedule.php index 3c22681f5fca..e461f4475681 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, 24> $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, 24> $first = 1, int<0, 24> $second = 13) + * @method static \Illuminate\Console\Scheduling\PendingEventAttributes twiceDailyAt(int<0, 24> $first = 1, int<0, 24> $second = 13, int<0, 59> $offset = 0) * @method static \Illuminate\Console\Scheduling\PendingEventAttributes weekdays() * @method static \Illuminate\Console\Scheduling\PendingEventAttributes weekends() * @method static \Illuminate\Console\Scheduling\PendingEventAttributes mondays() @@ -71,16 +71,16 @@ * @method static \Illuminate\Console\Scheduling\PendingEventAttributes saturdays() * @method static \Illuminate\Console\Scheduling\PendingEventAttributes sundays() * @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 weeklyOn(array|int|int[]|\|\Illuminate\Console\Enums\ScheduleOn|Illuminate\Console\Enums\ScheduleOn[]|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 days(array|mixed $days) + * @method static \Illuminate\Console\Scheduling\PendingEventAttributes yearlyOn(int<1, 12> $month = 1, int<0, 31>|string $dayOfMonth = 1, string $time = '0:0') + * @method static \Illuminate\Console\Scheduling\PendingEventAttributes days(array||\Illuminate\Console\Enums\ScheduleOn|Illuminate\Console\Enums\ScheduleOn[]|int|int[]|string|string[]|mixed $days) * @method static \Illuminate\Console\Scheduling\PendingEventAttributes timezone(\DateTimeZone|string $timezone) * * @see \Illuminate\Console\Scheduling\Schedule From 1df5098fe9f08910279f4b7c470b88da6531ce8a 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 15:46:50 +0100 Subject: [PATCH 36/43] Add range type-hint for seconds --- src/Illuminate/Console/Scheduling/ManagesFrequencies.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index dcaa46b48d31..940664d576fe 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -146,7 +146,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) From 4418d4f63d73dfb7c668c0060767b569647ff61b 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 15:47:54 +0100 Subject: [PATCH 37/43] Add array type-hint --- src/Illuminate/Console/Scheduling/ManagesFrequencies.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index 940664d576fe..95e19f7a4ac8 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -253,7 +253,7 @@ public function hourly() /** * Schedule the event to run hourly at a given offset in the hour. * - * @param array|string|int<0, 24> $offset + * @param array|string|int<0, 24>|int<0, 24>[] $offset * @return $this */ public function hourlyAt($offset) From f08f99238ce87c382404625b0cf89f17c5808757 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 15:48:04 +0100 Subject: [PATCH 38/43] Fix typo --- src/Illuminate/Support/Facades/Schedule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Support/Facades/Schedule.php b/src/Illuminate/Support/Facades/Schedule.php index e461f4475681..de34c0987413 100644 --- a/src/Illuminate/Support/Facades/Schedule.php +++ b/src/Illuminate/Support/Facades/Schedule.php @@ -80,7 +80,7 @@ * @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<1, 12> $month = 1, int<0, 31>|string $dayOfMonth = 1, string $time = '0:0') - * @method static \Illuminate\Console\Scheduling\PendingEventAttributes days(array||\Illuminate\Console\Enums\ScheduleOn|Illuminate\Console\Enums\ScheduleOn[]|int|int[]|string|string[]|mixed $days) + * @method static \Illuminate\Console\Scheduling\PendingEventAttributes days(array|\Illuminate\Console\Enums\ScheduleOn|Illuminate\Console\Enums\ScheduleOn[]|int|int[]|string|string[]|mixed $days) * @method static \Illuminate\Console\Scheduling\PendingEventAttributes timezone(\DateTimeZone|string $timezone) * * @see \Illuminate\Console\Scheduling\Schedule From d4f76adb2619dcc63b60e302bd16dcdc634ff804 Mon Sep 17 00:00:00 2001 From: Taylor Otwell <taylor@laravel.com> Date: Thu, 19 Dec 2024 12:26:50 -0600 Subject: [PATCH 39/43] formatting --- ...wordStatus.php => PasswordResetResult.php} | 4 +-- .../Auth/Passwords/PasswordBroker.php | 20 ++++++------- .../Enums/Day.php} | 10 ++----- .../Console/Scheduling/ManagesFrequencies.php | 24 +++++++-------- .../Console/Scheduling/Schedule.php | 29 +++++-------------- .../Contracts/Auth/PasswordBroker.php | 22 ++++---------- src/Illuminate/Support/Facades/Password.php | 14 ++++----- src/Illuminate/Support/Facades/Schedule.php | 4 +-- 8 files changed, 49 insertions(+), 78 deletions(-) rename src/Illuminate/Auth/Enums/{PasswordStatus.php => PasswordResetResult.php} (88%) rename src/Illuminate/Console/{Enums/ScheduleOn.php => Scheduling/Enums/Day.php} (72%) diff --git a/src/Illuminate/Auth/Enums/PasswordStatus.php b/src/Illuminate/Auth/Enums/PasswordResetResult.php similarity index 88% rename from src/Illuminate/Auth/Enums/PasswordStatus.php rename to src/Illuminate/Auth/Enums/PasswordResetResult.php index bb76407f8fa6..bf5d12f06cd7 100644 --- a/src/Illuminate/Auth/Enums/PasswordStatus.php +++ b/src/Illuminate/Auth/Enums/PasswordResetResult.php @@ -2,7 +2,7 @@ namespace Illuminate\Auth\Enums; -enum PasswordStatus: string +enum PasswordResetResult: string { /** * Constant representing a successfully sent reminder. @@ -27,5 +27,5 @@ enum PasswordStatus: string /** * Constant representing a throttled reset attempt. */ - case ResetThrottled = 'passwords.throttled'; + case Throttled = 'passwords.throttled'; } diff --git a/src/Illuminate/Auth/Passwords/PasswordBroker.php b/src/Illuminate/Auth/Passwords/PasswordBroker.php index 5e7af490cd26..d274c7c4127c 100755 --- a/src/Illuminate/Auth/Passwords/PasswordBroker.php +++ b/src/Illuminate/Auth/Passwords/PasswordBroker.php @@ -3,7 +3,7 @@ namespace Illuminate\Auth\Passwords; use Closure; -use Illuminate\Auth\Enums\PasswordStatus; +use Illuminate\Auth\Enums\PasswordResetResult; use Illuminate\Auth\Events\PasswordResetLinkSent; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; use Illuminate\Contracts\Auth\PasswordBroker as PasswordBrokerContract; @@ -55,7 +55,7 @@ public function __construct(#[\SensitiveParameter] TokenRepositoryInterface $tok * * @param array $credentials * @param \Closure|null $callback - * @return \Illuminate\Auth\Enums\PasswordStatus + * @return \Illuminate\Auth\Enums\PasswordResetResult */ public function sendResetLink(#[\SensitiveParameter] array $credentials, ?Closure $callback = null) { @@ -65,17 +65,17 @@ public function sendResetLink(#[\SensitiveParameter] array $credentials, ?Closur $user = $this->getUser($credentials); if (is_null($user)) { - return PasswordStatus::InvalidUser; + return PasswordResetResult::InvalidUser; } if ($this->tokens->recentlyCreatedToken($user)) { - return PasswordStatus::ResetThrottled; + return PasswordResetResult::Throttled; } $token = $this->tokens->create($user); if ($callback) { - return $callback($user, $token) ?? PasswordStatus::ResetLinkSent; + return $callback($user, $token) ?? PasswordResetResult::ResetLinkSent; } // Once we have the reset token, we are ready to send the message out to this @@ -85,7 +85,7 @@ public function sendResetLink(#[\SensitiveParameter] array $credentials, ?Closur $this->events?->dispatch(new PasswordResetLinkSent($user)); - return PasswordStatus::ResetLinkSent; + return PasswordResetResult::ResetLinkSent; } /** @@ -115,23 +115,23 @@ public function reset(#[\SensitiveParameter] array $credentials, Closure $callba $this->tokens->delete($user); - return PasswordStatus::PasswordReset; + return PasswordResetResult::PasswordReset; } /** * Validate a password reset for the given credentials. * * @param array $credentials - * @return \Illuminate\Contracts\Auth\CanResetPassword|\Illuminate\Auth\Enums\PasswordStatus + * @return \Illuminate\Contracts\Auth\CanResetPassword|\Illuminate\Auth\Enums\PasswordResetResult */ protected function validateReset(#[\SensitiveParameter] array $credentials) { if (is_null($user = $this->getUser($credentials))) { - return PasswordStatus::InvalidUser; + return PasswordResetResult::InvalidUser; } if (! $this->tokens->exists($user, $credentials['token'])) { - return PasswordStatus::InvalidToken; + return PasswordResetResult::InvalidToken; } return $user; diff --git a/src/Illuminate/Console/Enums/ScheduleOn.php b/src/Illuminate/Console/Scheduling/Enums/Day.php similarity index 72% rename from src/Illuminate/Console/Enums/ScheduleOn.php rename to src/Illuminate/Console/Scheduling/Enums/Day.php index e53e07aae39d..8d6e6d2d8642 100644 --- a/src/Illuminate/Console/Enums/ScheduleOn.php +++ b/src/Illuminate/Console/Scheduling/Enums/Day.php @@ -1,20 +1,14 @@ <?php -namespace Illuminate\Console\Enums; +namespace Illuminate\Console\Scheduling\Enums; -enum ScheduleOn: int +enum Day: int { case Sunday = 0; - case Monday = 1; - case Tuesday = 2; - case Wednesday = 3; - case Thursday = 4; - case Friday = 5; - case Saturday = 6; } diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index 95e19f7a4ac8..400338e97a7d 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -2,7 +2,7 @@ namespace Illuminate\Console\Scheduling; -use Illuminate\Console\Enums\ScheduleOn; +use Illuminate\Console\Scheduling\Enums\Day; use Illuminate\Support\Carbon; use InvalidArgumentException; @@ -404,7 +404,7 @@ protected function hourBasedSchedule($minutes, $hours) */ public function weekdays() { - return $this->days(ScheduleOn::Monday->value.'-'.ScheduleOn::Friday->value); + return $this->days(Day::Monday->value.'-'.Day::Friday->value); } /** @@ -414,7 +414,7 @@ public function weekdays() */ public function weekends() { - return $this->days(ScheduleOn::Saturday->value.','.ScheduleOn::Sunday->value); + return $this->days(Day::Saturday->value.','.Day::Sunday->value); } /** @@ -424,7 +424,7 @@ public function weekends() */ public function mondays() { - return $this->days(ScheduleOn::Monday); + return $this->days(Day::Monday); } /** @@ -434,7 +434,7 @@ public function mondays() */ public function tuesdays() { - return $this->days(ScheduleOn::Tuesday); + return $this->days(Day::Tuesday); } /** @@ -444,7 +444,7 @@ public function tuesdays() */ public function wednesdays() { - return $this->days(ScheduleOn::Wednesday); + return $this->days(Day::Wednesday); } /** @@ -454,7 +454,7 @@ public function wednesdays() */ public function thursdays() { - return $this->days(ScheduleOn::Thursday); + return $this->days(Day::Thursday); } /** @@ -464,7 +464,7 @@ public function thursdays() */ public function fridays() { - return $this->days(ScheduleOn::Friday); + return $this->days(Day::Friday); } /** @@ -474,7 +474,7 @@ public function fridays() */ public function saturdays() { - return $this->days(ScheduleOn::Saturday); + return $this->days(Day::Saturday); } /** @@ -484,7 +484,7 @@ public function saturdays() */ public function sundays() { - return $this->days(ScheduleOn::Sunday); + return $this->days(Day::Sunday); } /** @@ -502,7 +502,7 @@ public function weekly() /** * Schedule the event to run weekly on a given day and time. * - * @param array|int|int[]|\|\Illuminate\Console\Enums\ScheduleOn|Illuminate\Console\Enums\ScheduleOn[]|mixed $dayOfWeek + * @param Day[]|Day|array|int|int[]|mixed $dayOfWeek * @param string $time * @return $this */ @@ -629,7 +629,7 @@ public function yearlyOn($month = 1, $dayOfMonth = 1, $time = '0:0') /** * Set the days of the week the command should run on. * - * @param array|\Illuminate\Console\Enums\ScheduleOn|Illuminate\Console\Enums\ScheduleOn[]|int|int[]|string|string[]|mixed $days + * @param Day[]|Day|array|int[]|int|string[]|string|mixed $days * @return $this */ public function days($days) diff --git a/src/Illuminate/Console/Scheduling/Schedule.php b/src/Illuminate/Console/Scheduling/Schedule.php index 828a18163028..af66846a698e 100644 --- a/src/Illuminate/Console/Scheduling/Schedule.php +++ b/src/Illuminate/Console/Scheduling/Schedule.php @@ -7,7 +7,7 @@ use DateTimeInterface; use Illuminate\Bus\UniqueLock; use Illuminate\Console\Application; -use Illuminate\Console\Enums\ScheduleOn; +use Illuminate\Console\Scheduling\Enums\Day; use Illuminate\Container\Container; use Illuminate\Contracts\Bus\Dispatcher; use Illuminate\Contracts\Cache\Repository as Cache; @@ -29,26 +29,13 @@ class Schedule __call as macroCall; } - /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::SUNDAY instead */ - const SUNDAY = ScheduleOn::Sunday; - - /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::MONDAY instead */ - const MONDAY = ScheduleOn::Monday; - - /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::TUESDAY instead */ - const TUESDAY = ScheduleOn::Tuesday; - - /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::WEDNESDAY instead */ - const WEDNESDAY = ScheduleOn::Wednesday; - - /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::THURSDAY instead */ - const THURSDAY = ScheduleOn::Thursday; - - /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::FRIDAY instead */ - const FRIDAY = ScheduleOn::Friday; - - /** @deprecated Use \Illuminate\Console\Enums\ScheduleOn::SATURDAY instead */ - const SATURDAY = ScheduleOn::Saturday; + const SUNDAY = Day::Sunday; + const MONDAY = Day::Monday; + const TUESDAY = Day::Tuesday; + const WEDNESDAY = Day::Wednesday; + const THURSDAY = Day::Thursday; + const FRIDAY = Day::Friday; + const SATURDAY = Day::Saturday; /** * All of the events on the schedule. diff --git a/src/Illuminate/Contracts/Auth/PasswordBroker.php b/src/Illuminate/Contracts/Auth/PasswordBroker.php index 8500360a6fab..f65c51a22a4d 100644 --- a/src/Illuminate/Contracts/Auth/PasswordBroker.php +++ b/src/Illuminate/Contracts/Auth/PasswordBroker.php @@ -3,7 +3,7 @@ namespace Illuminate\Contracts\Auth; use Closure; -use Illuminate\Auth\Enums\PasswordStatus; +use Illuminate\Auth\Enums\PasswordResetResult; interface PasswordBroker { @@ -11,46 +11,36 @@ interface PasswordBroker * Constant representing a successfully sent reminder. * * @var \Illuminate\Auth\Enums\PasswordStatus - * - * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::ResetLinkSent instead */ - const RESET_LINK_SENT = PasswordStatus::ResetLinkSent; + const RESET_LINK_SENT = PasswordResetResult::ResetLinkSent; /** * Constant representing a successfully reset password. * * @var \Illuminate\Auth\Enums\PasswordStatus - * - * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::PasswordReset instead */ - const PASSWORD_RESET = PasswordStatus::PasswordReset; + const PASSWORD_RESET = PasswordResetResult::PasswordReset; /** * Constant representing the user not found response. * * @var \Illuminate\Auth\Enums\PasswordStatus - * - * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::InvalidUser instead */ - const INVALID_USER = PasswordStatus::InvalidUser; + const INVALID_USER = PasswordResetResult::InvalidUser; /** * Constant representing an invalid token. * * @var \Illuminate\Auth\Enums\PasswordStatus - * - * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::InvalidToken instead */ - const INVALID_TOKEN = PasswordStatus::InvalidToken; + const INVALID_TOKEN = PasswordResetResult::InvalidToken; /** * Constant representing a throttled reset attempt. * * @var \Illuminate\Auth\Enums\PasswordStatus - * - * @deprecated Use \Illuminate\Auth\Enums\PasswordStatus::ResetThrottled instead */ - const RESET_THROTTLED = PasswordStatus::ResetThrottled; + const RESET_THROTTLED = PasswordResetResult::Throttled; /** * Send a password reset link to a user. diff --git a/src/Illuminate/Support/Facades/Password.php b/src/Illuminate/Support/Facades/Password.php index 3ea4081a5761..3a008dbbcd74 100755 --- a/src/Illuminate/Support/Facades/Password.php +++ b/src/Illuminate/Support/Facades/Password.php @@ -2,13 +2,13 @@ namespace Illuminate\Support\Facades; -use Illuminate\Auth\Enums\PasswordStatus; +use Illuminate\Auth\Enums\PasswordResetResult; /** * @method static \Illuminate\Contracts\Auth\PasswordBroker broker(string|null $name = null) * @method static string getDefaultDriver() * @method static void setDefaultDriver(string $name) - * @method static \Illuminate\Auth\Enums\PasswordStatus sendResetLink(array $credentials, \Closure|null $callback = null) + * @method static \Illuminate\Auth\Enums\PasswordResetResult sendResetLink(array $credentials, \Closure|null $callback = null) * @method static mixed reset(array $credentials, \Closure $callback) * @method static \Illuminate\Contracts\Auth\CanResetPassword|null getUser(array $credentials) * @method static string createToken(\Illuminate\Contracts\Auth\CanResetPassword $user) @@ -26,35 +26,35 @@ class Password extends Facade * * @var string */ - const RESET_LINK_SENT = PasswordStatus::ResetLinkSent; + const RESET_LINK_SENT = PasswordResetResult::ResetLinkSent; /** * Constant representing a successfully reset password. * * @var string */ - const PASSWORD_RESET = PasswordStatus::PasswordReset; + const PASSWORD_RESET = PasswordResetResult::PasswordReset; /** * Constant representing the user not found response. * * @var string */ - const INVALID_USER = PasswordStatus::InvalidUser; + const INVALID_USER = PasswordResetResult::InvalidUser; /** * Constant representing an invalid token. * * @var string */ - const INVALID_TOKEN = PasswordStatus::InvalidToken; + const INVALID_TOKEN = PasswordResetResult::InvalidToken; /** * Constant representing a throttled reset attempt. * * @var string */ - const RESET_THROTTLED = PasswordStatus::ResetThrottled; + const RESET_THROTTLED = PasswordResetResult::Throttled; /** * Get the registered name of the component. diff --git a/src/Illuminate/Support/Facades/Schedule.php b/src/Illuminate/Support/Facades/Schedule.php index de34c0987413..42fe487df0e1 100644 --- a/src/Illuminate/Support/Facades/Schedule.php +++ b/src/Illuminate/Support/Facades/Schedule.php @@ -71,7 +71,7 @@ * @method static \Illuminate\Console\Scheduling\PendingEventAttributes saturdays() * @method static \Illuminate\Console\Scheduling\PendingEventAttributes sundays() * @method static \Illuminate\Console\Scheduling\PendingEventAttributes weekly() - * @method static \Illuminate\Console\Scheduling\PendingEventAttributes weeklyOn(array|int|int[]|\|\Illuminate\Console\Enums\ScheduleOn|Illuminate\Console\Enums\ScheduleOn[]|mixed $dayOfWeek, string $time = '0:0') + * @method static \Illuminate\Console\Scheduling\PendingEventAttributes weeklyOn(array|int|int[]|\Illuminate\Console\Scheduling\Enums\Day|Illuminate\Console\Scheduling\Enums\Day[]|mixed $dayOfWeek, string $time = '0:0') * @method static \Illuminate\Console\Scheduling\PendingEventAttributes monthly() * @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') @@ -80,7 +80,7 @@ * @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<1, 12> $month = 1, int<0, 31>|string $dayOfMonth = 1, string $time = '0:0') - * @method static \Illuminate\Console\Scheduling\PendingEventAttributes days(array|\Illuminate\Console\Enums\ScheduleOn|Illuminate\Console\Enums\ScheduleOn[]|int|int[]|string|string[]|mixed $days) + * @method static \Illuminate\Console\Scheduling\PendingEventAttributes days(array|\Illuminate\Console\Scheduling\Enums\Day|Illuminate\Console\Scheduling\Enums\Day[]|int|int[]|string|string[]|mixed $days) * @method static \Illuminate\Console\Scheduling\PendingEventAttributes timezone(\DateTimeZone|string $timezone) * * @see \Illuminate\Console\Scheduling\Schedule From eed57b8dafa4f6f74a56c43e7a2c46a4ddfde4d9 Mon Sep 17 00:00:00 2001 From: Taylor Otwell <taylor@laravel.com> Date: Thu, 19 Dec 2024 12:49:36 -0600 Subject: [PATCH 40/43] Update PasswordResetResult.php --- src/Illuminate/Auth/Enums/PasswordResetResult.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Auth/Enums/PasswordResetResult.php b/src/Illuminate/Auth/Enums/PasswordResetResult.php index bf5d12f06cd7..442f0c8a9b55 100644 --- a/src/Illuminate/Auth/Enums/PasswordResetResult.php +++ b/src/Illuminate/Auth/Enums/PasswordResetResult.php @@ -5,27 +5,27 @@ enum PasswordResetResult: string { /** - * Constant representing a successfully sent reminder. + * Result indicating a successfully sent password reset email. */ case ResetLinkSent = 'passwords.sent'; /** - * Constant representing a successfully reset password. + * Result representing a successfully reset password. */ case PasswordReset = 'passwords.reset'; /** - * Constant representing the user not found response. + * Result indicating the user is invalid. */ case InvalidUser = 'passwords.user'; /** - * Constant representing an invalid token. + * Result indicating the token is invalid. */ case InvalidToken = 'passwords.token'; /** - * Constant representing a throttled reset attempt. + * Result indicating the password reset attempt has been throttled. */ case Throttled = 'passwords.throttled'; } From d86d3ad9210ab3a060a3a3b288558507871b9427 Mon Sep 17 00:00:00 2001 From: Taylor Otwell <taylor@laravel.com> Date: Thu, 19 Dec 2024 12:54:21 -0600 Subject: [PATCH 41/43] still use strings for passwords --- src/Illuminate/Auth/Passwords/PasswordBroker.php | 6 +++--- .../{Enums => Passwords}/PasswordResetResult.php | 14 +++++++------- src/Illuminate/Contracts/Auth/PasswordBroker.php | 14 +++++++------- src/Illuminate/Support/Facades/Password.php | 4 ++-- 4 files changed, 19 insertions(+), 19 deletions(-) rename src/Illuminate/Auth/{Enums => Passwords}/PasswordResetResult.php (57%) diff --git a/src/Illuminate/Auth/Passwords/PasswordBroker.php b/src/Illuminate/Auth/Passwords/PasswordBroker.php index d274c7c4127c..96e3130f9e63 100755 --- a/src/Illuminate/Auth/Passwords/PasswordBroker.php +++ b/src/Illuminate/Auth/Passwords/PasswordBroker.php @@ -3,8 +3,8 @@ namespace Illuminate\Auth\Passwords; use Closure; -use Illuminate\Auth\Enums\PasswordResetResult; use Illuminate\Auth\Events\PasswordResetLinkSent; +use Illuminate\Auth\Passwords\PasswordResetResult; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; use Illuminate\Contracts\Auth\PasswordBroker as PasswordBrokerContract; use Illuminate\Contracts\Auth\UserProvider; @@ -55,7 +55,7 @@ public function __construct(#[\SensitiveParameter] TokenRepositoryInterface $tok * * @param array $credentials * @param \Closure|null $callback - * @return \Illuminate\Auth\Enums\PasswordResetResult + * @return string */ public function sendResetLink(#[\SensitiveParameter] array $credentials, ?Closure $callback = null) { @@ -122,7 +122,7 @@ public function reset(#[\SensitiveParameter] array $credentials, Closure $callba * Validate a password reset for the given credentials. * * @param array $credentials - * @return \Illuminate\Contracts\Auth\CanResetPassword|\Illuminate\Auth\Enums\PasswordResetResult + * @return \Illuminate\Contracts\Auth\CanResetPassword|string */ protected function validateReset(#[\SensitiveParameter] array $credentials) { diff --git a/src/Illuminate/Auth/Enums/PasswordResetResult.php b/src/Illuminate/Auth/Passwords/PasswordResetResult.php similarity index 57% rename from src/Illuminate/Auth/Enums/PasswordResetResult.php rename to src/Illuminate/Auth/Passwords/PasswordResetResult.php index 442f0c8a9b55..9b02dcb51e59 100644 --- a/src/Illuminate/Auth/Enums/PasswordResetResult.php +++ b/src/Illuminate/Auth/Passwords/PasswordResetResult.php @@ -1,31 +1,31 @@ <?php -namespace Illuminate\Auth\Enums; +namespace Illuminate\Auth\Passwords; -enum PasswordResetResult: string +class PasswordResetResult { /** * Result indicating a successfully sent password reset email. */ - case ResetLinkSent = 'passwords.sent'; + const ResetLinkSent = 'passwords.sent'; /** * Result representing a successfully reset password. */ - case PasswordReset = 'passwords.reset'; + const PasswordReset = 'passwords.reset'; /** * Result indicating the user is invalid. */ - case InvalidUser = 'passwords.user'; + const InvalidUser = 'passwords.user'; /** * Result indicating the token is invalid. */ - case InvalidToken = 'passwords.token'; + const InvalidToken = 'passwords.token'; /** * Result indicating the password reset attempt has been throttled. */ - case Throttled = 'passwords.throttled'; + const Throttled = 'passwords.throttled'; } diff --git a/src/Illuminate/Contracts/Auth/PasswordBroker.php b/src/Illuminate/Contracts/Auth/PasswordBroker.php index f65c51a22a4d..a21db1caf19f 100644 --- a/src/Illuminate/Contracts/Auth/PasswordBroker.php +++ b/src/Illuminate/Contracts/Auth/PasswordBroker.php @@ -3,42 +3,42 @@ namespace Illuminate\Contracts\Auth; use Closure; -use Illuminate\Auth\Enums\PasswordResetResult; +use Illuminate\Auth\Passwords\PasswordResetResult; interface PasswordBroker { /** * Constant representing a successfully sent reminder. * - * @var \Illuminate\Auth\Enums\PasswordStatus + * @var string */ const RESET_LINK_SENT = PasswordResetResult::ResetLinkSent; /** * Constant representing a successfully reset password. * - * @var \Illuminate\Auth\Enums\PasswordStatus + * @var string */ const PASSWORD_RESET = PasswordResetResult::PasswordReset; /** * Constant representing the user not found response. * - * @var \Illuminate\Auth\Enums\PasswordStatus + * @var string */ const INVALID_USER = PasswordResetResult::InvalidUser; /** * Constant representing an invalid token. * - * @var \Illuminate\Auth\Enums\PasswordStatus + * @var string */ const INVALID_TOKEN = PasswordResetResult::InvalidToken; /** * Constant representing a throttled reset attempt. * - * @var \Illuminate\Auth\Enums\PasswordStatus + * @var string */ const RESET_THROTTLED = PasswordResetResult::Throttled; @@ -47,7 +47,7 @@ interface PasswordBroker * * @param array $credentials * @param \Closure|null $callback - * @return \Illuminate\Auth\Enums\PasswordStatus + * @return string */ public function sendResetLink(array $credentials, ?Closure $callback = null); diff --git a/src/Illuminate/Support/Facades/Password.php b/src/Illuminate/Support/Facades/Password.php index 3a008dbbcd74..cbcecc6795a2 100755 --- a/src/Illuminate/Support/Facades/Password.php +++ b/src/Illuminate/Support/Facades/Password.php @@ -2,13 +2,13 @@ namespace Illuminate\Support\Facades; -use Illuminate\Auth\Enums\PasswordResetResult; +use Illuminate\Auth\Passwords\PasswordResetResult; /** * @method static \Illuminate\Contracts\Auth\PasswordBroker broker(string|null $name = null) * @method static string getDefaultDriver() * @method static void setDefaultDriver(string $name) - * @method static \Illuminate\Auth\Enums\PasswordResetResult sendResetLink(array $credentials, \Closure|null $callback = null) + * @method static string sendResetLink(array $credentials, \Closure|null $callback = null) * @method static mixed reset(array $credentials, \Closure $callback) * @method static \Illuminate\Contracts\Auth\CanResetPassword|null getUser(array $credentials) * @method static string createToken(\Illuminate\Contracts\Auth\CanResetPassword $user) From 3c1ba5f873ed9b60ac1c6374b9425589baeb31aa Mon Sep 17 00:00:00 2001 From: Taylor Otwell <taylor@laravel.com> Date: Thu, 19 Dec 2024 12:56:29 -0600 Subject: [PATCH 42/43] cant depend on auth component --- src/Illuminate/Contracts/Auth/PasswordBroker.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Illuminate/Contracts/Auth/PasswordBroker.php b/src/Illuminate/Contracts/Auth/PasswordBroker.php index a21db1caf19f..c6b202329e39 100644 --- a/src/Illuminate/Contracts/Auth/PasswordBroker.php +++ b/src/Illuminate/Contracts/Auth/PasswordBroker.php @@ -3,7 +3,6 @@ namespace Illuminate\Contracts\Auth; use Closure; -use Illuminate\Auth\Passwords\PasswordResetResult; interface PasswordBroker { @@ -12,35 +11,35 @@ interface PasswordBroker * * @var string */ - const RESET_LINK_SENT = PasswordResetResult::ResetLinkSent; + const RESET_LINK_SENT = 'passwords.sent'; /** * Constant representing a successfully reset password. * * @var string */ - const PASSWORD_RESET = PasswordResetResult::PasswordReset; + const PASSWORD_RESET = 'passwords.reset'; /** * Constant representing the user not found response. * * @var string */ - const INVALID_USER = PasswordResetResult::InvalidUser; + const INVALID_USER = 'passwords.user'; /** * Constant representing an invalid token. * * @var string */ - const INVALID_TOKEN = PasswordResetResult::InvalidToken; + const INVALID_TOKEN = 'passwords.token'; /** * Constant representing a throttled reset attempt. * * @var string */ - const RESET_THROTTLED = PasswordResetResult::Throttled; + const RESET_THROTTLED = 'passwords.throttled'; /** * Send a password reset link to a user. From 680036d153379e0ac40976d62fd6f6c3fee801bd Mon Sep 17 00:00:00 2001 From: Taylor Otwell <taylor@laravel.com> Date: Thu, 19 Dec 2024 12:57:15 -0600 Subject: [PATCH 43/43] dont use enums --- src/Illuminate/Console/Scheduling/Schedule.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Illuminate/Console/Scheduling/Schedule.php b/src/Illuminate/Console/Scheduling/Schedule.php index af66846a698e..3736e9c4ab0d 100644 --- a/src/Illuminate/Console/Scheduling/Schedule.php +++ b/src/Illuminate/Console/Scheduling/Schedule.php @@ -7,7 +7,6 @@ use DateTimeInterface; use Illuminate\Bus\UniqueLock; use Illuminate\Console\Application; -use Illuminate\Console\Scheduling\Enums\Day; use Illuminate\Container\Container; use Illuminate\Contracts\Bus\Dispatcher; use Illuminate\Contracts\Cache\Repository as Cache; @@ -29,13 +28,13 @@ class Schedule __call as macroCall; } - const SUNDAY = Day::Sunday; - const MONDAY = Day::Monday; - const TUESDAY = Day::Tuesday; - const WEDNESDAY = Day::Wednesday; - const THURSDAY = Day::Thursday; - const FRIDAY = Day::Friday; - const SATURDAY = Day::Saturday; + const SUNDAY = 0; + const MONDAY = 1; + const TUESDAY = 2; + const WEDNESDAY = 3; + const THURSDAY = 4; + const FRIDAY = 5; + const SATURDAY = 6; /** * All of the events on the schedule.