original_string: public function addRules($rules)
      {
          if ($rules instanceof RiskyRulesAwareInterface && $rules->isRisky()) {
              $this->setRiskyAllowed(true);
          }
  
          if ($rules instanceof \Traversable) {
              $rules = iterator_to_array($rules);
          }
  
          if (!is_array($rules)) {
              throw new \InvalidArgumentException('Expected rules to be an iterable.');
          }
  
          $rules = array_replace($this->getRules(), $rules);
  
          $this->setRules($rules);
  
          return $this;
      }
code: public function addRules($rules)
      {
          if ($rules instanceof RiskyRulesAwareInterface && $rules->isRisky()) {
              $this->setRiskyAllowed(true);
          }
  
          if ($rules instanceof \Traversable) {
              $rules = iterator_to_array($rules);
          }
  
          if (!is_array($rules)) {
              throw new \InvalidArgumentException('Expected rules to be an iterable.');
          }
  
          $rules = array_replace($this->getRules(), $rules);
  
          $this->setRules($rules);
  
          return $this;
      }
code_tokens: public function addRules ( $ rules ) { if ( $ rules instanceof RiskyRulesAwareInterface && $ rules -> isRisky ( ) ) { $ this -> setRiskyAllowed ( true ) ; } if ( $ rules instanceof \ Traversable ) { $ rules = iterator_to_array ( $ rules ) ; } if ( ! is_array ( $ rules ) ) { throw new \ InvalidArgumentException ( 'Expected rules to be an iterable.' ) ; } $ rules = array_replace ( $ this -> getRules ( ) , $ rules ) ; $ this -> setRules ( $ rules ) ; return $ this ; }
docstring: Add to the current rules. Overrides existing rules.
  
  See {@see setRules} for the format of these rules.
  
  @param iterable $rules
  
  @return $this
docstring_tokens: Add to the current rules . Overrides existing rules .