Skip to content

Commit 832f346

Browse files
committed
Fix Twig deprecation
1 parent 3b2a3c7 commit 832f346

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/guides/src/Twig/AssetsExtension.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@
2828
use Psr\Log\LoggerInterface;
2929
use RuntimeException;
3030
use Stringable;
31+
use Twig\DeprecatedCallableInfo;
3132
use Twig\Extension\AbstractExtension;
3233
use Twig\TwigFunction;
3334
use Twig\TwigTest;
3435

36+
use function class_exists;
3537
use function sprintf;
3638
use function trim;
3739

@@ -57,7 +59,11 @@ public function getFunctions(): array
5759
new TwigFunction('renderNode', $this->renderNode(...), ['is_safe' => ['html'], 'needs_context' => true]),
5860
new TwigFunction('renderLink', $this->renderLink(...), ['is_safe' => ['html'], 'needs_context' => true]),
5961
new TwigFunction('renderBreadcrumb', $this->renderBreadcrumb(...), ['is_safe' => ['html'], 'needs_context' => true]),
60-
new TwigFunction('renderMenu', $this->renderMenu(...), ['is_safe' => ['html'], 'needs_context' => true, 'deprecated' => true]),
62+
new TwigFunction(
63+
'renderMenu',
64+
$this->renderMenu(...),
65+
['is_safe' => ['html'], 'needs_context' => true] + (class_exists(DeprecatedCallableInfo::class) ? ['deprecation_info' => new DeprecatedCallableInfo('phpdocumentor/guides', '1.1.0', 'renderMenu" from "' . GlobalMenuExtension::class)] : ['deprecated' => true]),
66+
),
6167
new TwigFunction('renderTarget', $this->renderTarget(...), ['is_safe' => ['html'], 'needs_context' => true]),
6268
new TwigFunction('renderOrderedListType', $this->renderOrderedListType(...), ['is_safe' => ['html'], 'needs_context' => false]),
6369
];

0 commit comments

Comments
 (0)