Skip to content

Commit eafb46f

Browse files
committed
More fixes about Twig classes namespaces
1 parent a84a2f0 commit eafb46f

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

best_practices/templates.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,16 @@ Markdown content into HTML::
112112
}
113113

114114
Next, create a new Twig extension and define a new filter called ``md2html``
115-
using the ``Twig_SimpleFilter`` class. Inject the newly defined ``markdown``
115+
using the ``Twig\TwigFilter`` class. Inject the newly defined ``markdown``
116116
service in the constructor of the Twig extension::
117117

118118
namespace AppBundle\Twig;
119119

120120
use AppBundle\Utils\Markdown;
121+
use Twig\Extension\AbstractExtension;
122+
use Twig\TwigFilter;
121123

122-
class AppExtension extends \Twig_Extension
124+
class AppExtension extends AbstractExtension
123125
{
124126
private $parser;
125127

@@ -131,7 +133,7 @@ service in the constructor of the Twig extension::
131133
public function getFilters()
132134
{
133135
return array(
134-
new \Twig_SimpleFilter(
136+
new TwigFilter(
135137
'md2html',
136138
array($this, 'markdownToHtml'),
137139
array('is_safe' => array('html'), 'pre_escape' => 'html')

components/form.rst

-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
183183
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
184184
use Twig\Environment;
185185
use Twig\Loader\FilesystemLoader;
186-
use Twig\RuntimeLoader\FactoryRuntimeLoader;
187186

188187
// the Twig file that holds all the default markup for rendering forms
189188
// this file comes with TwigBridge

service_container.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ security.authorization_checker ``Symfony\Component\Security\Core\Authorization\
7777
security.password_encoder ``Symfony\Component\Security\Core\Encoder\UserPasswordEncoder``
7878
session ``Symfony\Component\HttpFoundation\Session\Session``
7979
translator ``Symfony\Component\Translation\DataCollectorTranslator``
80-
twig ``Twig_Environment``
80+
twig ``Twig\Environment``
8181
validator ``Symfony\Component\Validator\Validator\ValidatorInterface``
8282
=============================== =======================================================================
8383

0 commit comments

Comments
 (0)