From 1f96545e6dd42f3b08d57c496ede7695d2da8b7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20T=27JAMPENS?= Date: Thu, 5 Jul 2018 20:48:42 +0200 Subject: [PATCH 1/3] Add missing RuntimeExtensionInterface If the Twig runtime class does not implement RuntimeExtensionInterface, the autoconfigure feature of the container will not tag it with `twig.runtime`, and an exception will be thrown ("Unable to load the "App\Twig\AppRuntime" runtime.") --- templating/twig_extension.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templating/twig_extension.rst b/templating/twig_extension.rst index 3a08ec059d7..2f656f104c5 100644 --- a/templating/twig_extension.rst +++ b/templating/twig_extension.rst @@ -117,8 +117,10 @@ previous ``priceFilter()`` method:: // src/Twig/AppRuntime.php namespace App\Twig; + + use use Twig\Extension\RuntimeExtensionInterface; - class AppRuntime + class AppRuntime implements RuntimeExtensionInterface { public function __construct() { From 60660c8e6691b22ee060c6b98ae2413d40ffcbf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20T=27JAMPENS?= Date: Thu, 5 Jul 2018 21:15:02 +0200 Subject: [PATCH 2/3] Remove duplicate `use` keyword --- templating/twig_extension.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templating/twig_extension.rst b/templating/twig_extension.rst index 2f656f104c5..39189f59ccc 100644 --- a/templating/twig_extension.rst +++ b/templating/twig_extension.rst @@ -118,7 +118,7 @@ previous ``priceFilter()`` method:: // src/Twig/AppRuntime.php namespace App\Twig; - use use Twig\Extension\RuntimeExtensionInterface; + use Twig\Extension\RuntimeExtensionInterface; class AppRuntime implements RuntimeExtensionInterface { From 709970bb471798201c3fedab68ea776d91ab77a9 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 6 Jul 2018 09:26:13 +0200 Subject: [PATCH 3/3] Added the missing versionadded directive --- templating/twig_extension.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templating/twig_extension.rst b/templating/twig_extension.rst index 39189f59ccc..bc84e6ae6e2 100644 --- a/templating/twig_extension.rst +++ b/templating/twig_extension.rst @@ -137,6 +137,9 @@ previous ``priceFilter()`` method:: } } + .. versionadded:: 3.4 + The ``RuntimeExtensionInterface`` was introduced in Symfony 3.4. + If you're using the default ``services.yaml`` configuration, this will already work! Otherwise, :ref:`create a service ` for this class and :doc:`tag your service ` with ``twig.runtime``.