original_string: public function setError($field, $errors, $overwrite = false)
      {
          if (is_string($errors)) {
              $errors = [$errors];
          }
  
          return $this->setErrors([$field => $errors], $overwrite);
      }
code: public function setError($field, $errors, $overwrite = false)
      {
          if (is_string($errors)) {
              $errors = [$errors];
          }
  
          return $this->setErrors([$field => $errors], $overwrite);
      }
code_tokens: public function setError ( $ field , $ errors , $ overwrite = false ) { if ( is_string ( $ errors ) ) { $ errors = [ $ errors ] ; } return $ this -> setErrors ( [ $ field => $ errors ] , $ overwrite ) ; }
docstring: Sets errors for a single field
  
  ### Example
  
  ```
  // Sets the error messages for a single field
  $entity->setError('salary', ['must be numeric', 'must be a positive number']);
  ```
  
  @param string $field The field to get errors for, or the array of errors to set.
  @param string|array $errors The errors to be set for $field
  @param bool $overwrite Whether or not to overwrite pre-existing errors for $field
  @return $this
docstring_tokens: Sets errors for a single field