Rename validateArray to validateSchemaArray and specify the format in doc comment

[MAILPOET-4700]
This commit is contained in:
David Remer
2022-10-26 10:13:07 +03:00
committed by Jan Jakeš
parent 1a58166a0b
commit 5075982cd3
2 changed files with 4 additions and 3 deletions

View File

@@ -48,7 +48,7 @@ class ValidStepArgsRule implements WorkflowNodeVisitor {
['properties' => [$property => $propertySchema]]
);
try {
$this->validator->validateArray(
$this->validator->validateSchemaArray(
$schemaToValidate,
$step->getArgs(),
$property

View File

@@ -25,17 +25,18 @@ class Validator {
* @return mixed
*/
public function validate(Schema $schema, $value, string $paramName = 'value') {
return $this->validateArray($schema->toArray(), $value, $paramName);
return $this->validateSchemaArray($schema->toArray(), $value, $paramName);
}
/**
* Strict validation & sanitization implementation.
* It only coerces int to float (e.g. 5 to 5.0).
*
* @param array $schema. The array must follow the format, which is returned from Schema::toArray().
* @param mixed $value
* @return mixed
*/
public function validateArray(array $schema, $value, string $paramName = 'value') {
public function validateSchemaArray(array $schema, $value, string $paramName = 'value') {
$result = $this->validateAndSanitizeValueFromSchema($value, $schema, $paramName);
if ($result instanceof WP_Error) {
throw ValidationException::createFromWpError($result);