Skip to content

Use twig.safe_class tag and move setLexer to TwigComponentPass#3455

Draft
GromNaN wants to merge 1 commit intosymfony:3.xfrom
GromNaN:feat-safe-class-pass-integration
Draft

Use twig.safe_class tag and move setLexer to TwigComponentPass#3455
GromNaN wants to merge 1 commit intosymfony:3.xfrom
GromNaN:feat-safe-class-pass-integration

Conversation

@GromNaN
Copy link
Copy Markdown
Member

@GromNaN GromNaN commented Apr 10, 2026

Q A
Branch? 3.x
Bug fix? no
New feature? no
Issues Related to symfony/symfony#63929
License MIT

Implements the twig.safe_class tag proposed in symfony/symfony#63929.

When symfony/twig-bundle ships SafeClassPass, the TwigEnvironmentConfigurator decorator is no longer needed to register ComponentAttributes as a safe class. This PR detects its presence and uses the new twig.safe_class resource tag instead, falling back to the decorator for older versions.

The setLexer() call is moved from the configurator into TwigComponentPass, which is a more appropriate place.

@GromNaN GromNaN force-pushed the feat-safe-class-pass-integration branch from 4ec4be8 to 85b3844 Compare April 10, 2026 17:57
->addTag('twig.runtime')
;

$container->register('ux.twig_component.twig.lexer', ComponentLexer::class);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This declaration was not used. A new ComponentLexer instance was created in the configurator.

@Kocal
Copy link
Copy Markdown
Member

Kocal commented Apr 14, 2026

Hi, Symfony UX 3.0 has been released, and the 2.x branch is no longer maintained.

Could you please retarget this PR to the 3.x branch instead? That way we can review and merge it in the currently supported version.

Thanks!

@Kocal Kocal added the Status: Needs Work Additional work is needed label Apr 14, 2026
@carsonbot carsonbot changed the title [TwigComponent] Use twig.safe_class tag and move setLexer to TwigComponentPass Use twig.safe_class tag and move setLexer to TwigComponentPass Apr 14, 2026
@GromNaN GromNaN changed the base branch from 2.x to 3.x April 14, 2026 11:48
@GromNaN GromNaN force-pushed the feat-safe-class-pass-integration branch from 85b3844 to 90a3a58 Compare April 30, 2026 10:09
@carsonbot carsonbot added Status: Needs Review Needs to be reviewed and removed Status: Needs Work Additional work is needed labels Apr 30, 2026
@GromNaN GromNaN changed the title Use twig.safe_class tag and move setLexer to TwigComponentPass Use twig.safe_class tag and move `setLexer to TwigComponentPass Apr 30, 2026
@GromNaN GromNaN changed the title Use twig.safe_class tag and move `setLexer to TwigComponentPass Use twig.safe_class tag and move setLexer to TwigComponentPass Apr 30, 2026
@GromNaN GromNaN marked this pull request as ready for review April 30, 2026 10:11
@GromNaN
Copy link
Copy Markdown
Member Author

GromNaN commented Apr 30, 2026

The test failure looks related.

@GromNaN
Copy link
Copy Markdown
Member Author

GromNaN commented Apr 30, 2026

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

Labels

Status: Needs Review Needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants