Skip to content

Add Twig 4 support - #1673

Open
winniezzz wants to merge 1 commit into
liip:2.xfrom
winniezzz:twig-4-support
Open

winniezzz wants to merge 1 commit into
liip:2.xfrom
winniezzz:twig-4-support

Conversation

@winniezzz

Copy link
Copy Markdown

Twig 4 adds native return types to ExtensionInterface, so the deprecated FilterExtension, used by the default "legacy" twig mode, failed with a fatal error. Add the missing array return type, widen the twig/twig constraint, add tests rendering real Twig templates and a CI job running the suite against Twig 4.

Refs #1672

Q A
Branch? 2.x
Bug fix? yes
New feature? yes
BC breaks? no
Deprecations? yes
Fixed tickets #1672
License MIT

@SebLevDev

Copy link
Copy Markdown

Thanks

@dbu dbu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks for looking into this. i am happy to merge the return type change and the additional tests already - we can only allow twig 4 once its released.

you are adding a bunch of missing tests, which i appreciate. but please change the FilterExtensionTest & LazyFilterExtensionTest to use the same base class with the test cases. unless i miss something, both extensions should have the exact same behaviour, so only the setup should be different, but the tests should be the same.

Comment thread Templating/FilterExtension.php Resolved
Comment thread composer.json Resolved
Comment thread CHANGELOG.md Resolved
Comment thread .github/workflows/phpunit.yml Resolved
@winniezzz winniezzz changed the title Add support for Twig 4 Add missing return type for Twig 4 compatibility Nov 2, 2026
@winniezzz winniezzz changed the title Add missing return type for Twig 4 compatibility Add Twig 4 support Nov 2, 2026
@winniezzz
winniezzz requested a review from dbu November 2, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants