From 3d7f45479ec372ca80d2baa5ba33e826cacc365f Mon Sep 17 00:00:00 2001 From: HikaruYasuda Date: Tue, 4 Dec 2018 10:33:00 +0900 Subject: [PATCH] fix: Macro methods are duplicated registration. --- src/Alias.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Alias.php b/src/Alias.php index f14bb12..4e73da5 100644 --- a/src/Alias.php +++ b/src/Alias.php @@ -357,14 +357,17 @@ class Alias $properties = $reflection->getStaticProperties(); $macros = isset($properties['macros']) ? $properties['macros'] : []; foreach ($macros as $macro_name => $macro_func) { - // Add macros - $this->methods[] = new Macro( - $this->getMacroFunction($macro_func), - $this->alias, - $reflection, - $macro_name, - $this->interfaces - ); + if (!in_array($macro_name, $this->usedMethods)) { + // Add macros + $this->methods[] = new Macro( + $this->getMacroFunction($macro_func), + $this->alias, + $reflection, + $macro_name, + $this->interfaces + ); + $this->usedMethods[] = $macro_name; + } } } }