Skip to content

Commit 248f5ef

Browse files
[TwigBridge] Remove "transchoice" from the code base
1 parent 70b49e9 commit 248f5ef

File tree

3 files changed

+7
-21
lines changed

3 files changed

+7
-21
lines changed

NodeVisitor/TranslationDefaultDomainNodeVisitor.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,18 @@ protected function doEnterNode(Node $node, Environment $env): Node
6464
return $node;
6565
}
6666

67-
if ($node instanceof FilterExpression && \in_array($node->getNode('filter')->getAttribute('value'), ['trans', 'transchoice'])) {
67+
if ($node instanceof FilterExpression && 'trans' === $node->getNode('filter')->getAttribute('value')) {
6868
$arguments = $node->getNode('arguments');
69-
$ind = 'trans' === $node->getNode('filter')->getAttribute('value') ? 1 : 2;
7069
if ($this->isNamedArguments($arguments)) {
71-
if (!$arguments->hasNode('domain') && !$arguments->hasNode($ind)) {
70+
if (!$arguments->hasNode('domain') && !$arguments->hasNode(1)) {
7271
$arguments->setNode('domain', $this->scope->get('domain'));
7372
}
74-
} else {
75-
if (!$arguments->hasNode($ind)) {
76-
if (!$arguments->hasNode($ind - 1)) {
77-
$arguments->setNode($ind - 1, new ArrayExpression([], $node->getTemplateLine()));
78-
}
79-
80-
$arguments->setNode($ind, $this->scope->get('domain'));
73+
} elseif (!$arguments->hasNode(1)) {
74+
if (!$arguments->hasNode(0)) {
75+
$arguments->setNode(0, new ArrayExpression([], $node->getTemplateLine()));
8176
}
77+
78+
$arguments->setNode(1, $this->scope->get('domain'));
8279
}
8380
} elseif ($node instanceof TransNode) {
8481
if (!$node->hasNode('domain')) {

NodeVisitor/TranslationNodeVisitor.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,6 @@ protected function doEnterNode(Node $node, Environment $env): Node
6666
$node->getNode('node')->getAttribute('value'),
6767
$this->getReadDomainFromArguments($node->getNode('arguments'), 1),
6868
];
69-
} elseif (
70-
$node instanceof FilterExpression &&
71-
'transchoice' === $node->getNode('filter')->getAttribute('value') &&
72-
$node->getNode('node') instanceof ConstantExpression
73-
) {
74-
// extract constant nodes with a trans filter
75-
$this->messages[] = [
76-
$node->getNode('node')->getAttribute('value'),
77-
$this->getReadDomainFromArguments($node->getNode('arguments'), 2),
78-
];
7969
} elseif ($node instanceof TransNode) {
8070
// extract trans nodes
8171
$this->messages[] = [

UndefinedCallableHandler.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class UndefinedCallableHandler
2222
private static $filterComponents = [
2323
'humanize' => 'form',
2424
'trans' => 'translation',
25-
'transchoice' => 'translation',
2625
'yaml_encode' => 'yaml',
2726
'yaml_dump' => 'yaml',
2827
];

0 commit comments

Comments
 (0)