src/Leevel/Validate/Assert.php
protected static function matchMulti(string $method, array $args, bool $optional)
    {
        if (0 !== stripos($method, 'multi')) {
            return [$method, [$args]];
        }

        if (!is_array($args[0]) && !$args instanceof Traversable) {
            $e = sprintf('Invalid first argument for multi assert.');

            throw new InvalidArgumentException($e);
        }

        $multi = [];
        $argsSource = $args;

        foreach ($args[0] as $v) {
            if (null === $v && true === $optional) {
                continue;
            }

            $argsSource[0] = $v;
            $multi[] = $argsSource;
        }

        if (!$multi) {
            self::countPhpUnit();

            return true;
        }

        $method = substr($method, 5);

        return [$method, $multi];
    }
protected static function matchMulti(string $method, array $args, bool $optional)
    {
        if (0 !== stripos($method, 'multi')) {
            return [$method, [$args]];
        }

        if (!is_array($args[0]) && !$args instanceof Traversable) {
            $e = sprintf('Invalid first argument for multi assert.');

            throw new InvalidArgumentException($e);
        }

        $multi = [];
        $argsSource = $args;

        foreach ($args[0] as $v) {
            if (null === $v && true === $optional) {
                continue;
            }

            $argsSource[0] = $v;
            $multi[] = $argsSource;
        }

        if (!$multi) {
            self::countPhpUnit();

            return true;
        }

        $method = substr($method, 5);

        return [$method, $multi];
    }
匹配多个值

@param string $method
@param array  $args
@param bool   $optional

@return array|bool