Skip to content

Commit 93ea9cd

Browse files
committed
Return exception instance when error is added
1 parent 1ce2ed6 commit 93ea9cd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Exception/ValidationException.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,11 @@ public function hasError($field)
147147
/**
148148
* Add error to array
149149
*
150-
* @param string $error Error message
151-
* @param string $field
150+
* @param string $error
151+
* @param string $field
152+
* @return $this
152153
*/
153-
public function addError($error, $field = self::ANY_FIELD)
154+
public function &addError($error, $field = self::ANY_FIELD)
154155
{
155156
if (empty($field)) {
156157
$field = self::ANY_FIELD;
@@ -161,5 +162,7 @@ public function addError($error, $field = self::ANY_FIELD)
161162
}
162163

163164
$this->errors[$field][] = $error;
165+
166+
return $this;
164167
}
165168
}

0 commit comments

Comments
 (0)