protected function createNegativeOrOptionalValidator(string $filter, array $rules): RespectValidator
    {
        [$method, $parameters] = $this->parseStringRule($rules[0]);

        unset($rules[0]);

        $method    = \str_replace($filter, '', $method);
        $validator = RespectValidator::$method(...$parameters);

        if ($filter === '!') {
            return RespectValidator::not($this->createChainableValidators($validator, $rules));
        }

        return RespectValidator::optional($this->createChainableValidators($validator, $rules));
    }
protected function createNegativeOrOptionalValidator(string $filter, array $rules): RespectValidator
    {
        [$method, $parameters] = $this->parseStringRule($rules[0]);

        unset($rules[0]);

        $method    = \str_replace($filter, '', $method);
        $validator = RespectValidator::$method(...$parameters);

        if ($filter === '!') {
            return RespectValidator::not($this->createChainableValidators($validator, $rules));
        }

        return RespectValidator::optional($this->createChainableValidators($validator, $rules));
    }
protected function createNegativeOrOptionalValidator ( string $ filter , array $ rules ) : RespectValidator { [ $ method , $ parameters ] = $ this -> parseStringRule ( $ rules [ 0 ] ) ; unset ( $ rules [ 0 ] ) ; $ method = \ str_replace ( $ filter , '' , $ method ) ; $ validator = RespectValidator :: $ method ( ... $ parameters ) ; if ( $ filter === '!' ) { return RespectValidator :: not ( $ this -> createChainableValidators ( $ validator , $ rules ) ) ; } return RespectValidator :: optional ( $ this -> createChainableValidators ( $ validator , $ rules ) ) ; }
Create a negative or optional validator instance.

@param string $filter
@param array  $rules

@return \Respect\Validation\Validator
Create a negative or optional validator instance .