Skip to content

Commit a11dd14

Browse files
committed
Check if macro is valid
1 parent 088968c commit a11dd14

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Alias.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,15 @@ protected function detectMethods()
403403
$macros = isset($properties['macros']) ? $properties['macros'] : [];
404404
foreach ($macros as $macro_name => $macro_func) {
405405
if (!in_array($macro_name, $this->usedMethods)) {
406+
try {
407+
$method = $this->getMacroFunction($macro_func);
408+
} catch (\Throwable $e) {
409+
// Invalid method, skip
410+
continue;
411+
}
406412
// Add macros
407413
$this->methods[] = new Macro(
408-
$this->getMacroFunction($macro_func),
414+
$method,
409415
$this->alias,
410416
$reflection,
411417
$macro_name,

0 commit comments

Comments
 (0)