-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Add BC layer covering BicValidator without Intl #28606
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
Conversation
chalasr
commented
Sep 26, 2018
Q | A |
---|---|
Branch? | master |
Bug fix? | no |
New feature? | no |
BC breaks? | no |
Deprecations? | yes |
Tests pass? | yes |
Fixed tickets | #28473 (review) |
License | MIT |
Doc PR | n/a |
b2d2f63
to
27aecff
Compare
// next 2 letters must be alphabetic (country code) | ||
$countries = Intl::getRegionBundle()->getCountryNames(); | ||
if (!isset($countries[substr($canonicalize, 4, 2)])) { | ||
// next 2 letters must be a valid country code |
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.
this comment looks a bit off now :) i'd drop it as the variable is self-descriptive now
27aecff
to
b73a3d6
Compare
if (!class_exists(Intl::class)) { | ||
throw new LogicException('The "symfony/intl" component is required to use the Bic constraint.'); | ||
@trigger_error('Using the Bic constraint without the "symfony/intl" component installed is deprecated since Symfony 4.2.', E_USER_DEPRECATED); |
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 would trigger the deprecation in the constraint instead so that developers notice it without having to actually validate anything (that may go without notice if you don't have tests covering it).
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.
done
eb8b143
to
270a5d3
Compare
270a5d3
to
73fdbb9
Compare
we could revert #28513 in favor of deprecations in the constraint |
That's basically the same as #25865 which IMO still makes sense, but should be done in a different PR. |
|
||
public function __construct($options = null) | ||
{ | ||
// @deprecated since Symfony 4.2, throw a LogicException in 5.0 |
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.
can you please add the future exception in a commented line of code?
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.
done!
73fdbb9
to
09e8371
Compare
public function __construct($options = null) | ||
{ | ||
// @deprecated since Symfony 4.2 | ||
// throw new LoginException(sprintf('The "symfony/intl" component is required to use the "%s" constraint.', __CLASS__)); |
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.
should be inside the "if", where it will be in 5 :) (no need for L43 to me)
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.
fixed
09e8371
to
3faca6e
Compare
3faca6e
to
10b8a5f
Compare
Thank you @chalasr. |
…ntl (chalasr) This PR was merged into the 4.2-dev branch. Discussion ---------- [Validator] Add BC layer covering BicValidator without Intl | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #28473 (review) | License | MIT | Doc PR | n/a Commits ------- 10b8a5f [Validator] Add BC layer covering BicValidator without Intl