diff --git a/src/Params/ParamsProcessor.php b/src/Params/ParamsProcessor.php index b055064..6582800 100644 --- a/src/Params/ParamsProcessor.php +++ b/src/Params/ParamsProcessor.php @@ -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);