From 801e5e28051a1e7ed20af3574c0a8926425ab417 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Thu, 30 Jul 2015 16:26:35 +0200 Subject: [PATCH] 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. --- .../Component/Intl/ResourceBundle/CurrencyBundle.php | 4 ++-- .../Component/Intl/ResourceBundle/LanguageBundle.php | 6 +++--- src/Symfony/Component/Intl/ResourceBundle/LocaleBundle.php | 4 ++-- src/Symfony/Component/Intl/ResourceBundle/RegionBundle.php | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php b/src/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php index 38254fa036..5a4b35519f 100644 --- a/src/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php +++ b/src/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php @@ -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(); } } } diff --git a/src/Symfony/Component/Intl/ResourceBundle/LanguageBundle.php b/src/Symfony/Component/Intl/ResourceBundle/LanguageBundle.php index bb393d2063..cfe82ca3c3 100644 --- a/src/Symfony/Component/Intl/ResourceBundle/LanguageBundle.php +++ b/src/Symfony/Component/Intl/ResourceBundle/LanguageBundle.php @@ -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(); } } } diff --git a/src/Symfony/Component/Intl/ResourceBundle/LocaleBundle.php b/src/Symfony/Component/Intl/ResourceBundle/LocaleBundle.php index 22c9aecfb3..b14048a40f 100644 --- a/src/Symfony/Component/Intl/ResourceBundle/LocaleBundle.php +++ b/src/Symfony/Component/Intl/ResourceBundle/LocaleBundle.php @@ -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(); } } } diff --git a/src/Symfony/Component/Intl/ResourceBundle/RegionBundle.php b/src/Symfony/Component/Intl/ResourceBundle/RegionBundle.php index 126d62ac04..29697d6883 100644 --- a/src/Symfony/Component/Intl/ResourceBundle/RegionBundle.php +++ b/src/Symfony/Component/Intl/ResourceBundle/RegionBundle.php @@ -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(); } } }