Skip to content

Commit

Permalink
Return exception instance when error is added
Browse files Browse the repository at this point in the history
  • Loading branch information
ilijastuden committed Feb 11, 2016
1 parent 1ce2ed6 commit 93ea9cd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Exception/ValidationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,11 @@ public function hasError($field)
/**
* Add error to array
*
* @param string $error Error message
* @param string $field
* @param string $error
* @param string $field
* @return $this
*/
public function addError($error, $field = self::ANY_FIELD)
public function &addError($error, $field = self::ANY_FIELD)
{
if (empty($field)) {
$field = self::ANY_FIELD;
Expand All @@ -161,5 +162,7 @@ public function addError($error, $field = self::ANY_FIELD)
}

$this->errors[$field][] = $error;

return $this;
}
}

0 comments on commit 93ea9cd

Please sign in to comment.