code: public function clearErrors($attribute = null)
      {
          if ($attribute === null) {
              $this->_errors = [];
          } else {
              unset($this->_errors[$attribute]);
          }
      }
docs: Removes errors for all attributes or a single attribute.
  @param string $attribute attribute name. Use null to remove errors for all attributes.