Skip to content

Commit 356e979

Browse files
xabbuhsymfonyaml
authored and
symfonyaml
committed
use DeprecatedCallableInfo for Twig callables if possible
1 parent 2727513 commit 356e979

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\Console\Output\OutputInterface;
1919
use Symfony\Component\Console\Tester\CommandCompletionTester;
2020
use Symfony\Component\Console\Tester\CommandTester;
21+
use Twig\DeprecatedCallableInfo;
2122
use Twig\Environment;
2223
use Twig\Loader\FilesystemLoader;
2324
use Twig\TwigFilter;
@@ -163,9 +164,14 @@ private function createCommandTester(): CommandTester
163164
private function createCommand(): Command
164165
{
165166
$environment = new Environment(new FilesystemLoader(\dirname(__DIR__).'/Fixtures/templates/'));
167+
if (class_exists(DeprecatedCallableInfo::class)) {
168+
$options = ['deprecation_info' => new DeprecatedCallableInfo('foo/bar', '1.1')];
169+
} else {
170+
$options = ['deprecated' => true];
171+
}
166172
$environment->addFilter(new TwigFilter('deprecated_filter', function ($v) {
167173
return $v;
168-
}, ['deprecated' => true]));
174+
}, $options));
169175

170176
$command = new LintCommand($environment);
171177

0 commit comments

Comments
 (0)