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

        if (null === $args[0]) {
            self::countPhpUnit();

            return true;
        }

        $method = substr($method, 8);

        return [$method, true];
    }
protected static function matchOptional(string $method, array $args)
    {
        if (0 !== strpos($method, 'optional')) {
            return [$method, false];
        }

        if (null === $args[0]) {
            self::countPhpUnit();

            return true;
        }

        $method = substr($method, 8);

        return [$method, true];
    }
匹配可选规则.

@param string $method
@param array  $args

@return array|bool