Skip to content

Commit

Permalink
feature #54657 [TwigBundle] Deprecate base_template_class option (S…
Browse files Browse the repository at this point in the history
…teveb-p)

This PR was merged into the 7.1 branch.

Discussion
----------

[TwigBundle] Deprecate `base_template_class` option

| Q             | A
| ------------- | ---
| Branch?       | 7.1
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Issues        | <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead -->
| License       | MIT

According to https://github.com/twigphp/Twig/blob/3.x/CHANGELOG#L222, `base_template_class` option has been removed from Twig 3.0.

Symfony still allows to pass this configuration option via https://github.com/symfony/symfony/blob/7.1/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php#L132, but there is of course no effect.

I think it would be good to deprecate it and prepare it's removal in 8.x? Since Symfony 7.x requires Twig 3.x.

<!--
Replace this notice by a description of your feature/bugfix.
This will help reviewers and should be a good start for the documentation.

Additionally (see https://symfony.com/releases):
 - Always add tests and ensure they pass.
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against the latest branch.
 - For new features, provide some code snippets to help understand usage.
 - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
 - Never break backward compatibility (see https://symfony.com/bc).
-->

Commits
-------

c30d14f Deprecate Twig Bundle `base_template_class` option
  • Loading branch information
fabpot committed May 2, 2024
2 parents 03e0318 + c30d14f commit 4c84578
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -129,7 +129,11 @@ private function addTwigOptions(ArrayNodeDefinition $rootNode): void
->children()
->scalarNode('autoescape_service')->defaultNull()->end()
->scalarNode('autoescape_service_method')->defaultNull()->end()
->scalarNode('base_template_class')->example('Twig\Template')->cannotBeEmpty()->end()
->scalarNode('base_template_class')
->setDeprecated('symfony/twig-bundle', '7.1')
->example('Twig\Template')
->cannotBeEmpty()
->end()
->scalarNode('cache')->defaultValue('%kernel.cache_dir%/twig')->end()
->scalarNode('charset')->defaultValue('%kernel.charset%')->end()
->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
Expand Down

0 comments on commit 4c84578

Please sign in to comment.