fix: Macro methods are duplicated registration.

This commit is contained in:
HikaruYasuda
2018-12-04 10:33:00 +09:00
parent 858e730c00
commit 3d7f45479e
+11 -8
View File
@@ -357,14 +357,17 @@ class Alias
$properties = $reflection->getStaticProperties(); $properties = $reflection->getStaticProperties();
$macros = isset($properties['macros']) ? $properties['macros'] : []; $macros = isset($properties['macros']) ? $properties['macros'] : [];
foreach ($macros as $macro_name => $macro_func) { foreach ($macros as $macro_name => $macro_func) {
// Add macros if (!in_array($macro_name, $this->usedMethods)) {
$this->methods[] = new Macro( // Add macros
$this->getMacroFunction($macro_func), $this->methods[] = new Macro(
$this->alias, $this->getMacroFunction($macro_func),
$reflection, $this->alias,
$macro_name, $reflection,
$this->interfaces $macro_name,
); $this->interfaces
);
$this->usedMethods[] = $macro_name;
}
} }
} }
} }