Skip to content

Commit

Permalink
use DeprecatedCallableInfo for Twig callables if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Sep 11, 2024
1 parent 978b78a commit d049fbe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Tests/Command/LintCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tester\CommandCompletionTester;
use Symfony\Component\Console\Tester\CommandTester;
use Twig\DeprecatedCallableInfo;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;
use Twig\TwigFilter;
Expand Down Expand Up @@ -163,9 +164,14 @@ private function createCommandTester(): CommandTester
private function createCommand(): Command
{
$environment = new Environment(new FilesystemLoader(\dirname(__DIR__).'/Fixtures/templates/'));
if (class_exists(DeprecatedCallableInfo::class)) {
$options = ['deprecation_info' => new DeprecatedCallableInfo('foo/bar', '1.1')];
} else {
$options = ['deprecated' => true];
}
$environment->addFilter(new TwigFilter('deprecated_filter', function ($v) {
return $v;
}, ['deprecated' => true]));
}, $options));

$command = new LintCommand($environment);

Expand Down

0 comments on commit d049fbe

Please sign in to comment.