Skip to content

Commit

Permalink
👌 IMPROVE: Provide merged validated data #6
Browse files Browse the repository at this point in the history
  • Loading branch information
elie29 committed Feb 23, 2019
1 parent ad6ac07 commit 985b2a0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Changelog

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## V1.0.4 - TBD
## V1.0.4 - 2019-02-23

### Added

- Nothing.
- [#6](https://github.com/elie29/validator/issues/6) Provide merged validated data.

### Changed

Expand Down
4 changes: 2 additions & 2 deletions src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ public function setStopOnError(bool $stopOnError): self
return $this;
}

public function validate(): bool
public function validate(bool $mergeValidatedContext = false): bool
{
$this->validatedContext = [];
$this->validatedContext = $mergeValidatedContext ? $this->validatedContext : [];

// All rules supposed OK
$res = true;
Expand Down
5 changes: 4 additions & 1 deletion src/ValidatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ public function setStopOnError(bool $stopOnError);
*
* keys context will be ignored if they don't have any rule.
*
* @param bool $mergeValidatedContext Merge validated values with existent one.
* Useful with partial validation
*
* @return bool
*/
public function validate(): bool;
public function validate(bool $mergeValidatedContext = false): bool;
}

0 comments on commit 985b2a0

Please sign in to comment.