Skip to content

Add the missing security Twig functions to the dummy extension - #57

Open
Amoifr wants to merge 1 commit into
symfony-tools:mainfrom
Amoifr:add-security-twig-functions
Open

Add the missing security Twig functions to the dummy extension#57
Amoifr wants to merge 1 commit into
symfony-tools:mainfrom
Amoifr:add-security-twig-functions

Conversation

@Amoifr

@Amoifr Amoifr commented Jul 11, 2026

Copy link
Copy Markdown

While documenting the access_decision() Twig functions in symfony/symfony-docs#22452, the Code Blocks check failed with:

[Twig] Unknown "access_decision" function.
[Twig] Unknown "access_decision_for_user" function.

The functions do exist (they are registered by Symfony\Bridge\Twig\Extension\SecurityExtension), but they are missing from DummyExtension, so any new Twig code block using them is reported as invalid.

Comparing SecurityExtension::getFunctions() with DummyExtension, 5 of its 8 functions were missing:

  • is_granted_for_user
  • access_decision
  • access_decision_for_user
  • impersonation_path
  • impersonation_url

Three of them (is_granted_for_user, impersonation_path, impersonation_url) are already documented in reference/twig_reference.rst; they go unnoticed today only because their code blocks predate the baseline.

The added test fails on main (1 issue reported) and passes with this change.

Thanks a lot for maintaining this tool — it caught a real mistake of mine in the very same PR, so I'm happy to give a little back. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant