Skip to content

Commit

Permalink
Check if macro is valid (#1655)
Browse files Browse the repository at this point in the history
* Check if macro is valid

* composer fix-style

---------

Co-authored-by: laravel-ide-helper <laravel-ide-helper@users.noreply.github.com>
  • Loading branch information
barryvdh and laravel-ide-helper authored Jan 8, 2025
1 parent 55268cd commit bb1caed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Alias.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit bb1caed

Please sign in to comment.