Skip to content

feat: drop twig 2 #513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tests/Unit/Translator/FallbackTranslatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
12 changes: 6 additions & 6 deletions Twig/Visitor/DefaultApplyingNodeVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,7 +29,7 @@
*
* @author Johannes M. Schmitt <[email protected]>
*/
final class DefaultApplyingNodeVisitor extends AbstractNodeVisitor
final class DefaultApplyingNodeVisitor implements NodeVisitorInterface
{
/**
* @var bool
Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Member

@bocharsky-bw bocharsky-bw Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just dropped v2, I think it would be cool to keep the min available version of v3 for a while, WDYT? Or do we use something new that is available since 3.12?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that 3.12 mostly adds a lot of deprecations in preparation of 4.x: https://github.com/twigphp/Twig/blob/3.x/CHANGELOG#L71

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes the twig_callable was added with twig 3.12 twigphp/Twig@3156d80

So to fix the mass deprecations we must set the minimum to 3.12

"symfony/asset": "^5.3 || ^6.0 || ^7.0"
},
"require-dev": {
Expand Down
Loading