Skip to content

Commit 75516f0

Browse files
committed
[LiveComponent] Fix EscaperRuntime deprecation
1 parent 416753f commit 75516f0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/LiveComponent/src/Util/LiveAttributesCollection.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Twig\Environment;
1515
use Twig\Extension\EscaperExtension;
16+
use Twig\Runtime\EscaperRuntime;
1617

1718
/**
1819
* An array of attributes that can eventually be returned as an escaped array.
@@ -114,6 +115,10 @@ public function setQueryUrlMapping(array $queryUrlMapping): void
114115

115116
private function escapeAttribute(string $value): string
116117
{
118+
if (class_exists(EscaperRuntime::class)) {
119+
return $this->twig->getRuntime(EscaperRuntime::class)->escape($value, 'html_attr');
120+
}
121+
117122
if (method_exists(EscaperExtension::class, 'escape')) {
118123
return EscaperExtension::escape($this->twig, $value, 'html_attr');
119124
}

0 commit comments

Comments
 (0)