Skip to content

Commit 06db9bf

Browse files
authored
[Validator] Hint that egulias/email-validator needs to be installed for strict mode as default config
1 parent 4b566c8 commit 06db9bf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Constraints/EmailValidator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ public function validate($value, Constraint $constraint)
100100
}
101101

102102
if (null === $constraint->mode) {
103+
if (Email::VALIDATION_MODE_STRICT === $this->defaultMode && !class_exists(EguliasEmailValidator::class)) {
104+
throw new LogicException(sprintf('The "egulias/email-validator" component is required to make the "%s" constraint default to strict mode.', EguliasEmailValidator::class));
105+
}
106+
103107
$constraint->mode = $this->defaultMode;
104108
}
105109

0 commit comments

Comments
 (0)