src/Util/Validator.php
public function addRule(string $name, callable $callback, string $message = null): self
    {
        if ($message === null) {
            $message = static::ERROR_DEFAULT;
        }

        static::assertRuleCallback($callback);

        static::$_rules[$name] = $callback;
        static::$_ruleMessages[$name] = $message;

        return $this;
    }
public function addRule(string $name, callable $callback, string $message = null): self
    {
        if ($message === null) {
            $message = static::ERROR_DEFAULT;
        }

        static::assertRuleCallback($callback);

        static::$_rules[$name] = $callback;
        static::$_ruleMessages[$name] = $message;

        return $this;
    }
public function addRule ( string $ name , callable $ callback , string $ message = null ) : self { if ( $ message === null ) { $ message = static :: ERROR_DEFAULT ; } static :: assertRuleCallback ( $ callback ) ; static :: $ _rules [ $ name ] = $ callback ; static :: $ _ruleMessages [ $ name ] = $ message ; return $ this ; }
Register new validation rule callback

@param  string   $name
@param  callable $callback
@param  string   $message

@return $this
@throws \InvalidArgumentException
Register new validation rule callback