Skip to content

Commit 9f19007

Browse files
[Templating]: Adding named attribute arguments
Page: https://symfony.com/doc/current/templates.html#create-the-extension-class Isn't there a best practice somewhere to always pass the name explicitly?
1 parent c59af97 commit 9f19007

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

templates.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ the Twig filter::
15661566

15671567
class AppExtension
15681568
{
1569-
#[AsTwigFilter('price')]
1569+
#[AsTwigFilter(name: 'price')]
15701570
public function formatPrice(float $number, int $decimals = 0, string $decPoint = '.', string $thousandsSep = ','): string
15711571
{
15721572
$price = number_format($number, $decimals, $decPoint, $thousandsSep);
@@ -1588,7 +1588,7 @@ If you want to create a function instead of a filter, use the
15881588

15891589
class AppExtension
15901590
{
1591-
#[AsTwigFunction('area')]
1591+
#[AsTwigFunction(name: 'area')]
15921592
public function calculateArea(int $width, int $length): int
15931593
{
15941594
return $width * $length;

0 commit comments

Comments
 (0)