From 9e0ea046920704fe0ec681f902f8506668d9ef4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Thu, 2 Apr 2026 12:07:23 +0200 Subject: [PATCH] [Twig] Enhance documentation about is_granted() twig function It's better to call the var `attribute`, because it's the Symfony naming: * https://github.com/symfony/symfony/blob/8.1/src/Symfony/Component/Security/Core/Authorization/AuthorizationCheckerInterface.php#L27 * https://github.com/symfony/symfony/blob/8.1/src/Symfony/Component/Security/Core/Authorization/Voter/Voter.php#L97-L107 And it fixes a typo on the type:https://github.com/symfony/symfony/blob/8.1/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php#L37 --- reference/twig_reference.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index 8ad72575e82..dcbb80a9519 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -187,12 +187,12 @@ is_granted .. code-block:: twig - {{ is_granted(role, object = null, field = null) }} + {{ is_granted(attribute, subject = null, field = null) }} -``role`` +``attribute`` **type**: ``string`` -``object`` *(optional)* - **type**: ``object`` +``subject`` *(optional)* + **type**: ``mixed`` ``field`` *(optional)* **type**: ``string``