From 89ee4591e8294f630ab6027b79d373ca79d18c33 Mon Sep 17 00:00:00 2001 From: Amir Hossein Date: Wed, 8 Oct 2025 23:41:34 +0330 Subject: [PATCH] feat: add enum support to Schedule::useCache() --- src/Illuminate/Console/Scheduling/Schedule.php | 4 +++- src/Illuminate/Support/Facades/Schedule.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Console/Scheduling/Schedule.php b/src/Illuminate/Console/Scheduling/Schedule.php index 83dd524fb21a..49d0a821c779 100644 --- a/src/Illuminate/Console/Scheduling/Schedule.php +++ b/src/Illuminate/Console/Scheduling/Schedule.php @@ -432,11 +432,13 @@ public function events() /** * Specify the cache store that should be used to store mutexes. * - * @param string $store + * @param \UnitEnum|string $store * @return $this */ public function useCache($store) { + $store = enum_value($store); + if ($this->eventMutex instanceof CacheAware) { $this->eventMutex->useStore($store); } diff --git a/src/Illuminate/Support/Facades/Schedule.php b/src/Illuminate/Support/Facades/Schedule.php index e340185453f0..1f13b4ffbf00 100644 --- a/src/Illuminate/Support/Facades/Schedule.php +++ b/src/Illuminate/Support/Facades/Schedule.php @@ -14,7 +14,7 @@ * @method static bool serverShouldRun(\Illuminate\Console\Scheduling\Event $event, \DateTimeInterface $time) * @method static \Illuminate\Support\Collection dueEvents(\Illuminate\Contracts\Foundation\Application $app) * @method static \Illuminate\Console\Scheduling\Event[] events() - * @method static \Illuminate\Console\Scheduling\Schedule useCache(string $store) + * @method static \Illuminate\Console\Scheduling\Schedule useCache(\UnitEnum|string $store) * @method static void macro(string $name, object|callable $macro) * @method static void mixin(object $mixin, bool $replace = true) * @method static bool hasMacro(string $name)