@@ -67,13 +67,13 @@ public function getTranslatedOptionLocales()
67
67
protected function _getOptionLocales ($ translatedName = false )
68
68
{
69
69
$ currentLocale = $ this ->localeResolver ->getLocale ();
70
- $ locales = \ResourceBundle::getLocales (null ) ;
70
+ $ locales = \ResourceBundle::getLocales ('' ) ?: [] ;
71
71
$ languages = (new LanguageBundle ())->get ($ currentLocale )['Languages ' ];
72
72
$ countries = (new RegionBundle ())->get ($ currentLocale )['Countries ' ];
73
73
74
74
$ options = [];
75
75
$ allowedLocales = $ this ->_config ->getAllowedLocales ();
76
- foreach (( array ) $ locales as $ locale ) {
76
+ foreach ($ locales as $ locale ) {
77
77
if (!in_array ($ locale , $ allowedLocales )) {
78
78
continue ;
79
79
}
@@ -103,7 +103,7 @@ public function getOptionTimezones()
103
103
{
104
104
$ options = [];
105
105
$ locale = $ this ->localeResolver ->getLocale ();
106
- $ zones = \DateTimeZone::listIdentifiers (\DateTimeZone::ALL );
106
+ $ zones = \DateTimeZone::listIdentifiers (\DateTimeZone::ALL ) ?: [] ;
107
107
foreach ($ zones as $ code ) {
108
108
$ options [] = [
109
109
'label ' => \IntlTimeZone::createTimeZone ($ code )->getDisplayName (
@@ -123,9 +123,8 @@ public function getOptionTimezones()
123
123
public function getOptionWeekdays ($ preserveCodes = false , $ ucFirstCode = false )
124
124
{
125
125
$ 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 ' ] ?: [];
129
128
$ englishDays = (new DataBundle ())->get ('en_US ' )['calendar ' ]['gregorian ' ]['dayNames ' ]['format ' ]['abbreviated ' ];
130
129
foreach ($ days as $ code => $ name ) {
131
130
$ code = $ preserveCodes ? $ englishDays [$ code ] : $ code ;
@@ -140,7 +139,7 @@ public function getOptionWeekdays($preserveCodes = false, $ucFirstCode = false)
140
139
public function getOptionCountries ()
141
140
{
142
141
$ options = [];
143
- $ countries = (new RegionBundle ())->get ($ this ->localeResolver ->getLocale ())['Countries ' ];
142
+ $ countries = (new RegionBundle ())->get ($ this ->localeResolver ->getLocale ())['Countries ' ] ?: [] ;
144
143
foreach ($ countries as $ code => $ name ) {
145
144
$ options [] = ['label ' => $ name , 'value ' => $ code ];
146
145
}
@@ -152,7 +151,7 @@ public function getOptionCountries()
152
151
*/
153
152
public function getOptionCurrencies ()
154
153
{
155
- $ currencies = (new CurrencyBundle ())->get ($ this ->localeResolver ->getLocale ())['Currencies ' ];
154
+ $ currencies = (new CurrencyBundle ())->get ($ this ->localeResolver ->getLocale ())['Currencies ' ] ?: [] ;
156
155
$ options = [];
157
156
$ allowed = $ this ->_config ->getAllowedCurrencies ();
158
157
foreach ($ currencies as $ code => $ data ) {
@@ -169,7 +168,7 @@ public function getOptionCurrencies()
169
168
*/
170
169
public function getOptionAllCurrencies ()
171
170
{
172
- $ currencies = (new CurrencyBundle ())->get ($ this ->localeResolver ->getLocale ())['Currencies ' ];
171
+ $ currencies = (new CurrencyBundle ())->get ($ this ->localeResolver ->getLocale ())['Currencies ' ] ?: [] ;
173
172
$ options = [];
174
173
foreach ($ currencies as $ code => $ data ) {
175
174
$ options [] = ['label ' => $ data [1 ], 'value ' => $ code ];
0 commit comments