Skip to content

Commit bb1caed

Browse files
barryvdhlaravel-ide-helper
and
laravel-ide-helper
authored
Check if macro is valid (#1655)
* Check if macro is valid * composer fix-style --------- Co-authored-by: laravel-ide-helper <[email protected]>
1 parent 55268cd commit bb1caed

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)