-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Intl] Add support for ISO 3166-1 Alpha-3 country codes #32676
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
…ion) This PR was merged into the 5.0-dev branch. Discussion ---------- [Form] remove form type validation due to typehints | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? |no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | | License | MIT | Doc PR | Commits ------- ba2b5c1 [Form] remove form type validation due to typehints
…face (derrabus) This PR was merged into the 5.0-dev branch. Discussion ---------- [EventDispatcher] Add type-hints to EventDispatcherInterface | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #32179 | License | MIT | Doc PR | N/A This PR adds type-hints to `EventDispatcherInterface` to give it a more php7-like feeling. Adding these type-hints on master should not be a breaking change because we require php 7.2 there, which allows downstream classes/interfaces to remove a type-hint from a method signature. Commits ------- 2bc9472 [EventDispatcher] Add type-hints to EventDispatcherInterface.
…bus) This PR was merged into the 5.0-dev branch. Discussion ---------- [Routing] Add type-hints to all public interfaces | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #32179 | License | MIT | Doc PR | N/A This PR adds type-hints to all interfaces of the Routing component to give them a more php7-like feeling. Adding these type-hints on master should not be a breaking change because we require php 7.2 there, which allows downstream classes/interfaces to remove a type-hint from a method signature. Notes: * There is also an implementation of `RedirectableUrlMatcherInterface` in the Framework Bundle. I did not upgrade its interface in order to keep the bundle compatible with Routing 4.4. * We could apply similar changes to the `Route`, `RouteCollection` etc. in a follow-up PR. This PR only concentrated on the interfaces and their implementations. Commits ------- 457b322 [Routing] Add type-hints to all public interfaces.
…nkFormat accept Null as a return type (jls-esokia) This PR was merged into the 5.0-dev branch. Discussion ---------- Make Symfony\Component\Debug\ExceptionHandler::setFileLinkFormat accept Null as a return type fixes #32150 | Q | A | ------------- | --- | Branch? | master <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #32150 <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | - <!-- required for new features --> <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/roadmap): - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against branch 4.4. - Legacy code removals go to the master branch. --> Make `Symfony\Component\Debug\ExceptionHandler::setFileLinkFormat` accept null as a return type. Since Symfony requires PHP 7.2+ and that PHP feature was introduced in 7.1, I use that feature instead of changing the default value of the variable. Commits ------- e6cb7d8 Remove return type from ExceptionHandler::setFileLinkFormat
* 4.4: (43 commits) [PhpunitBridge] Read environment variable from superglobals [Bridge/PhpUnit] Fix PHP5.5 compat [PhpUnitBridge] More accurate grouping fixed CS [Form] remove comment about to-be-removed method as it is used in master by ButtonBuilder Extract unrecoverable exception to interface [FrameworkBundle] Fix calling Client::getProfile() before sending a request Fix type error [Security/Core] require libsodium >= 1.0.14 [Workflow] re-add workflow.definition tag to workflow services [Security/Core] Don't use ParagonIE_Sodium_Compat revert #30525 due to performance penalty collect called listeners information only once [Lock] fix missing inherit docs in RedisStore [Messenger] fix retrying handlers using DoctrineTransactionMiddleware [Mailgun Mailer] fixed issue when using html body [Messenger] make all stamps final and mark stamp not meant to be sent [HttpClient] fix timing measurements with NativeHttpClient add return type declaration use proper return types in ErrorHandler and ArgumentResolver ...
* 4.4: Fix typo
* 4.4: Bump phpunit-bridge
* 4.4: [PhpUnitBridge] Fix tests
* 4.4: Revert "bug #31730 [PhpUnitBridge] More accurate grouping (greg0ire)"
* 4.4: Reject phpunit-bridge v5 for now Revert "Revert "bug #31730 [PhpUnitBridge] More accurate grouping (greg0ire)""
This PR was merged into the 5.0-dev branch. Discussion ---------- [Form] Removed legacy code from NumberType | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Ref: #32130 Commits ------- 148ba1f Removed legacy code from NumberType
* 4.4: made BuferringLogger classes internal and final Added ErrorHandler component
* 4.4: [Mailer] fixed tests on Windows [PhpUnitBridge] fix tests [Mailer] fixed error message when connecting to a stream raises an error before connect() [Mailer] fixed timeout type hint improve error messages in the event dispatcher [Security/Core] work around sodium_compat issue bumped Symfony version to 4.3.3 updated VERSION for 4.3.2 updated CHANGELOG for 4.3.2 bumped Symfony version to 4.2.11 updated VERSION for 4.2.10 updated CHANGELOG for 4.2.10 bumped Symfony version to 3.4.30 updated VERSION for 3.4.29 update CONTRIBUTORS for 3.4.29 updated CHANGELOG for 3.4.29 Fixed type annotation.
* 4.4: renamed the ErrorHandler component to ErrorCatcher
* 4.4: deprecated FlattenException::create() [ErrorHandler] made IDEs and static analysis tools happy
* 4.4: [ErrorCatcher] some cleanup and better doc
…s. (derrabus) This PR was merged into the 5.0-dev branch. Discussion ---------- [Routing] Add type-hints RequestContext and Route classes. | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #32179 | License | MIT | Doc PR | N/A This PR adds type-hints to `RequestContext` and the Route classes to give them a more php7-like feeling. Adding these type-hints on master should not be a breaking change because we require php 7.2 there, which allows downstream classes/interfaces to remove a type-hint from a method signature. Commits ------- 614e824 [Routing] Add type-hints RequestContext and Route classes.
* 4.4: fix merge [HttpFoundation] Throw exception when the \"session\" extension is not loaded remove invalid test case remove invalid test cases [Serializer] Fixed PHP of DenormalizableInterface::denormalize fix Debug component dependencies [Cache] work aroung PHP memory leak [Finder] docblock fixes pass error code as a string [travis] not all components have a master branch [HttpKernel] Add @method PHPDoc for getRequest and getResponse back to Client Catch JsonException and rethrow in JsonEncode
This PR was merged into the 5.0-dev branch. Discussion ---------- [Ldap] Fix LdapUserProvider signatures | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- 920a52d [Ldap] Fix signature compat
* 4.4: Minor fixes [Mailer] fixed dispatcher not available in Mailer [HttpClient] Minor fixes Use namespaced Phpunit classes Add polyfill for PhpUnit namespace [Messenger] Fixed ConsumeMessagesCommand configuration [Form] remove leftover int child phpdoc Support DateTimeInterface in IntlDateFormatter::format [PhpUnitBridge] fixed PHPUnit 8.3 compatibility: method handleError was renamed to __invoke [Yaml] Removed unused $nullAsTilde property [Security] add support for opportunistic password migrations [Lock] Legacy test should implement legacy interface fixed phpdocs Use PHPunit assertion [Intl] Order alpha2 to alpha3 mapping + phpdoc fixes
* 4.4: [Form] Fix inconsistencies Use Phpunit FQDN in tests comments
* 4.4: added PHPUnit constraints and assertions for the Mailer [Mailer] added support for the profiler
This PR was merged into the 5.0-dev branch. Discussion ---------- [ErrorHandler][ErrorRenderer] Fix branch aliases | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | N/A | License | MIT | Doc PR | N/A Commits ------- a9ba2db Fix branch aliases.
* 4.4: Fix name of logical classes [Mailer] made the message logger permanent
* 4.4: bump phpunit-bridge cache-id removed unneeded phpdocs Use assertStringContainsString when needed Use assert assertContainsEquals when needed Use assertEqualsWithDelta when required
* 4.4: fix merge [Dotenv] Use default value when referenced variable is not set
This PR was squashed before being merged into the 5.0-dev branch (closes #32555). Discussion ---------- [Lock] remove deprecated code | Q | A | ------------- | --- | Branch? | 5.0 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | none <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | None <!-- required for new features --> <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/roadmap): - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against branch 4.4. - Legacy code removals go to the master branch. --> We are removing the StoreInterface And the Factory deprecated in 4.4. Commits ------- 008d135 [Lock] remove deprecated code
* 4.4: [HttpClient] add "max_duration" option
@terjebraten-certua can you rebase please? |
Ok. I have rebased and squashed my commits. |
Squashed the merge fix and code standard fix. |
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.
last round from me. Not sure what happened during review, but please revert the faulty commits :)
return self::readEntry(['Alpha2ToAlpha3', $alpha2Code], 'meta'); | ||
} | ||
|
||
public static function getAlpha2Code(string $alpha3Code) |
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.
:string
{ | ||
$alpha2Code = self::getAlpha2Code($alpha3Code); | ||
|
||
return self::readEntry(['Names', $alpha2Code], $displayLocale); |
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.
return self::getName(self::getAlpha2Code($alpha3Code))
without @throws
here
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.
How can it be without @throws
?
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.
AFAIK we dont document indirect throws (which would be the case with proposed patch)
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.
That is news to me. Thought a method had to document all throws, no matter where they come from.
$alpha3Names = []; | ||
foreach ($alpha2Names as $alpha2Code => $name) { | ||
$alpha3Code = self::readEntry(['Alpha2ToAlpha3', $alpha2Code], 'meta'); | ||
$alpha3Names[$alpha3Code] = $name; |
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.
$alpha3Names[self::getAlpha3Code($alpha2Code)] = $name
@@ -204,7 +209,6 @@ private function generateAlpha2ToAlpha3Mapping(ArrayAccessibleResourceBundle $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.
unrelated
sort($this->regionCodes); | ||
|
||
$alpha3ToAlpha2 = []; |
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.
cant we do $alpha3ToAlpha2 = array_flip($alpha2ToAlpha3)
like in languages?
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 just wanted to be 100% sure that we had all the entries that was in $this->regionCodes
.
Since this is a generator I want the code to be accurate instead of efficient.
*/ | ||
public static function getAlpha3Name(string $language, string $displayLocale = null): string | ||
{ | ||
$alpha2Code = self::readEntry(['Alpha3ToAlpha2', $language], 'meta'); |
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.
return self::getName(self::getAlpha2Code($language))
without @throws
here
public static function alpha3CodeExists(string $language): bool | ||
{ | ||
try { | ||
self::readEntry(['Alpha3ToAlpha2', $language], 'meta'); |
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.
self::getAlpha2Code($language)
$alpha2Names = self::getNames($displayLocale); | ||
$alpha3Names = []; | ||
foreach ($alpha2Names as $alpha2Code => $name) { | ||
if (2 === \strlen($alpha2Code)) { |
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.
try {
$alpha3Names[self::getAlpha3Code($alpha2Code)] = $name;
} catch (MissingResourceException $e) {
}
Sorry. somhow my code got rebased on wrong branch |
Closing in favour of #32988 Sorry, I could not rescue my branch that had become rebased somehow on master instead of 4.4. |
This PR is just to change the INTL component.
More work will be needed in the Form component to fully fix #20313