original_string: public function errors($field = null, $errors = null, $overwrite = false)
      {
          deprecationWarning(
              get_called_class() . '::errors() is deprecated. ' .
              'Use setError()/getError() or setErrors()/getErrors() instead.'
          );
          if ($field === null) {
              return $this->getErrors();
          }
  
          if (is_string($field) && $errors === null) {
              return $this->getError($field);
          }
  
          if (!is_array($field)) {
              $field = [$field => $errors];
          }
  
          return $this->setErrors($field, $overwrite);
      }
code: public function errors($field = null, $errors = null, $overwrite = false)
      {
          deprecationWarning(
              get_called_class() . '::errors() is deprecated. ' .
              'Use setError()/getError() or setErrors()/getErrors() instead.'
          );
          if ($field === null) {
              return $this->getErrors();
          }
  
          if (is_string($field) && $errors === null) {
              return $this->getError($field);
          }
  
          if (!is_array($field)) {
              $field = [$field => $errors];
          }
  
          return $this->setErrors($field, $overwrite);
      }
code_tokens: public function errors ( $ field = null , $ errors = null , $ overwrite = false ) { deprecationWarning ( get_called_class ( ) . '::errors() is deprecated. ' . 'Use setError()/getError() or setErrors()/getErrors() instead.' ) ; if ( $ field === null ) { return $ this -> getErrors ( ) ; } if ( is_string ( $ field ) && $ errors === null ) { return $ this -> getError ( $ field ) ; } if ( ! is_array ( $ field ) ) { $ field = [ $ field => $ errors ] ; } return $ this -> setErrors ( $ field , $ overwrite ) ; }
docstring: Sets the error messages for a field or a list of fields. When called
  without the second argument it returns the validation
  errors for the specified fields. If called with no arguments it returns
  all the validation error messages stored in this entity and any other nested
  entity.
  
  ### Example
  
  ```
  // Sets the error messages for a single field
  $entity->errors('salary', ['must be numeric', 'must be a positive number']);
  
  // Returns the error messages for a single field
  $entity->getErrors('salary');
  
  // Returns all error messages indexed by field name
  $entity->getErrors();
  
  // Sets the error messages for multiple fields at once
  $entity->getErrors(['salary' => ['message'], 'name' => ['another message']);
  ```
  
  When used as a setter, this method will return this entity instance for method
  chaining.
  
  @deprecated 3.4.0 Use EntityTrait::setError(), EntityTrait::setErrors(), EntityTrait::getError() and EntityTrait::getErrors()
  @param string|array|null $field The field to get errors for, or the array of errors to set.
  @param string|array|null $errors The errors to be set for $field
  @param bool $overwrite Whether or not to overwrite pre-existing errors for $field
  @return array|$this
docstring_tokens: Sets the error messages for a field or a list of fields . When called without the second argument it returns the validation errors for the specified fields . If called with no arguments it returns all the validation error messages stored in this entity and any other nested entity .