From 89213c90ec8e29758ce62d57582a242384df2bc2 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 21 Oct 2024 18:21:16 +1300 Subject: [PATCH] FIX Call defineMethods if lower method is missing --- src/Core/CustomMethods.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Core/CustomMethods.php b/src/Core/CustomMethods.php index 97f84f07d64..619f551cba0 100644 --- a/src/Core/CustomMethods.php +++ b/src/Core/CustomMethods.php @@ -171,11 +171,14 @@ protected function getExtraMethodConfig($method) } // Lazy define methods $lowerClass = strtolower(static::class); - if (!isset(self::class::$extra_methods[$lowerClass])) { + $lowerMethod = strtolower($method); + if (!array_key_exists($lowerClass, self::class::$extra_methods) + || !array_key_exists($lowerMethod, self::class::$extra_methods[$lowerClass]) + ) { $this->defineMethods(); } - return self::class::$extra_methods[$lowerClass][strtolower($method)] ?? null; + return self::class::$extra_methods[$lowerClass][$lowerMethod] ?? null; } /**