bindTo($this, static::class), $parameters); } return call_user_func_array($macro, $parameters); } /** * Dynamically handle static calls to the class. */ public static function __callStatic(string $method, mixed $parameters): mixed { if (!static::hasMacro($method)) { throw new \BadMethodCallException("Method {$method} does not exist."); } $macro = static::$macros[$method]; if ($macro instanceof \Closure) { return call_user_func_array(\Closure::bind($macro, null, static::class), $parameters); } return call_user_func_array($macro, $parameters); } }