8000 Expand alias reasons to include 'bibliographic' · symfony/symfony@bbbe26e · GitHub
[go: up one dir, main page]

Skip to content

Commit bbbe26e

Browse files
committed
Expand alias reasons to include 'bibliographic'
The condition to test and validate aliases in both RegionDataGenerator.php and LanguageDataGenerator.php was expanded to not only account for 'overlong' reasons but also for 'bibliographic' reasons. This change was made to consider an additional category of aliases, allowing for a more comprehensive and accurate generation of data.
1 parent dd74807 commit bbbe26e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ private function generateAlpha3Codes(array $languageCodes, ArrayAccessibleResour
192192
}));
193193

194194
foreach ($metadataBundle['alias']['language'] as $alias => $data) {
195-
if (3 === \strlen($alias) && 'overlong' === $data['reason']) {
195+
if (3 === \strlen($alias) && \in_array($data['reason'], ['overlong', 'bibliographic'], true)) {
196196
$alpha3Codes[$alias] = true;
197197
}
198198
}
@@ -209,7 +209,7 @@ private function generateAlpha2ToAlpha3Mapping(ArrayAccessibleResourceBundle $me
209209

210210
foreach ($aliases as $alias => $data) {
211211
$language = $data['replacement'];
212-
if (2 === \strlen($language) && 3 === \strlen($alias) && 'overlong' === $data['reason']) {
212+
if (2 === \strlen($language) && 3 === \strlen($alias) && \in_array($data['reason'], ['overlong', 'bibliographic'], true)) {
213213
if (isset(self::PREFERRED_ALPHA2_TO_ALPHA3_MAPPING[$language])) {
214214
// Validate to prevent typos
215215
if (!isset($aliases[self::PREFERRED_ALPHA2_TO_ALPHA3_MAPPING[$language]])) {
@@ -243,7 +243,7 @@ private function generateAlpha3ToAlpha2Mapping(ArrayAccessibleResourceBundle $me
243243

244244
foreach ($metadataBundle['alias']['language'] as $alias => $data) {
245245
$language = $data['replacement'];
246-
if (2 === \strlen($language) && 3 === \strlen($alias) && 'overlong' === $data['reason']) {
246+
if (2 === \strlen($language) && 3 === \strlen($alias) && \in_array($data['reason'], ['overlong', 'bibliographic'], true)) {
247247
$alpha3ToAlpha2[$alias] = $language;
248248
}
249249
}

src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ private function generateAlpha2ToAlpha3Mapping(array $countries, ArrayAccessible
181181

182182
foreach ($aliases as $alias => $data) {
183183
$country = $data['replacement'];
184-
if (2 === \strlen($country) && 3 === \strlen($alias) && 'overlong' === $data['reason']) {
184+
if (2 === \strlen($country) && 3 === \strlen($alias) && \in_array($data['reason'], ['overlong', 'bibliographic'], true)) {
185185
if (isset(self::PREFERRED_ALPHA2_TO_ALPHA3_MAPPING[$country])) {
186186
// Validate to prevent typos
187187
if (!isset($aliases[self::PREFERRED_ALPHA2_TO_ALPHA3_MAPPING[$country]])) {

0 commit comments

Comments
 (0)
0