10000 Reworded the entire explanation · symfony/symfony-docs@5415514 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5415514

Browse files
committed
Reworded the entire explanation
1 parent 49d2f62 commit 5415514

File tree

1 file changed

+31
-24
lines changed

1 file changed

+31
-24
lines changed

components/intl.rst

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -262,33 +262,40 @@ as some of their information (symbol, fraction digits, etc.)::
262262
$symbol = Currencies::getSymbol('INR');
263263
// => '₹'
264264

265-
// number of digits to display when formatting numbers with this currency;
266-
// see getCashFractionDigits() to format values used in cash transactions
267-
$fractionDigits = Currencies::getFractionDigits('INR');
268-
// => 2
269-
270-
// numbers formatted in this currency should be rounded to the nearest
271-
// increment of this value (e.g. some countries round values to 5 cents);
272-
// see getCashRoundingIncrement() for the rounding rules of cash transactions
273-
$roundingIncrement = Currencies::getRoundingIncrement('INR');
274-
// => 0
275-
276-
// number of digits to display when numbers are used to indicate cash transactions;
277-
// see getFractionDigits() to format numbers for other use cases (e.g. accounting)
278-
$cashFractionDigits = Currencies::getCashFractionDigits('INR');
279-
// => 2
280-
281-
// cash transactions in this currency must be rounded to the nearest increment
282-
// of this value (e.g. some countries round to 5 cents because they have
283-
// eliminated 1-cent and 2-cent coins);
284-
// see getRoundingIncrement() for the rounding rules of other use cases (e.g. accounting)
285-
$cashRoundingIncrement = Currencies::getCashRoundingIncrement('INR');
286-
// => 0
265+
The fraction digits methods return the number of digits to display when
266+
formatting numbers with this currency. Depending on the currency, this value
267+
can change if the number is used in cash transactions or in other scenarios
268+
(e.g. accounting)::
269+
270+
// Indian rupee defines the same value for both
271+
$fractionDigits = Currencies::getFractionDigits('INR'); // returns: 2
272+
$cashFractionDigits = Currencies::getCashFractionDigits('INR'); // returns: 2
273+
274+
// Swedish krona defines different values
275+
$fractionDigits = Currencies::getFractionDigits('SEK'); // returns: 2
276+
$cashFractionDigits = Currencies::getCashFractionDigits('SEK'); // returns: 0
277+
278+
.. versionadded:: 5.3
279+
280+
The ``getCashFractionDigits()`` method was introduced in Symfony 5.3.
281+
282+
Depending on the currency, numbers must be formatted to the nearest increment
283+
of some value (e.g. 5 cents). This increment might be different if numbers are
284+
formatted for cash transactions or other scenarios (e.g. accounting)::
285+
286+
// Indian ruppee defines the same value for both
287+
$roundingIncrement = Currencies::getRoundingIncrement('INR'); // returns: 0
288+
$cashRoundingIncrement = Currencies::getCashRoundingIncrement('INR'); // returns: 0
289+
290+
// Canadian dollar defines different values because they have eliminated
291+
// the smaller coins (1-cent and 2-cent) and prices in cash must be rounded to
292+
// 5 cents (e.g. if price is 7,42 you pay 7,40; if price is 7,48 you pay 7,50)
293+
$roundingIncrement = Currencies::getRoundingIncrement('CAD'); // returns: 0
294+
$cashRoundingIncrement = Currencies::getCashRoundingIncrement('CAD'); // returns: 5
287295

288296
.. versionadded:: 5.3
289297

290-
The ``getCashFractionDigits()`` and ``getCashRoundingIncrement()`` methods
291-
were introduced in Symfony 5.3.
298+
The ``getCashRoundingIncrement()`` method was introduced in Symfony 5.3.
292299

293300
All methods (except for ``getFractionDigits()``, ``getCashFractionDigits()``,
294301
``getRoundingIncrement()`` and ``getCashRoundingIncrement()``) accept the

0 commit comments

Comments
 (0)
0