10000 minor #58235 [TwigBridge] use DeprecatedCallableInfo for Twig callabl… · symfony/symfony@60a717d · GitHub
[go: up one dir, main page]

Skip to content

Commit 60a717d

Browse files
minor #58235 [TwigBridge] use DeprecatedCallableInfo for Twig callables if possible (xabbuh)
This PR was merged into the 5.4 branch. Discussion ---------- [TwigBridge] use DeprecatedCallableInfo for Twig callables if possible | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT see twigphp/Twig#4291 Commits ------- 76e80d7 use DeprecatedCallableInfo for Twig callables if possible
2 parents fea8f98 + 76e80d7 commit 60a717d

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)
0