Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Sep 30, 2018

Conversation

chalasr
Copy link
Member

@chalasr 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

@chalasr chalasr added this to the next milestone Sep 26, 2018
@chalasr chalasr force-pushed the validator-bic-bc branch 3 times, most recently from b2d2f63 to 27aecff Compare September 26, 2018 13:15
// 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
Copy link
Contributor

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

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);
Copy link
Member

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).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@chalasr chalasr force-pushed the validator-bic-bc branch 2 times, most recently from eb8b143 to 270a5d3 Compare September 28, 2018 11:11
@ro0NL
Copy link
Contributor

ro0NL commented Sep 29, 2018

from #28513 shouldnt we move the check for all intl constraints?

if so, we can update the messages right away as done in #28610

@chalasr
Copy link
Member Author

chalasr commented Sep 29, 2018

@ro0NL That would be best but also involve BC layers as well to me, as moving them to the constraints would mean breaking earlier than currently. Is it worth it? \cc @xabbuh.

Deprecation message updated to use the FQCN here.

@ro0NL
Copy link
Contributor

ro0NL commented Sep 29, 2018

we could revert #28513 in favor of deprecations in the constraint

@xabbuh
Copy link
Member

xabbuh commented Sep 29, 2018

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
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

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__));
Copy link
Member

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)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@fabpot
Copy link
Member

fabpot commented Sep 30, 2018

Thank you @chalasr.

@fabpot fabpot merged commit 10b8a5f into symfony:master Sep 30, 2018
fabpot added a commit that referenced this pull request Sep 30, 2018
…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
@chalasr chalasr deleted the validator-bic-bc branch September 30, 2018 18:25
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.2 Nov 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants