diff --git a/CHANGELOG-WIP.md b/CHANGELOG-WIP.md index bc1f9f3a825..a04af1040a7 100644 --- a/CHANGELOG-WIP.md +++ b/CHANGELOG-WIP.md @@ -35,3 +35,4 @@ ### System - Craft now keeps track of which site users registered from. When sending an email from the control panel, the current site is now set to the user’s affiliated site, if known. ([#16174](https://github.com/craftcms/cms/pull/16174)) +- Updated Twig to 3.15. diff --git a/composer.json b/composer.json index abe0f1fd7a3..d74ffcf8fe2 100644 --- a/composer.json +++ b/composer.json @@ -62,7 +62,7 @@ "symfony/var-dumper": "^5.0|^6.0", "symfony/yaml": "^5.2.3", "theiconic/name-parser": "^1.2", - "twig/twig": "~3.14.0", + "twig/twig": "~3.15.0", "voku/stringy": "^6.4.0", "web-auth/webauthn-lib": "~4.9.0", "webonyx/graphql-php": "~14.11.5", diff --git a/composer.lock b/composer.lock index 0739f8991a2..5ba66ecdaaf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0a22f07f1d20a52edbbbd512a4be6394", + "content-hash": "9e6b072943806fb8641d68a79ea0e8c4", "packages": [ { "name": "bacon/bacon-qr-code", @@ -5538,16 +5538,16 @@ }, { "name": "twig/twig", - "version": "v3.14.2", + "version": "v3.15.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a" + "reference": "2d5b3964cc21d0188633d7ddce732dc8e874db02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a", - "reference": "0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/2d5b3964cc21d0188633d7ddce732dc8e874db02", + "reference": "2d5b3964cc21d0188633d7ddce732dc8e874db02", "shasum": "" }, "require": { @@ -5601,7 +5601,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.14.2" + "source": "https://github.com/twigphp/Twig/tree/v3.15.0" }, "funding": [ { @@ -5613,7 +5613,7 @@ "type": "tidelift" } ], - "time": "2024-11-07T12:36:22+00:00" + "time": "2024-11-17T15:59:19+00:00" }, { "name": "voku/anti-xss", diff --git a/src/web/View.php b/src/web/View.php index 43b700fe4e5..b8275394d7e 100644 --- a/src/web/View.php +++ b/src/web/View.php @@ -28,6 +28,7 @@ use craft\web\twig\SinglePreloaderExtension; use craft\web\twig\TemplateLoader; use LogicException; +use Stringable; use Throwable; use Twig\Error\LoaderError as TwigLoaderError; use Twig\Error\RuntimeError as TwigRuntimeError; @@ -393,7 +394,9 @@ public function createTwig(): Environment $twig = new Environment(new TemplateLoader($this), $this->_getTwigOptions()); // Mark SafeHtml as a safe interface - $twig->getRuntime(EscaperRuntime::class)->addSafeClass(SafeHtml::class, ['html']); + /** @var class-string $safeClass */ + $safeClass = SafeHtml::class; + $twig->getRuntime(EscaperRuntime::class)->addSafeClass($safeClass, ['html']); $twig->addExtension(new StringLoaderExtension()); $twig->addExtension(new Extension($this, $twig)); diff --git a/src/web/twig/Extension.php b/src/web/twig/Extension.php index d4e30a9e24c..241de5dd625 100644 --- a/src/web/twig/Extension.php +++ b/src/web/twig/Extension.php @@ -358,6 +358,7 @@ public function getTests(): array /** * @inheritdoc */ + /** @phpstan-ignore-next-line */ public function getOperators(): array { return [