8000 Fixed more Twig class namespaces · symfony/symfony-docs@ee8f1d0 · GitHub
[go: up one dir, main page]

Skip to content

Commit ee8f1d0

Browse files
committed
Fixed more Twig class namespaces
1 parent 9f95a7a commit ee8f1d0

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

components/form.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
199199
$vendorTwigBridgeDirectory.'/Resources/views/Form',
200200
)));
201201
$formEngine = new TwigRendererEngine(array($defaultFormTheme), $twig);
202-
$twig->addRuntimeLoader(new \Twig_FactoryRuntimeLoader(array(
202+
$twig->addRuntimeLoader(new FactoryRuntimeLoader(array(
203203
FormRenderer::class => function () use ($formEngine, $csrfManager) {
204204
return new FormRenderer($formEngine, $csrfManager);
205205
},
@@ -216,7 +216,7 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
216216
->getFormFactory();
217217

218218
.. versionadded:: 1.30
219-
The ``Twig_FactoryRuntimeLoader`` was introduced in Twig 1.30.
219+
The ``Twig\\RuntimeLoader\\FactoryRuntimeLoader`` was introduced in Twig 1.30.
220220

221221
The exact details of your `Twig Configuration`_ will vary, but the goal is
222222
always to add the :class:`Symfony\\Bridge\\Twig\\Extension\\FormExtension`

controller/service.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,13 @@ service and use it directly::
101101
namespace AppBundle\Controller;
102102

103103
use Symfony\Component\HttpFoundation\Response;
104+
use Twig\Environment;
104105

105106
class HelloController
106107
{
107108
private $twig;
108109

109-
public function __construct(\Twig_Environment $twig)
110+
public function __construct(Environment $twig)
110111
{
111112
$this->twig = $twig;
112113
}

service_container.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ security.authorization_checker ``Symfony\Component\Security\Core\Authorization\
7171
security.password_encoder ``Symfony\Component\Security\Core\Encoder\UserPasswordEncoder``
7272
session ``Symfony\Component\HttpFoundation\Session\Session``
7373
translator ``Symfony\Component\Translation\DataCollectorTranslator``
74-
twig ``Twig_Environment``
74+
twig ``Twig\Environment``
7575
validator ``Symfony\Component\Validator\Validator\ValidatorInterface``
7676
=============================== =======================================================================
7777

@@ -837,7 +837,7 @@ But, with ``autoconfigure: true``, you don't need the tag. In fact, if you're us
837837
the :ref:`Symfony Standard Edition services.yml config <service-container-services-load-example>`,
838838
you don't need to do *anything*: the service will be automatically loaded. Then,
839839
``autoconfigure`` will add the ``twig.extension`` tag *for* you, because your class
840-
implements ``Twig_ExtensionInterface``. And thanks to ``autowire``, you can even add
840+
implements ``Twig\\Extension\\ExtensionInterface``. And thanks to ``autowire``, you can even add
841841
constructor arguments without any configuration.
842842

843843
Of course, you can still :ref:`manually configure the service <services-manually-wire-args>`

service_container/tags.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ Autoconfiguring Tags
6060

6161
Starting in Symfony 3.3, if you enable :ref:`autoconfigure <services-autoconfigure>`,
6262
then some tags are automatically applied for you. That's true for the ``twig.extension``
63-
tag: the container sees that your class extends ``Twig_Extension`` (or more accurately,
64-
that it implements ``Twig_ExtensionInterface``) and adds the tag for you.
63+
tag: the container sees that your class extends ``AbstractExtension`` (or more accurately,
64+
that it implements ``ExtensionInterface``) and adds the tag for you.
6565

6666
.. tip::
6767

templating/twig_extension.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ money:
2121
{# pass in the 3 optional arguments #}
2222
{{ product.price|price(2, ',', '.') }}
2323
24-
Create a class that extends ``\Twig_Extension`` and fill in the logic::
24+
Create a class that extends ``AbstractExtension`` and fill in the logic::
2525

2626
// src/AppBundle/Twig/AppExtension.php
2727
namespace AppBundle\Twig;
@@ -94,14 +94,16 @@ callable defined in ``getFilters()``::
9494
namespace AppBundle\Twig;
9595

9696
use AppBundle\Twig\AppRuntime;
97+
use Twig\Extension\AbstractExtension;
98+
use Twig\TwigFilter;
9799

98-
class AppExtension extends \Twig_Extension
100+
class AppExtension extends AbstractExtension
99101
{
100102
public function getFilters()
101103
{
102104
return array(
103105
// the logic of this filter is now implemented in a different class
104-
new \Twig_SimpleFilter('price', array(AppRuntime::class, 'priceFilter')),
106+
new TwigFilter('price', array(AppRuntime::class, 'priceFilter')),
105107
);
106108
}
107109
}

0 commit comments

Comments
 (0)
0