From 9f190072026edb2b8f9672292ca2b15a2eda1acd Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Fri, 30 May 2025 18:33:04 +0200 Subject: [PATCH] [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? --- templates.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates.rst b/templates.rst index 530f98fcd5d..60297089c61 100644 --- a/templates.rst +++ b/templates.rst @@ -1566,7 +1566,7 @@ the Twig filter:: class AppExtension { - #[AsTwigFilter('price')] + #[AsTwigFilter(name: 'price')] public function formatPrice(float $number, int $decimals = 0, string $decPoint = '.', string $thousandsSep = ','): string { $price = number_format($number, $decimals, $decPoint, $thousandsSep); @@ -1588,7 +1588,7 @@ If you want to create a function instead of a filter, use the class AppExtension { - #[AsTwigFunction('area')] + #[AsTwigFunction(name: 'area')] public function calculateArea(int $width, int $length): int { return $width * $length;