Validate all rich objects not only the used ones

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2018-11-23 12:38:07 +01:00
parent 75c3737054
commit 695e60228d
No known key found for this signature in database
GPG key ID: 7076EA9751AACDDA

View file

@ -71,11 +71,17 @@ class Validator implements IValidator {
foreach ($matches[1] as $parameter) { foreach ($matches[1] as $parameter) {
if (!isset($parameters[$parameter])) { if (!isset($parameters[$parameter])) {
throw new InvalidObjectExeption('Parameter is undefined'); throw new InvalidObjectExeption('Parameter is undefined');
} else {
$this->validateParameter($parameters[$parameter]);
} }
} }
} }
foreach ($parameters as $parameter) {
if (!\is_array($parameter)) {
throw new InvalidObjectExeption('Parameter is malformed');
}
$this->validateParameter($parameter);
}
} }
/** /**