Skip to content

Commit

Permalink
Additions after changes in validator (PR #168) (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
arogachev committed Feb 11, 2022
1 parent b81b2ba commit 9843468
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/FormErrors.php
Expand Up @@ -80,7 +80,7 @@ public function hasErrors(?string $attribute = null): bool
return $attribute === null ? !empty($this->attributesErrors) : isset($this->attributesErrors[$attribute]);
}

public function clear(string $attribute = null): void
public function clear(?string $attribute = null): void
{
if ($attribute !== null) {
unset($this->attributesErrors[$attribute]);
Expand Down
4 changes: 2 additions & 2 deletions src/FormErrorsInterface.php
Expand Up @@ -20,9 +20,9 @@ public function addError(string $attribute, string $error): void;
/**
* Removes errors for all attributes.
*
* @param string $attribute Attribute name. If not set, removes errors for all attributes.
* @param string|null $attribute Attribute name. If not set, removes errors for all attributes.
*/
public function clear(string $attribute = null): void;
public function clear(?string $attribute = null): void;

/**
* Returns errors for all attributes.
Expand Down
2 changes: 1 addition & 1 deletion src/FormModel.php
Expand Up @@ -200,7 +200,7 @@ public function processValidationResult(Result $result): void
{
$this->validated = false;

foreach ($result->getErrorsIndexedByAttribute() as $attribute => $errors) {
foreach ($result->getErrorMessagesIndexedByAttribute() as $attribute => $errors) {
$this->formErrors->clear($attribute);
/** @psalm-suppress InvalidArgument */
$this->addErrors([$attribute => $errors]);
Expand Down

0 comments on commit 9843468

Please sign in to comment.