Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc944281

Browse files
committed
bug#47189 [Validator] Add additional hint whenegulias/email-validator needs to be installed (mpdude)
This PR was merged into the 4.4 branch.Discussion----------[Validator] Add additional hint when `egulias/email-validator` needs to be installed| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets || License | MIT| Doc PR |When using the `Symfony\Component\Validator\Constraints\Email` constraint with `'mode' => 'strict'`, a helpful error message is shown when the necessary package is not installed.However, when configuring `strict` mode as a framework setting (https://symfony.com/doc/current/reference/configuration/framework.html#email-validation-mode) and omitting the `mode` setting on the constraint itself, that message was missing.Commits-------3924498 [Validator] Hint that `egulias/email-validator` needs to be installed for strict mode as default config
2 parents675756f +3924498 commitc944281

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎src/Symfony/Component/Validator/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+
thrownewLogicException(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)

[8]ページ先頭

©2009-2025 Movatter.jp