@@ -42,7 +42,7 @@ Create a class that extends ``AbstractExtension`` and fill in the logic::
42
42
];
43
43
}
44
44
45
- public function formatPrice($number, $decimals = 0, $decPoint = '.', $thousandsSep = ',')
45
+ public function formatPrice(float $number, int $decimals = 0, string $decPoint = '.', string $thousandsSep = ','): string
46
46
{
47
47
$price = number_format($number, $decimals, $decPoint, $thousandsSep);
48
48
$price = '$'.$price;
@@ -69,7 +69,7 @@ If you want to create a function instead of a filter, define the
69
69
];
70
70
}
71
71
72
- public function calculateArea(int $width, int $length)
72
+ public function calculateArea(int $width, int $length): int
73
73
{
74
74
return $width * $length;
75
75
}
@@ -157,7 +157,7 @@ previous ``formatPrice()`` method::
157
157
// extensions, you'll need to inject services using this constructor
158
158
}
159
159
160
- public function formatPrice($number, $decimals = 0, $decPoint = '.', $thousandsSep = ',')
160
+ public function formatPrice(float $number, int $decimals = 0, string $decPoint = '.', string $thousandsSep = ','): string
161
161
{
162
162
$price = number_format($number, $decimals, $decPoint, $thousandsSep);
163
163
$price = '$'.$price;
0 commit comments