Skip to content

Commit 801e5e2

Browse files
committed
Fix the return value on error for intl methods returning arrays
When the resource is missing, an empty array should be returned rather than null to respect the interface saying an array is always returned.
1 parent 6b02601 commit 801e5e2

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function getCurrencyNames($displayLocale = null)
7676
try {
7777
return $this->getNames($displayLocale);
7878
} catch (MissingResourceException $e) {
79-
return;
79+
return array();
8080
}
8181
}
8282

@@ -112,7 +112,7 @@ public function getLocales()
112112
try {
113113
return $this->localeProvider->getLocales();
114114
} catch (MissingResourceException $e) {
115-
return;
115+
return array();
116116
}
117117
}
118118
}

src/Symfony/Component/Intl/ResourceBundle/LanguageBundle.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function getLanguageNames($displayLocale = null)
8080
try {
8181
return $this->getNames($displayLocale);
8282
} catch (MissingResourceException $e) {
83-
return;
83+
return array();
8484
}
8585
}
8686

@@ -104,7 +104,7 @@ public function getScriptNames($displayLocale = null)
104104
try {
105105
return $this->scriptProvider->getNames($displayLocale);
106106
} catch (MissingResourceException $e) {
107-
return;
107+
return array();
108108
}
109109
}
110110

@@ -116,7 +116,7 @@ public function getLocales()
116116
try {
117117
return $this->localeProvider->getLocales();
118118
} catch (MissingResourceException $e) {
119-
return;
119+
return array();
120120
}
121121
}
122122
}

src/Symfony/Component/Intl/ResourceBundle/LocaleBundle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function getLocales()
3131
try {
3232
return parent::getLocales();
3333
} catch (MissingResourceException $e) {
34-
return;
34+
return array();
3535
}
3636
}
3737

@@ -55,7 +55,7 @@ public function getLocaleNames($displayLocale = null)
5555
try {
5656
return $this->getNames($displayLocale);
5757
} catch (MissingResourceException $e) {
58-
return;
58+
return array();
5959
}
6060
}
6161
}

src/Symfony/Component/Intl/ResourceBundle/RegionBundle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function getCountryNames($displayLocale = null)
6464
try {
6565
return $this->getNames($displayLocale);
6666
} catch (MissingResourceException $e) {
67-
return;
67+
return array();
6868
}
6969
}
7070

@@ -76,7 +76,7 @@ public function getLocales()
7676
try {
7777
return $this->localeProvider->getLocales();
7878
} catch (MissingResourceException $e) {
79-
return;
79+
return array();
8080
}
8181
}
8282
}

0 commit comments

Comments
 (0)