From 923b332084cd995659c69c22994ff19b885bda4d Mon Sep 17 00:00:00 2001 From: yaozm Date: Mon, 1 Apr 2024 16:20:17 +0800 Subject: [PATCH] feat(Soar.php): Implement dynamic method calls and remove Conditionable trait --- src/Soar.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Soar.php b/src/Soar.php index 65adf37..cb2aa1f 100644 --- a/src/Soar.php +++ b/src/Soar.php @@ -18,7 +18,23 @@ class Soar extends \Guanguans\SoarPHP\Soar { - use Conditionable; - // use Macroable; + // use Conditionable; + use Macroable { + Macroable::__call as macroCall; + } use Tappable; + + /** + * Handle dynamic method calls into the method. + * + * @return mixed + */ + public function __call(string $method, array $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + return parent::__call($method, $parameters); + } }