Skip to content

Commit c60b73b

Browse files
committed
minor #16292 Update twig_extension.rst (94noni)
This PR was merged into the 6.0 branch. Discussion ---------- Update twig_extension.rst Commits ------- 16d036e Update twig_extension.rst
2 parents 8392ccc + 16d036e commit c60b73b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

templating/twig_extension.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Create a class that extends ``AbstractExtension`` and fill in the logic::
4242
];
4343
}
4444

45-
public function formatPrice($number, $decimals = 0, $decPoint = '.', $thousandsSep = ',')
45+
public function formatPrice(float $number, int $decimals = 0, string $decPoint = '.', string $thousandsSep = ','): string
4646
{
4747
$price = number_format($number, $decimals, $decPoint, $thousandsSep);
4848
$price = '$'.$price;
@@ -69,7 +69,7 @@ If you want to create a function instead of a filter, define the
6969
];
7070
}
7171

72-
public function calculateArea(int $width, int $length)
72+
public function calculateArea(int $width, int $length): int
7373
{
7474
return $width * $length;
7575
}
@@ -157,7 +157,7 @@ previous ``formatPrice()`` method::
157157
// extensions, you'll need to inject services using this constructor
158158
}
159159

160-
public function formatPrice($number, $decimals = 0, $decPoint = '.', $thousandsSep = ',')
160+
public function formatPrice(float $number, int $decimals = 0, string $decPoint = '.', string $thousandsSep = ','): string
161161
{
162162
$price = number_format($number, $decimals, $decPoint, $thousandsSep);
163163
$price = '$'.$price;

0 commit comments

Comments
 (0)