From 96c4c275add35216d8d3fbbb45c0bdd179556111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Wed, 13 Jun 2018 21:48:59 +0200 Subject: [PATCH] Do not remove escaping on TwigFilter by default --- src/Resources/skeleton/twig/Extension.tpl.php | 5 ++++- src/Test/MakerTestEnvironment.php | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Resources/skeleton/twig/Extension.tpl.php b/src/Resources/skeleton/twig/Extension.tpl.php index e6949f0c5..32ae02e7f 100644 --- a/src/Resources/skeleton/twig/Extension.tpl.php +++ b/src/Resources/skeleton/twig/Extension.tpl.php @@ -11,7 +11,10 @@ class extends AbstractExtension public function getFilters(): array { return [ - new TwigFilter('filter_name', [$this, 'doSomething'], ['is_safe' => ['html']]), + // If your filter generates SAFE HTML, you should add a third + // parameter: ['is_safe' => ['html']] + // Reference: https://twig.symfony.com/doc/2.x/advanced.html#automatic-escaping + new TwigFilter('filter_name', [$this, 'doSomething']), ]; } diff --git a/src/Test/MakerTestEnvironment.php b/src/Test/MakerTestEnvironment.php index b3a37e9b1..722594862 100644 --- a/src/Test/MakerTestEnvironment.php +++ b/src/Test/MakerTestEnvironment.php @@ -56,9 +56,9 @@ private function __construct(MakerTestDetails $testDetails) $this->cachePath = realpath($cachePath); $this->flexPath = $this->cachePath.'/flex_project'; - $this->path = $this->cachePath.DIRECTORY_SEPARATOR.$testDetails->getUniqueCacheDirectoryName(); + $this->path = $this->cachePath.\DIRECTORY_SEPARATOR.$testDetails->getUniqueCacheDirectoryName(); - $this->snapshotFile = $this->path.DIRECTORY_SEPARATOR.basename($this->path).'.json'; + $this->snapshotFile = $this->path.\DIRECTORY_SEPARATOR.basename($this->path).'.json'; } public static function create(MakerTestDetails $testDetails): self