Skip to content
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

[Intl] Add support for ISO 3166-1 numeric codes #51073

Merged
merged 1 commit into from Aug 1, 2023

Conversation

benr77
Copy link
Contributor

@benr77 benr77 commented Jul 22, 2023

Q A
Branch? 5.4
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #50860
License MIT
Doc PR symfony/symfony-docs#...

Add support for ISO-3166-1 numeric codes.

As well as the existing Alpha2 and Alpha3 codes, this PR adds support for the numeric country codes as per https://www.iso.org/obp/ui/#search/code/.

@carsonbot
Copy link

Hey!

Thanks for your PR. You are targeting branch "6.4" but it seems your PR description refers to branch "5.4".
Could you update the PR description or change target branch? This helps core maintainers a lot.

Cheers!

Carsonbot

@carsonbot carsonbot added this to the 6.4 milestone Jul 22, 2023
@benr77 benr77 changed the base branch from 6.4 to 5.4 July 22, 2023 20:44
'ZW' => '716',
'ZZ' => '999',
],
'NumericToAlpha2' => [
Copy link
Contributor Author

@benr77 benr77 Jul 22, 2023

Choose a reason for hiding this comment

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

Not sure the best way to handle these numeric strings with leading zeros as array keys - we have a mix of int and string keys.

Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps sanitize all to string?

src/Symfony/Component/Intl/CHANGELOG.md Outdated Show resolved Hide resolved
'ZW' => '716',
'ZZ' => '999',
],
'NumericToAlpha2' => [
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps sanitize all to string?

964 => 'QR',
965 => 'QS',
966 => 'QT',
'QV',
Copy link
Contributor

Choose a reason for hiding this comment

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

is this normal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've forced all the array keys to be numeric strings, prefixed with an underscore, to stop PHP trying to convert string numbers such as '077' to (int) 77.

@benr77 benr77 force-pushed the add-iso-3166-1-numeric branch 3 times, most recently from 09deecd to cde4f83 Compare July 23, 2023 17:38
@derrabus derrabus changed the base branch from 5.4 to 6.4 July 23, 2023 21:57
@derrabus derrabus changed the base branch from 6.4 to 5.4 July 23, 2023 21:57
@derrabus derrabus changed the base branch from 5.4 to 6.4 July 23, 2023 21:59
@benr77 benr77 force-pushed the add-iso-3166-1-numeric branch 2 times, most recently from ff2b253 to d2cbeb5 Compare July 24, 2023 17:17
@benr77
Copy link
Contributor Author

benr77 commented Jul 24, 2023

Unit test failures appear to be unrelated to the PR.

benr77 added a commit to benr77/symfony-docs that referenced this pull request Jul 25, 2023
benr77 added a commit to benr77/symfony-docs that referenced this pull request Jul 25, 2023
benr77 added a commit to benr77/symfony-docs that referenced this pull request Jul 26, 2023
src/Symfony/Component/Intl/Countries.php Outdated Show resolved Hide resolved
src/Symfony/Component/Intl/Tests/CountriesTest.php Outdated Show resolved Hide resolved
@fabpot
Copy link
Member

fabpot commented Aug 1, 2023

Thank you @benr77.

@fabpot fabpot merged commit 7597687 into symfony:6.4 Aug 1, 2023
8 of 10 checks passed
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Aug 2, 2023
…nr77)

This PR was merged into the 6.4 branch.

Discussion
----------

[Intl] Document support for ISO 3166-1 numeric codes

To accompany PR
* symfony/symfony#51073

Commits
-------

a9da7e0 Document support for ISO 3166-1 numeric codes
@benr77 benr77 deleted the add-iso-3166-1-numeric branch August 2, 2023 07:44
This was referenced Oct 21, 2023
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.

Add ISO-3166-1 Numeric codes to Intl component
8 participants