mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Adds support for macros (#500)
* Adds support for macros * Fixes formatting
This commit is contained in:
committed by
Barry vd. Heuvel
parent
2a63d51496
commit
b76156b24c
@@ -312,6 +312,24 @@ class Alias
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the class is macroable
|
||||
$traits = collect($reflection->getTraitNames());
|
||||
if ($traits->contains('Illuminate\Support\Traits\Macroable')) {
|
||||
$properties = $reflection->getStaticProperties();
|
||||
$macros = isset($properties['macros']) ? $properties['macros'] : [];
|
||||
foreach ($macros as $macro_name => $macro_func) {
|
||||
$function = new \ReflectionFunction($macro_func);
|
||||
// Add macros
|
||||
$this->methods[] = new Macro(
|
||||
$function,
|
||||
$this->alias,
|
||||
$reflection,
|
||||
$macro_name,
|
||||
$this->interfaces
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user