Skip to content

Commit 4e8c605

Browse files
author
Maxime Leclercq
committed
fix: not checking an empty value is the role of “NotBlank”
1 parent 3f2eaa1 commit 4e8c605

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Validator/Constraints/YoutubeUrlValidator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ public function validate(mixed $value, Constraint $constraint): void
2929

3030
$value = (string) $value;
3131

32+
if ('' === $value) {
33+
return;
34+
}
35+
3236
if (!preg_match(self::YOUTUBE_REGEX_VALIDATOR, $value)) {
3337
$this->context->buildViolation($constraint->message)
3438
->setParameter('{{ string }}', $value)

0 commit comments

Comments
 (0)