-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Pre-check constraint validator dependencies #28644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
use Symfony\Component\Intl\Intl; | ||
use Symfony\Component\Validator\Constraint; | ||
use Symfony\Component\Validator\ConstraintValidator; | ||
use Symfony\Component\Validator\Exception\LogicException; | ||
use Symfony\Component\Validator\Exception\UnexpectedTypeException; | ||
|
||
/** | ||
|
@@ -68,11 +69,12 @@ public function validate($value, Constraint $constraint) | |
return; | ||
} | ||
|
||
// @deprecated since Symfony 4.2 | ||
// @deprecated since Symfony 4.2, will throw in 5.0 | ||
if (class_exists(Intl::class)) { | ||
$validCountryCode = isset(Intl::getRegionBundle()->getCountryNames()[substr($canonicalize, 4, 2)]); | ||
} else { | ||
$validCountryCode = ctype_alpha(substr($canonicalize, 4, 2)); | ||
// throw new LogicException('The "symfony/intl" component is required to use the Bic constraint.'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should trigger a deprecation here for now (at least when the passed constraint is a subclass of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldnt we assume they call the parent constructor? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agreed, sounds like a very edge case afterall There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fair enough, but I think we should still throw the exception in 5.0 |
||
} | ||
|
||
if (!$validCountryCode) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing final dots here and below (same below for other upgrade files)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we only do that for multiple sequences...
#28644 (diff)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think our markdowns are just inconsistent regarding final dots.
Sometimes we add it, sometimes not, mostly aligning with previous entries...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in general i think fabbot.io should take care of this yes. I.e. same for indenting, upper-/lowercase first..