@@ -67,13 +67,13 @@ public function getTranslatedOptionLocales()
6767 protected function _getOptionLocales ($ translatedName = false )
6868 {
6969 $ currentLocale = $ this ->localeResolver ->getLocale ();
70- $ locales = \ResourceBundle::getLocales (null ) ;
70+ $ locales = \ResourceBundle::getLocales ('' ) ?: [] ;
7171 $ languages = (new LanguageBundle ())->get ($ currentLocale )['Languages ' ];
7272 $ countries = (new RegionBundle ())->get ($ currentLocale )['Countries ' ];
7373
7474 $ options = [];
7575 $ allowedLocales = $ this ->_config ->getAllowedLocales ();
76- foreach (( array ) $ locales as $ locale ) {
76+ foreach ($ locales as $ locale ) {
7777 if (!in_array ($ locale , $ allowedLocales )) {
7878 continue ;
7979 }
@@ -103,7 +103,7 @@ public function getOptionTimezones()
103103 {
104104 $ options = [];
105105 $ locale = $ this ->localeResolver ->getLocale ();
106- $ zones = \DateTimeZone::listIdentifiers (\DateTimeZone::ALL );
106+ $ zones = \DateTimeZone::listIdentifiers (\DateTimeZone::ALL ) ?: [] ;
107107 foreach ($ zones as $ code ) {
108108 $ options [] = [
109109 'label ' => \IntlTimeZone::createTimeZone ($ code )->getDisplayName (
@@ -123,9 +123,8 @@ public function getOptionTimezones()
123123 public function getOptionWeekdays ($ preserveCodes = false , $ ucFirstCode = false )
124124 {
125125 $ options = [];
126- $ days = (new DataBundle ())->get (
127- $ this ->localeResolver ->getLocale ()
128- )['calendar ' ]['gregorian ' ]['dayNames ' ]['format ' ]['wide ' ];
126+ $ days = (new DataBundle ())
127+ ->get ($ this ->localeResolver ->getLocale ())['calendar ' ]['gregorian ' ]['dayNames ' ]['format ' ]['wide ' ] ?: [];
129128 $ englishDays = (new DataBundle ())->get ('en_US ' )['calendar ' ]['gregorian ' ]['dayNames ' ]['format ' ]['abbreviated ' ];
130129 foreach ($ days as $ code => $ name ) {
131130 $ code = $ preserveCodes ? $ englishDays [$ code ] : $ code ;
@@ -140,7 +139,7 @@ public function getOptionWeekdays($preserveCodes = false, $ucFirstCode = false)
140139 public function getOptionCountries ()
141140 {
142141 $ options = [];
143- $ countries = (new RegionBundle ())->get ($ this ->localeResolver ->getLocale ())['Countries ' ];
142+ $ countries = (new RegionBundle ())->get ($ this ->localeResolver ->getLocale ())['Countries ' ] ?: [] ;
144143 foreach ($ countries as $ code => $ name ) {
145144 $ options [] = ['label ' => $ name , 'value ' => $ code ];
146145 }
@@ -152,7 +151,7 @@ public function getOptionCountries()
152151 */
153152 public function getOptionCurrencies ()
154153 {
155- $ currencies = (new CurrencyBundle ())->get ($ this ->localeResolver ->getLocale ())['Currencies ' ];
154+ $ currencies = (new CurrencyBundle ())->get ($ this ->localeResolver ->getLocale ())['Currencies ' ] ?: [] ;
156155 $ options = [];
157156 $ allowed = $ this ->_config ->getAllowedCurrencies ();
158157 foreach ($ currencies as $ code => $ data ) {
@@ -169,7 +168,7 @@ public function getOptionCurrencies()
169168 */
170169 public function getOptionAllCurrencies ()
171170 {
172- $ currencies = (new CurrencyBundle ())->get ($ this ->localeResolver ->getLocale ())['Currencies ' ];
171+ $ currencies = (new CurrencyBundle ())->get ($ this ->localeResolver ->getLocale ())['Currencies ' ] ?: [] ;
173172 $ options = [];
174173 foreach ($ currencies as $ code => $ data ) {
175174 $ options [] = ['label ' => $ data [1 ], 'value ' => $ code ];
0 commit comments