public static function create($function) : \ReflectionFunctionAbstract
    {
        if (\is_string($function)) {
            return \strpos($function, '::') ? new \ReflectionMethod($function) : new \ReflectionFunction($function);
        }

        if (\is_array($function)) {
            return (new \ReflectionClass(\ReflectionMethod::class))->newInstanceArgs($function);
        }

        if (\method_exists($function, '__invoke')) {
            return new \ReflectionMethod($function, '__invoke');
        }

        return new \ReflectionFunction($function);
    }