Skip to content

Commit

Permalink
feature #50883 [TwigBundle] Allow omitting the `autoescape_service_me…
Browse files Browse the repository at this point in the history
…thod` option when `autoescape_service` is set to an invokable service id (nicolas-grekas)

This PR was merged into the 6.4 branch.

Discussion
----------

[TwigBundle] Allow omitting the `autoescape_service_method` option when `autoescape_service` is set to an invokable service id

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

d3b3d28 [TwigBundle] Allow omitting the `autoescape_service_method` option when `autoescape_service` is set to an invokable service id
  • Loading branch information
fabpot committed Jul 13, 2023
2 parents 6a65ebd + d3b3d28 commit 3688c1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/Symfony/Bundle/TwigBundle/CHANGELOG.md
@@ -1,6 +1,11 @@
CHANGELOG
=========

6.4
---

* Allow omitting the `autoescape_service_method` option when `autoescape_service` is set to an invokable service id

6.3
---

Expand Down
Expand Up @@ -151,8 +151,8 @@ public function load(array $configs, ContainerBuilder $container)
}
}

if (isset($config['autoescape_service']) && isset($config['autoescape_service_method'])) {
$config['autoescape'] = [new Reference($config['autoescape_service']), $config['autoescape_service_method']];
if (isset($config['autoescape_service'])) {
$config['autoescape'] = [new Reference($config['autoescape_service']), $config['autoescape_service_method'] ?? '__invoke'];
}

$container->getDefinition('twig')->replaceArgument(1, array_intersect_key($config, [
Expand Down

0 comments on commit 3688c1b

Please sign in to comment.