8000 Merge branch '4.4' into 5.2 · symfony/symfony@5fea563 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5fea563

Browse files
committed
Merge branch '4.4' into 5.2
* 4.4: [Validator] Fix return types Add translation for Belarusian fix parsing calls of methods named "method" deal with indented heredoc/nowdoc tokens Adding templates for Belarusian
2 parents e0401df + 218bf5e commit 5fea563

File tree

10 files changed

+206
-4
lines changed

10 files changed

+206
-4
lines changed

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ private function parseDefinition(string $id, $service, string $file, array $defa
522522
throw new InvalidArgumentException(sprintf('Invalid method call for service "%s", did you forgot a leading dash before "%s: ..." in "%s"?', $id, $k, $file));
523523
}
524524

525-
if (isset($call['method'])) {
525+
if (isset($call['method']) && \is_string($call['method'])) {
526526
$method = $call['method'];
527527
$args = $call['arguments'] ?? [];
528528
$returnsClone = $call['returns_clone'] ?? false;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/alt_call.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ services:
33
calls:
44
- foo: [1, 2, 3]
55
- bar: !returns_clone [1, 2, 3]
6+
- method:
7+
- url

src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,7 @@ public function testAlternativeMethodCalls()
958958
$expected = [
959959
['foo', [1, 2, 3]],
960960
['bar', [1, 2, 3], true],
961+
['method', ['url']],
961962
];
962963

963964
$this->assertSame($expected, $container->getDefinition('foo')->getMethodCalls());

src/Symfony/Component/Form/Resources/translations/validators.be.xlf

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,126 @@
1414
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
1515
<target>CSRF-токен не сапраўдны. Калі ласка, паспрабуйце яшчэ раз адправіць форму.</target>
1616
</trans-unit>
17+
<trans-unit id="99">
18+
<source>This value is not a valid HTML5 color.</source>
19+
<target>Значэнне не з'яўляецца карэктным HTML5 колерам.</target>
20+
</trans-unit>
21+
<trans-unit id="100">
22+
<source>Please enter a valid birthdate.</source>
23+
<target>Калі ласка, увядзіце карэктную дату нараджэння.</target>
24+
</trans-unit>
25+
<trans-unit id="101">
26+
<source>The selected choice is invalid.</source>
27+
<target>Выбраны варыянт некарэктны.</target>
28+
</trans-unit>
29+
<trans-unit id="102">
30+
<source>The collection is invalid.</source>
31+
<target>Калекцыя некарэктна.</target>
32+
</trans-unit>
33+
<trans-unit id="103">
34+
<source>Please select a valid color.</source>
35+
<target>Калі ласка, выберыце карэктны колер.</target>
36+
</trans-unit>
37+
<trans-unit id="104">
38+
<source>Please select a valid country.</source>
39+
<target>Калі ласка, выберыце карэктную краіну.</target>
40+
</trans-unit>
41+
<trans-unit id="105">
42+
<source>Please select a valid currency.</source>
43+
<target>Калі ласка, выберыце карэктную валюту.</target>
44+
</trans-unit>
45+
<trans-unit id="106">
46+
<source>Please choose a valid date interval.</source>
47+
<target>Калі ласка, выберыце карэктны інтэрвал дат.</target>
48+
</trans-unit>
49+
<trans-unit id="107">
50+
<source>Please enter a valid date and time.</source>
51+
<target>Калі ласка, увядзіце карэктныя дату і час.</target>
52+
</trans-unit>
53+
<trans-unit id="108">
54+
<source>Please enter a valid date.</source>
55+
<target>Калі ласка, увядзіце карэктную дату.</target>
56+
</trans-unit>
57+
<trans-unit id="109">
58+
<source>Please select a valid file.</source>
59+
<target>Калі ласка, выберыце карэктны файл.</target>
60+
</trans-unit>
61+
<trans-unit id="110">
62+
<source>The hidden field is invalid.</source>
63+
<target>Значэнне схаванага поля некарэктна.</target>
64+
</trans-unit>
65+
<trans-unit id="111">
66+
<source>Please enter an integer.</source>
67+
<target>Калі ласка, увядзіце цэлы лік.</target>
68+
</trans-unit>
69+
<trans-unit id="112">
70+
<source>Please select a valid language.</source>
71+
<target>Калі ласка, выберыце карэктную мову.</target>
72+
</trans-unit>
73+
<trans-unit id="113">
74+
<source>Please select a valid locale.</source>
75+
<target>Калі ласка, выберыце карэктную лакаль.</target>
76+
</trans-unit>
77+
<trans-unit id="114">
78+
<source>Please enter a valid money amount.</source>
79+
<target>Калі ласка, увядзіце карэктную колькасць грошай.</target>
80+
</trans-unit>
81+
<trans-unit id="115">
82+
<source>Please enter a number.</source>
83+
<target>Калі ласка, увядзіце нумар.</target>
84+
</trans-unit>
85+
<trans-unit id="116">
86+
<source>The password is invalid.</source>
87+
<target>Няправільны пароль.</target>
88+
</trans-unit>
89+
<trans-unit id="117">
90+
<source>Please enter a percentage value.</source>
91+
<target>Калі ласка, увядзіце працэнтнае значэнне.</target>
92+
</trans-unit>
93+
<trans-unit id="118">
94+
<source>The values do not match.</source>
95+
<target>Значэнні не супадаюць.</target>
96+
</trans-unit>
97+
<trans-unit id="119">
98+
<source>Please enter a valid time.</source>
99+
<target>Калі ласка, увядзіце карэктны час.</target>
100+
</trans-unit>
101+
<trans-unit id="120">
102+
<source>Please select a valid timezone.</source>
103+
<target>Калі ласка, выберыце карэктны гадзінны пояс.</target>
104+
</trans-unit>
105+
<trans-unit id="121">
106+
<source>Please enter a valid URL.</source>
107+
<target>Калі ласка, увядзіце карэктны URL.</target>
108+
</trans-unit>
109+
<trans-unit id="122">
110+
<source>Please enter a valid search term.</source>
111+
<target>Калі ласка, увядзіце карэктны пошукавы запыт.</target>
112+
</trans-unit>
113+
<trans-unit id="123">
114+
<source>Please provide a valid phone number.</source>
115+
<target>Калі ласка, увядзіце карэктны нумар тэлефона.</target>
116+
</trans-unit>
117+
<trans-unit id="124">
118+
<source>The checkbox has an invalid value.</source>
119+
<target>Флажок мае некарэктнае значэнне.</target>
120+
</trans-unit>
121+
<trans-unit id="125">
122+
<source>Please enter a valid email address.</source>
123+
<target>Калі ласка, увядзіце карэктны адрас электроннай пошты.</target>
124+
</trans-unit>
125+
<trans-unit id="126">
126+
<source>Please select a valid option.</source>
127+
<target>Калі ласка, выберыце карэктны варыянт.</target>
128+
</trans-unit>
129+
<trans-unit id="127">
130+
<source>Please select a valid range.</source>
131+
<target>Калі ласка, выберыце карэктны дыяпазон.</target>
132+
</trans-unit>
133+
<trans-unit id="128">
134+
<source>Please enter a valid week.</source>
135+
<target>Калі ласка, увядзіце карэктны тыдзень.</target>
136+
</trans-unit>
17137
</body>
18138
</file>
19139
</xliff>

src/Symfony/Component/Security/Core/Resources/translations/security.be.xlf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@
6262
<source>Account is locked.</source>
6363
<target>Акаўнт заблакіраван.</target>
6464
</trans-unit>
65+
<trans-unit id="17">
66+
<source>Too many failed login attempts, please try again later.</source>
67+
<target>Зашмат няўдалых спроб уваходу, калі ласка, паспрабуйце пазней.</target>
68+
</trans-unit>
69+
<trans-unit id="18">
70+
<source>Invalid or expired login link.</source>
71+
<target>Спасылка для ўваходу несапраўдная або пратэрмінаваная.</target>
72+
</trans-unit>
6573
</body>
6674
</file>
6775
</xliff>

src/Symfony/Component/Translation/Extractor/PhpExtractor.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,19 @@ private function getValue(\Iterator $tokenIterator)
236236
}
237237
break;
238238
case \T_END_HEREDOC:
239+
if ($indentation = strspn($t[1], ' ')) {
240+
$docPartWithLineBreaks = $docPart;
241+
$docPart = '';
242+
243+
foreach (preg_split('~(\r\n|\n|\r)~', $docPartWithLineBreaks, -1, \PREG_SPLIT_DELIM_CAPTURE) as $str) {
244+
if (\in_array($str, ["\r\n", "\n", "\r"], true)) {
245+
$docPart .= $str;
246+
} else {
247+
$docPart .= substr($str, $indentation);
248+
}
249+
}
250+
}
251+
239252
$message .= PhpStringTokenParser::parseDocString($docToken, $docPart);
240253
$docToken = '';
241254
$docPart = '';

src/Symfony/Component/Translation/Tests/Extractor/PhpExtractorTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,27 @@ public function testExtraction($resource)
130130
$this->assertEquals(['sources' => [$filename.':37']], $catalogue->getMetadata('other-domain-test-no-params-short-array', 'not_messages'));
131131
}
132132

133+
/**
134+
* @requires PHP 7.3
135+
*/
136+
public function testExtractionFromIndentedHeredocNowdoc()
137+
{
138+
$catalogue = new MessageCatalogue('en');
139+
140+
$extractor = new PhpExtractor();
141+
$extractor->setPrefix('prefix');
142+
$extractor->extract(__DIR__.'/../fixtures/extractor-7.3/translation.html.php', $catalogue);
143+
144+
$expectedCatalogue = [
145+
'messages' => [
146+
"heredoc\nindented\n further" => "prefixheredoc\nindented\n further",
147+
"nowdoc\nindented\n further" => "prefixnowdoc\nindented\n further",
148+
],
149+
];
150+
151+
$this->assertEquals($expectedCatalogue, $catalogue->all());
152+
}
153+
133154
public function resourcesProvider()
134155
{
135156
$directory = __DIR__.'/../fixtures/extractor/';
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
This template is used for translation message extraction tests
2+
<?php echo $view['translator']->trans(<<<EOF
3+
heredoc
4+
indented
5+
further
6+
EOF
7+
); ?>
8+
<?php echo $view['translator']->trans(<<<'EOF'
9+
nowdoc
10+
indented
11+
further
12+
EOF
13+
); ?>

src/Symfony/Component/Validator/Constraint.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*
2626
* Constraint instances are immutable and serializable.
2727
*
28-
* @property array $groups The groups that the constraint belongs to
28+
* @property string[] $groups The groups that the constraint belongs to
2929
*
3030
* @author Bernhard Schussek <bschussek@gmail.com>
3131
*/
@@ -263,7 +263,7 @@ public function getDefaultOption()
263263
*
264264
* Override this method if you want to define required options.
265265
*
266-
* @return array
266+
* @return string[]
267267
*
268268
* @see __construct()
269269
*/
@@ -293,7 +293,7 @@ public function validatedBy()
293293
* This method should return one or more of the constants
294294
* Constraint::CLASS_CONSTRAINT and Constraint::PROPERTY_CONSTRAINT.
295295
*
296-
* @return string|array One or more constant values
296+
* @return string|string[] One or more constant values
297297
*/
298298
public function getTargets()
299299
{

src/Symfony/Component/Validator/Resources/translations/validators.be.xlf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,30 @@
362362
<source>This password has been leaked in a data breach, it must not be used. Please use another password.</source>
363363
<target>Гэты пароль быў выкрадзены ў выніку ўзлому дадзеных, таму яго нельга выкарыстоўваць. Калі ласка, выкарыстоўвайце іншы пароль.</target>
364364
</trans-unit>
365+
<trans-unit id="94">
366+
<source>This value should be between {{ min }} and {{ max }}.</source>
367+
<target>Значэнне павінна быць паміж {{min}} і {{max}}.</target>
368+
</trans-unit>
369+
<trans-unit id="95">
370+
<source>This value is not a valid hostname.</source>
371+
<target>Значэнне не з'яўляецца карэктным імем хаста.</target>
372+
</trans-unit>
373+
<trans-unit id="96">
374+
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
375+
<target>Колькасць элементаў у гэтай калекцыі павінна быць кратным {{compared_value}}.</target>
376+
</trans-unit>
377+
<trans-unit id="97">
378+
<source>This value should satisfy at least one of the following constraints:</source>
379+
<target>Значэнне павінна задавальняць як мінімум аднаму з наступных абмежаванняў:</target>
380+
</trans-unit>
381+
<trans-unit id="98">
382+
734B <source>Each element of this collection should satisfy its own set of constraints.</source>
383+
<target>Кожны элемент гэтай калекцыі павінен задавальняць свайму ўласнаму набору абмежаванняў.</target>
384+
</trans-unit>
385+
<trans-unit id="99">
386+
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
387+
<target>Значэнне не з'яўляецца карэктным міжнародным ідэнтыфікацыйным нумарам каштоўных папер (ISIN).</target>
388+
</trans-unit>
365389
</body>
366390
</file>
367391
</xliff>

0 commit comments

Comments
 (0)
0