Skip to content

Commit

Permalink
fix required field
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Bohony committed Oct 16, 2023
1 parent 0f523a1 commit d120355
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Params/ParamsProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ public function __construct(array $params)
public function isError(): bool
{
foreach ($this->params as $param) {
$validationResult = $param->validate();
if (!$validationResult->isOk()) {
$this->errors[$param->getKey()] = $validationResult->getErrors();
if($param->isRequired() || !empty($param->getValue())){
$validationResult = $param->validate();
if (!$validationResult->isOk()) {
$this->errors[$param->getKey()] = $validationResult->getErrors();
}
}
}
return !empty($this->errors);
Expand Down

0 comments on commit d120355

Please sign in to comment.