Skip to content

Commit

Permalink
Fix PHPStan issue
Browse files Browse the repository at this point in the history
  • Loading branch information
emodric committed Nov 10, 2023
1 parent 51fe8f8 commit 5d051fd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Validator/ValidatorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ private function validate($value, $constraints, ?string $propertyPath = null): v
throw ValidationException::validationFailed($propertyPath ?? '', $t->getMessage(), $t);
}

if (count($violations) === 0) {
if (!$violations->has(0)) {
return;
}

$propertyPath = sprintf('%s%s', $propertyPath ?? '', $violations[0]->getPropertyPath());
$propertyPath = sprintf('%s%s', $propertyPath ?? '', $violations->get(0)->getPropertyPath());

throw ValidationException::validationFailed($propertyPath, (string) $violations[0]->getMessage());
throw ValidationException::validationFailed($propertyPath, (string) $violations->get(0)->getMessage());
}
}

0 comments on commit 5d051fd

Please sign in to comment.