NOTE: It recommended to move this method to `BaseRules` so it will be accessible in all validation rule sets.

@param RuleInterface|null $next

@return RuleInterface
556047
public static function postRelationship(RuleInterface $next = null): RuleInterface
    {
        return self::toOneRelationship(PostSchema::TYPE, self::postId($next));
    }
689615
protected static function moreOrEquals($value, RuleInterface $next = null): RuleInterface
    {
        return $next === null ?
            ($value instanceof DateTimeInterface ?
                new DateTimeMoreOrEquals($value) : new NumericMoreOrEqualsThan($value)) :
            new AndOperator(static::moreOrEquals($value), $next);
    }
203603
public function setNext($next)
    {
        $this->_links[self::NEXT][self::HREF] = $next;
        $this->removeEmptyLinks();

        return $this;
    }
339030
protected static function equals($value, RuleInterface $next = null): RuleInterface
    {
        if ($value === null) {
            $rule = new IsNull();
        } elseif ($value instanceof DateTimeInterface) {
            $rule = new DateTimeEquals($value);
        } else {
            $rule = new ScalarEquals($value);
        }

        return $next === null ? $rule : new AndOperator(static::equals($value), $next);
    }
859467
public static function readable(string $apiClass, RuleInterface $next = null): RuleInterface
    {
        $primary = new IsReadableViaApiRule($apiClass);

        return $next === null ? $primary : new AndOperator($primary, $next);
    }
775688
protected static function isFloat(RuleInterface $next = null): RuleInterface
    {
        return $next === null ? new AsFloat() : new AndOperator(new AsFloat(), $next);
    }
433611
public static function asSanitizedString(RuleInterface $next = null): RuleInterface
    {
        return self::isString(
            self::filter(FILTER_SANITIZE_FULL_SPECIAL_CHARS, null, ErrorCodes::INVALID_VALUE, $next)
        );
    }
15881
protected static function isString(RuleInterface $next = null): RuleInterface
    {
        return $next === null ? new AsString() : new AndOperator(new AsString(), $next);
    }
1084864
protected function createIssue(ConstraintInterface $constraint)
    {
        list($value, $pointer) = $this->currentContext();

        return new Result\ValidationIssue(
            $constraint,
            $value,
            $pointer
        );
    }
144876
public function validationRules(array $rules = array())
    {
        if (empty($rules)) {
            return $this->validationRules;
        }

        $this->validationRules = $rules;

        return $this;
    }
1298542
protected static function between($lowerLimit, $upperLimit, RuleInterface $next = null): RuleInterface
    {
        $areLimitsDates = $lowerLimit instanceof DateTimeInterface && $upperLimit instanceof DateTimeInterface;

        return $next === null ?
            ($areLimitsDates ?
                new DateTimeBetween($lowerLimit, $upperLimit) : new NumericBetween($lowerLimit, $upperLimit)) :
            new AndOperator(static::between($lowerLimit, $upperLimit), $next);
    }
1171949
protected function makeRule($check, $rule): RuleInterface
    {
        $args = $this->parser->parseArgs($rule);
        $message = $this->parser->parseMessage($rule);

        if (!is_array($check)) {
            return new CallableRule($check, $args, $message);
        }

        if (is_string($check[0]) && $this->config->hasChecker($check[0])) {
            $check[0] = $this->config->getChecker($check[0])->resolve($this->factory);

            return new CheckerRule($check[0], $check[1], $args, $message);
        }

        if (!is_object($check[0])) {
            $check[0] = (new Autowire($check[0]))->resolve($this->factory);
        }

        return new CallableRule($check, $args, $message);
    }
430922
public static function toOneRelationship(string $type, RuleInterface $next = null): RuleInterface
    {
        $primary = new ToOneRelationshipTypeCheckerRule($type);

        return $next === null ? $primary : new AndOperator($primary, $next);
    }
782829
public static function postId(RuleInterface $next = null): RuleInterface
    {
        return self::stringToInt(self::readable(postsApi::class, $next));
    }
144907
public function addRule(AbstractRule $validationRule)
    {
        $validationRule->setErrorMessagePrototype($this->errorMessagePrototype);
        $this->rules->attach($validationRule);

        return $this;
    }
1041407
public function execute($command, callable $next)
    {
        $cmd = new SwitchedCommand();
        $cmd->message = new TextTemplate();
        $cmd->message->text = 'SwitchingMiddleware';
        $cmd->input = $command->input;

        $command['switchTo'] = $cmd;

        return $next($command);
    }
563334
protected static function stringToDateTime(string $format, RuleInterface $next = null): RuleInterface
    {
        return $next === null ? new StringToDateTime($format) : new AndOperator(new StringToDateTime($format), $next);
    }