Skip to content

Commit 85347ad

Browse files
committed
minor symfony#11834 [Intl] Mention that all methods trigger exceptions (javiereguiluz)
This PR was merged into the 4.3 branch. Discussion ---------- [Intl] Mention that all methods trigger exceptions This is an important change in the new 4.3 Intl classes, so let's document it. Commits ------- 22a3ea4 [Intl] Mention that all methods trigger exceptions
2 parents 16d9f39 + 22a3ea4 commit 85347ad

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

components/intl.rst

+18-6
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ which defaults to the current default locale::
8888
$language = Languages::getName('fr', 'de');
8989
// => 'Französisch'
9090

91-
You can also check if a given language code is valid::
91+
If the given locale doesn't exist, the methods trigger a
92+
:class:`Symfony\\Component\\Intl\\Exception\\MissingResourceException`. In addition
93+
to catching the exception, you can also check if a given language code is valid::
9294

9395
$isValidLanguage = Languages::exists($languageCode);
9496

@@ -121,7 +123,9 @@ which defaults to the current default locale::
121123
$language = Scripts::getName('Hans', 'de');
122124
// => 'Vereinfacht'
123125

124-
You can also check if a given script code is valid::
126+
If the given script code doesn't exist, the methods trigger a
127+
:class:`Symfony\\Component\\Intl\\Exception\\MissingResourceException`. In addition
128+
to catching the exception, you can also check if a given script code is valid::
125129

126130
$isValidScript = Scripts::exists($scriptCode);
127131

@@ -156,7 +160,9 @@ which defaults to the current default locale::
156160
$country = Countries::getName('GB', 'de');
157161
// => 'Vereinigtes Königreich'
158162

159-
You can also check if a given country code is valid::
163+
If the given country code doesn't exist, the methods trigger a
164+
:class:`Symfony\\Component\\Intl\\Exception\\MissingResourceException`. In addition
165+
to catching the exception, you can also check if a given country code is valid::
160166

161167
$isValidCountry = Countries::exists($countryCode);
162168

@@ -192,7 +198,9 @@ which defaults to the current default locale::
192198
$locale = Locales::getName('zh_Hans_MO', 'de');
193199
// => 'Chinesisch (Vereinfacht, Sonderverwaltungsregion Macau)'
194200

195-
You can also check if a given locale code is valid::
201+
If the given locale code doesn't exist, the methods trigger a
202+
:class:`Symfony\\Component\\Intl\\Exception\\MissingResourceException`. In addition
203+
to catching the exception, you can also check if a given locale code is valid::
196204

197205
$isValidLocale = Locales::exists($localeCode);
198206

@@ -236,7 +244,9 @@ the current default locale::
236244
$currency = Currencies::getName('INR', 'de');
237245
// => 'Indische Rupie'
238246

239-
You can also check if a given currency code is valid::
247+
If the given currency code doesn't exist, the methods trigger a
248+
:class:`Symfony\\Component\\Intl\\Exception\\MissingResourceException`. In addition
249+
to catching the exception, you can also check if a given currency code is valid::
240250

241251
$isValidCurrency = Currencies::exists($currencyCode);
242252

@@ -314,7 +324,9 @@ you can pass the locale as the third optional argument::
314324
$offset = Timezones::getGmtOffset('Europe/Madrid', strtotime('October 28, 2019'), 'ar')); // $offset = 'غرينتش+01:00'
315325
$offset = Timezones::getGmtOffset('Europe/Madrid', strtotime('October 28, 2019'), 'dz')); // $offset = 'ཇི་ཨེམ་ཏི་+01:00'
316326

317-
Finally, you can also check if a given timezone ID is valid::
327+
If the given timezone ID doesn't exist, the methods trigger a
328+
:class:`Symfony\\Component\\Intl\\Exception\\MissingResourceException`. In addition
329+
to catching the exception, you can also check if a given timezone ID is valid::
318330

319331
$isValidTimezone = Timezones::exists($timezoneId);
320332

0 commit comments

Comments
 (0)