From 5d18a8d006a3c3083f3db7c2babeb64a2b58ccad Mon Sep 17 00:00:00 2001 From: Freek Van der Herten Date: Thu, 16 May 2024 13:06:04 +0200 Subject: [PATCH] do not fail when shortSchedule is not defined --- src/ShortSchedule.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ShortSchedule.php b/src/ShortSchedule.php index 0d87302..6172566 100644 --- a/src/ShortSchedule.php +++ b/src/ShortSchedule.php @@ -6,6 +6,7 @@ use Illuminate\Support\Traits\Macroable; use React\EventLoop\LoopInterface; use ReflectionClass; +use ReflectionException; class ShortSchedule { @@ -53,7 +54,12 @@ public function registerCommandsFromConsoleKernel(): self $class = new ReflectionClass(get_class($kernel)); - $shortScheduleMethod = $class->getMethod('shortSchedule'); + try { + $shortScheduleMethod = $class->getMethod('shortSchedule'); + } catch (ReflectionException) { + // The application does not have a shortSchedule method + return $this; + } $shortScheduleMethod->setAccessible(true);