From bb1caed6984adda151a413770e8b1cf1dbba9903 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Wed, 8 Jan 2025 11:00:53 +0100 Subject: [PATCH] Check if macro is valid (#1655) * Check if macro is valid * composer fix-style --------- Co-authored-by: laravel-ide-helper --- src/Alias.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Alias.php b/src/Alias.php index 50d74a914..1ff2faed9 100644 --- a/src/Alias.php +++ b/src/Alias.php @@ -403,9 +403,15 @@ protected function detectMethods() $macros = isset($properties['macros']) ? $properties['macros'] : []; foreach ($macros as $macro_name => $macro_func) { if (!in_array($macro_name, $this->usedMethods)) { + try { + $method = $this->getMacroFunction($macro_func); + } catch (Throwable $e) { + // Invalid method, skip + continue; + } // Add macros $this->methods[] = new Macro( - $this->getMacroFunction($macro_func), + $method, $this->alias, $reflection, $macro_name,