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.
This commit is contained in:
Christophe Coevoet 2015-07-30 16:26:35 +02:00
parent 6b02601e7b
commit 801e5e2805
4 changed files with 9 additions and 9 deletions

View File

@ -76,7 +76,7 @@ class CurrencyBundle extends CurrencyDataProvider implements CurrencyBundleInter
try {
return $this->getNames($displayLocale);
} catch (MissingResourceException $e) {
return;
return array();
}
}
@ -112,7 +112,7 @@ class CurrencyBundle extends CurrencyDataProvider implements CurrencyBundleInter
try {
return $this->localeProvider->getLocales();
} catch (MissingResourceException $e) {
return;
return array();
}
}
}

View File

@ -80,7 +80,7 @@ class LanguageBundle extends LanguageDataProvider implements LanguageBundleInter
try {
return $this->getNames($displayLocale);
} catch (MissingResourceException $e) {
return;
return array();
}
}
@ -104,7 +104,7 @@ class LanguageBundle extends LanguageDataProvider implements LanguageBundleInter
try {
return $this->scriptProvider->getNames($displayLocale);
} catch (MissingResourceException $e) {
return;
return array();
}
}
@ -116,7 +116,7 @@ class LanguageBundle extends LanguageDataProvider implements LanguageBundleInter
try {
return $this->localeProvider->getLocales();
} catch (MissingResourceException $e) {
return;
return array();
}
}
}

View File

@ -31,7 +31,7 @@ class LocaleBundle extends LocaleDataProvider implements LocaleBundleInterface
try {
return parent::getLocales();
} catch (MissingResourceException $e) {
return;
return array();
}
}
@ -55,7 +55,7 @@ class LocaleBundle extends LocaleDataProvider implements LocaleBundleInterface
try {
return $this->getNames($displayLocale);
} catch (MissingResourceException $e) {
return;
return array();
}
}
}

View File

@ -64,7 +64,7 @@ class RegionBundle extends RegionDataProvider implements RegionBundleInterface
try {
return $this->getNames($displayLocale);
} catch (MissingResourceException $e) {
return;
return array();
}
}
@ -76,7 +76,7 @@ class RegionBundle extends RegionDataProvider implements RegionBundleInterface
try {
return $this->localeProvider->getLocales();
} catch (MissingResourceException $e) {
return;
return array();
}
}
}