Skip to content

Commit 4ede087

Browse files
Merge branch '5.1' into 5.x
* 5.1: fix merge fix merge Remove branch-version (keep them for contracts only) [HttpClient] relax auth bearer format requirements [PHPUnitBridge] Silence errors from mkdir() [DependencyInjection] Preload classes with union types correctly. [Serializer] fix decoding float XML attributes starting with 0 add missing dutch translations [TwigBridge] Remove "transchoice" from the code base Support PHPUnit 8 and PHPUnit 9 in constraint compatibility trait Add expectDeprecation, expectNotice, expectWarning, and expectError to TestCase polyfill [String] fix before/after[Last]() returning the empty string instead of the original one on non-match Add missing exporter function for PHPUnit 7 [Validator] Add missing romanian translations [String] fix slicing in UnicodeString [Cache] Use correct expiry in ChainAdapter do not translate null placeholders or titles
2 parents 0b502cb + 874735a commit 4ede087

File tree

5 files changed

+9
-26
lines changed

5 files changed

+9
-26
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
@@ -81,16 +81,6 @@ protected function doEnterNode(Node $node, Environment $env): Node
8181
$this->getReadDomainFromArguments($nodeArguments, 2),
8282
];
8383
}
84-
} elseif (
85-
$node instanceof FilterExpression &&
86-
'transchoice' === $node->getNode('filter')->getAttribute('value') &&
87-
$node->getNode('node') instanceof ConstantExpression
88-
) {
89-
// extract constant nodes with a trans filter
90-
$this->messages[] = [
91-
$node->getNode('node')->getAttribute('value'),
92-
$this->getReadDomainFromArguments($node->getNode('arguments'), 2),
93-
];
9484
} elseif ($node instanceof TransNode) {
9585
// extract trans nodes
9686
$this->messages[] = [

Resources/views/Form/form_div_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@
466466
{%- for attrname, attrvalue in attr -%}
467467
{{- " " -}}
468468
{%- if attrname in ['placeholder', 'title'] -%}
469-
{{- attrname }}="{{ translation_domain is same as(false) ? attrvalue : attrvalue|trans(attr_translation_parameters, translation_domain) }}"
469+
{{- attrname }}="{{ translation_domain is same as(false) or attrvalue is null ? attrvalue : attrvalue|trans(attr_translation_parameters, translation_domain) }}"
470470
{%- elseif attrvalue is same as(true) -%}
471471
{{- attrname }}="{{ attrname }}"
472472
{%- elseif attrvalue is not same as(false) -%}

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
];

composer.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,5 @@
8080
"/Tests/"
8181
]
8282
},
83-
"minimum-stability": "dev",
84-
"extra": {
85-
"branch-version": "5.2"
86-
}
83+
"minimum-stability": "dev"
8784
}

0 commit comments

Comments
 (0)