From b3d889eac8ee10f6a91da259aff560e29d5b3a16 Mon Sep 17 00:00:00 2001 From: Gordon Franke Date: Wed, 23 Oct 2024 14:11:13 +0200 Subject: [PATCH 1/3] feat: remove twig 2.x support no more maintained --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e28adc8..ed438c9 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "php-translation/symfony-storage": "^2.1", "php-translation/extractor": "^2.0", "nyholm/nsa": "^1.1", - "twig/twig": "^2.14.4 || ^3.3", + "twig/twig": "^3.12", "symfony/asset": "^5.3 || ^6.0 || ^7.0" }, "require-dev": { From c1c4254df687aa5085a2a79c5e7c5baab5fe00a8 Mon Sep 17 00:00:00 2001 From: Gordon Franke Date: Wed, 26 Mar 2025 13:35:58 +0100 Subject: [PATCH 2/3] refac: phpunit setMethods => onlyMethods --- Tests/Unit/Translator/FallbackTranslatorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Unit/Translator/FallbackTranslatorTest.php b/Tests/Unit/Translator/FallbackTranslatorTest.php index bafd652..b10a8a2 100644 --- a/Tests/Unit/Translator/FallbackTranslatorTest.php +++ b/Tests/Unit/Translator/FallbackTranslatorTest.php @@ -44,7 +44,7 @@ public function testTranslateWithSubstitutedParameters(): void $symfonyTranslator = $this->getMockBuilder(TranslatorInterface::class)->getMock(); $translatorService = $this->getMockBuilder(TranslatorService::class) - ->setMethods(['translate']) + ->onlyMethods(['translate']) ->getMock(); $translatorService->method('translate')->willReturnArgument(0); From a70c38fbb03a627110a40d0d95cd3198f0780b75 Mon Sep 17 00:00:00 2001 From: Gordon Franke Date: Wed, 26 Mar 2025 13:36:37 +0100 Subject: [PATCH 3/3] refac: fix deprecations for DefaultApplyingNodeVisitor --- Twig/Visitor/DefaultApplyingNodeVisitor.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Twig/Visitor/DefaultApplyingNodeVisitor.php b/Twig/Visitor/DefaultApplyingNodeVisitor.php index 9c112a7..426795c 100644 --- a/Twig/Visitor/DefaultApplyingNodeVisitor.php +++ b/Twig/Visitor/DefaultApplyingNodeVisitor.php @@ -15,11 +15,11 @@ use Twig\Environment; use Twig\Node\Expression\ArrayExpression; use Twig\Node\Expression\Binary\EqualBinary; -use Twig\Node\Expression\ConditionalExpression; use Twig\Node\Expression\ConstantExpression; use Twig\Node\Expression\FilterExpression; +use Twig\Node\Expression\Ternary\ConditionalTernary; use Twig\Node\Node; -use Twig\NodeVisitor\AbstractNodeVisitor; +use Twig\NodeVisitor\NodeVisitorInterface; /** * Applies the value of the "desc" filter if the "trans" filter has no @@ -29,7 +29,7 @@ * * @author Johannes M. Schmitt */ -final class DefaultApplyingNodeVisitor extends AbstractNodeVisitor +final class DefaultApplyingNodeVisitor implements NodeVisitorInterface { /** * @var bool @@ -41,7 +41,7 @@ public function setEnabled(bool $bool): void $this->enabled = $bool; } - public function doEnterNode(Node $node, Environment $env): Node + public function enterNode(Node $node, Environment $env): Node { if (!$this->enabled) { return $node; @@ -103,7 +103,7 @@ public function doEnterNode(Node $node, Environment $env): Node ); } - $condition = new ConditionalExpression( + $condition = new ConditionalTernary( new EqualBinary($testNode, $transNode->getNode('node'), $wrappingNode->getTemplateLine()), $defaultNode, clone $wrappingNode, @@ -114,7 +114,7 @@ public function doEnterNode(Node $node, Environment $env): Node return $node; } - public function doLeaveNode(Node $node, Environment $env): Node + public function leaveNode(Node $node, Environment $env): Node { return $node; }