Skip to content

Commit

Permalink
[Validator] Fix Email validator logic
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jan 15, 2023
1 parent 0208ce6 commit 9858255
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Constraints/EmailValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Egulias\EmailValidator\Validation\NoRFCWarningsValidation;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Exception\LogicException;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Exception\UnexpectedValueException;

Expand Down Expand Up @@ -71,7 +72,7 @@ public function validate($value, Constraint $constraint)

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

$constraint->mode = $this->defaultMode;
Expand Down

0 comments on commit 9858255

Please sign in to comment.