original_string: public function addValidator($validator)
      {
          if ($validator === FormField::TYPE_FILE)
          {
              $this->is_file = true;
              $validator = Type::RESOURCE;
          }
  
          if (!$validator instanceof Validator)
          {
              $validator = new Validator($validator, ['unstrict' => true]);
          }
  
          $this->validators[] = $validator;
          return $this;
      }
code: public function addValidator($validator)
      {
          if ($validator === FormField::TYPE_FILE)
          {
              $this->is_file = true;
              $validator = Type::RESOURCE;
          }
  
          if (!$validator instanceof Validator)
          {
              $validator = new Validator($validator, ['unstrict' => true]);
          }
  
          $this->validators[] = $validator;
          return $this;
      }
code_tokens: public function addValidator ( $ validator ) { if ( $ validator === FormField :: TYPE_FILE ) { $ this -> is_file = true ; $ validator = Type :: RESOURCE ; } if ( ! $ validator instanceof Validator ) { $ validator = new Validator ( $ validator , [ 'unstrict' => true ] ) ; } $ this -> validators [ ] = $ validator ; return $ this ; }
docstring: Change the type of the field
  @param Validator $validator The validator to add. Provide either
  one of the constants in Type, or a instantiated
  Validator. FormField::TYPE_FILE will be transparently
  converted to a file upload form field.
  @return FormField Provides fluent interface
docstring_tokens: Change the type of the field