@@ -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