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

[Validator] added BIC (SWIFT-BIC) validation constraint#15519

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
mvhirsch wants to merge9 commits intosymfony:2.8frommvhirsch:bic_validation_constraint
Closed

[Validator] added BIC (SWIFT-BIC) validation constraint#15519

mvhirsch wants to merge9 commits intosymfony:2.8frommvhirsch:bic_validation_constraint

Conversation

@mvhirsch
Copy link
Contributor

QA
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsnone
LicenseMIT
Doc PRsymfony/symfony-docs#5623

I've added the BIC validator, because we do often need validation for IBAN and BIC values. Since the IBAN validation was already included into Symfony, I was asking myself: why not contribute my BIC validator to the community? So here we go ...

It depends on ISO 9362 as described onWikipedia. It validates the structure based on alphabetic/alphanumeric values and the value's length.

Todo-list:

  • submit changes to the documentation

Copy link
Member

Choose a reason for hiding this comment

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

UUIDs should be used

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

How can I produce some UUIDs?

@stof
Copy link
Member

I'm not sure this should be in the core (I'm also not sur ethe IBAN deserves being in core, but it is there already and so needs to stay for BC reasons)

Copy link
Contributor

Choose a reason for hiding this comment

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

Business Identifier Code (non-plural)

@mvhirsch
Copy link
ContributorAuthor

Added UUIDs and fixed constraint message (non-plural).

Copy link
Contributor

Choose a reason for hiding this comment

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

?

@OskarStark
Copy link
Contributor

i like this feature and think, we have IBAN, so we should provide the BIC Constraint, too.

PR looks good to me

@DracoBlue
Copy link

👍

1 similar comment
@dkeller85
Copy link

👍

@OskarStark
Copy link
Contributor

The[WIP] should be removed from the PR subject@mvhirsch

EDIT: sorry, didn't see the open todo for the docs....

@mvhirschmvhirsch changed the title[WIP] [Validator] added BIC (SWIFT-BIC) validation constraint[Validator] added BIC (SWIFT-BIC) validation constraintAug 12, 2015

Choose a reason for hiding this comment

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

is this condition correct? Excuse me! The code is correct. I didn't understand the above comment correctly.

Copy link
Contributor

Choose a reason for hiding this comment

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

i would say yes, if it is not 8 AND not 11 characters long, then buildViolation

@javiereguiluz
Copy link
Member

👍

@mvhirsch
Copy link
ContributorAuthor

@javiereguiluz updated comment for clarity, because it was not English (I'm sorry).

@mvhirsch
Copy link
ContributorAuthor

Oh no! I accidentially rebased on master branch, not 2.8.
How can I undo this mistake? Please help me!

@mvhirsch
Copy link
ContributorAuthor

Okay, I fixed the commit :-)

@OskarStark
Copy link
Contributor

👍

Copy link
Contributor

Choose a reason for hiding this comment

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

How about

if (in_array(strlen($canonicalize), array(8, 11))) {

?

Copy link
Member

Choose a reason for hiding this comment

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

@Triiistan I suspect looping over an array is not faster than performing a&&

Copy link
Contributor

Choose a reason for hiding this comment

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

@stof i think@Triiistan is talking about better readability

Copy link
Contributor

Choose a reason for hiding this comment

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

I was trying to save 1 call fromstrlen and I tried to find which style Symfony used most between

if (yyy !== xxxx && zzz !== xxxx) {

and

if (!in_array(xxxx, array(yyy, zzz)) {

and the latter was used a bit more.

With the first style, we can write

$canonicalizeLength = strlen($canonicalize);if (8 !== $canonicalizeLength && 11 !== $canonicalizeLength) {

to avoid the duplication.

[Updated: I inverted both styles]

Copy link
Contributor

Choose a reason for hiding this comment

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

However, my concern may not be very pragmatic, so go with the version most readable to your eyes 😃

@mvhirsch
Copy link
ContributorAuthor

@Triiistan I've updated the code to use just one strlen call. It seems legit ;-)

@mvhirsch
Copy link
ContributorAuthor

Why does the build fail on HHVM?
Can we please re-run the Test-Suite?

EDIT: Thanks to whoever ran the Test-Suite again, it now looks stable at all (even HHVM) :-)

@mvhirsch
Copy link
ContributorAuthor

Status: Reviewed

@jakzal
Copy link
Contributor

I'm also not convinced we should have this kind of validators in core, as this is smething that can be easily provided by a 3rd party extension. The IBAN validator gave us a few headaches.

@xabbuh
Copy link
Member

I agree that a BIC validator is does not fit best in the core. However, we already have the IBAN validator and for consistency we imho should include this one too.

@OskarStark
Copy link
Contributor

👍@xabbuh

otherwise 3.0 could be the right moment to remove not wanted stuff from core and move this to a separate bundle, isn't it?

@mvhirsch
Copy link
ContributorAuthor

@jakzal@xabbuh@OskarStark we could provide a ValidatorExtraBundle or ValidatorFinanceExtraBundle (name proposal) for symfony 3.0. What do you think?
For now we could add this in 2.8.

@OskarStark
Copy link
Contributor

👍@mvhirsch sounds good to me

@mvhirsch
Copy link
ContributorAuthor

ping@jakzal@xabbuh

@jakzal
Copy link
Contributor

@mvhirsch well, yes, but I don't think such a bundle (or component) needs to be provided in the Symfony organisation. It's a perfect candidate for a community extension.

@OskarStark
Copy link
Contributor

anyway, i thin we should merge this as it is.

the Iban is already in so....

@mvhirsch
Copy link
ContributorAuthor

@jakzal we could add it for 2.8 anyway and extract/remove the parts for 3.0 and provide a community extension for those validators. What do you think?

@xabbuh
Copy link
Member

Can you please add translations for the message (at least add it to thevalidators.en.xlf file)?

@mvhirsch
Copy link
ContributorAuthor

@xabbuh I added translations for English and German language.

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 change this to "[...] ist kein gültiger BIC."

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@fabpot
Copy link
Member

ping @symfony/deciders

@xabbuh
Copy link
Member

👍 (besides my comment on the translation, but this shouldn't hold off merging imo)

@dunglas
Copy link
Member

Adding a new feature to deprecate it immediately doesn't sound to me like a good idea. IBAN and BIC validation is not so easy and is a very specific use case. I'm in favor of deprecating the IBAN validator in 2.8, remove it from 3.0 and provide a new community library with the IBAN and BIC validators. It would be cool to have a library usable without the DIC component (so no bundle but it can still include an optional extension).

@mvhirsch
Copy link
ContributorAuthor

@xabbuh I fixed the German translation. Thank you!

@fabpot
Copy link
Member

As we don't this "community-driven" repository/bundle with such validators, I propose to merge this one for consistency.

@dunglas
Copy link
Member

agree

@fabpot
Copy link
Member

Thank you@mvhirsch.

@fabpotfabpot closed thisSep 25, 2015
fabpot added a commit that referenced this pull requestSep 25, 2015
…t (mvhirsch)This PR was squashed before being merged into the 2.8 branch (closes#15519).Discussion----------[Validator] added BIC (SWIFT-BIC) validation constraint| Q             | A| ------------- | ---| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | none| License       | MIT| Doc PR        |symfony/symfony-docs#5623I've added the BIC validator, because we do often need validation for IBAN and BIC values. Since the IBAN validation was already included into Symfony, I was asking myself: why not contribute my  BIC validator to the community? So here we go ...It depends on ISO 9362 as described on [Wikipedia](https://en.wikipedia.org/wiki/ISO_9362#Structure). It validates the structure based on alphabetic/alphanumeric values and the value's length.Todo-list:- [x] submit changes to the documentationCommits-------d6471b3 [Validator] added BIC (SWIFT-BIC) validation constraint
@OskarStark
Copy link
Contributor

yay, congrats@mvhirsch and thank you!

xabbuh added a commit to symfony/symfony-docs that referenced this pull requestOct 12, 2015
This PR was squashed before being merged into the 2.8 branch (closes#5623).Discussion----------[Validator] added BIC validator| Q             | A| ------------- | ---| Doc fix?      | no| New docs?     | yes, PR:symfony/symfony#15519| Applies to    | 2.8| Fixed tickets | noneCommits-------7911fe1 [Validator] added BIC validator
@fabpotfabpot mentioned this pull requestNov 16, 2015
@mvhirschmvhirsch deleted the bic_validation_constraint branchJuly 4, 2017 12:52
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

13 participants

@mvhirsch@stof@OskarStark@DracoBlue@dkeller85@javiereguiluz@jakzal@xabbuh@fabpot@dunglas@sstok@Mx-Glitter@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp