Skip to content

Commit 8392b9b

Browse files
Merge branch '7.1' into 7.2
* 7.1: initialize RedisAdapter cursor to 0 do not skip tests from data providers ensure compatibility with Twig 3.15 [Mime] fix encoding issue with UTF-8 addresses containing doubles spaces fix translation file syntax [Notifier] Improve Telegrams markdown escaping [Validator] [Choice] Fix callback option if not array returned [DependencyInjection] Fix linting factories implemented via __callStatic [DependencyInjection] Fix replacing abstract arguments with bindings [DependencyInjection] Fix parsing nested AutowireInline attributes Minor fixes around parse_url() checks Ensure compatibility with mongodb v2 Add missing translations for Turkish (tr)
2 parents 0e893ce + 6c9fc7b commit 8392b9b

File tree

3 files changed

+48
-27
lines changed

3 files changed

+48
-27
lines changed

Constraints/ChoiceValidator.php

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ public function validate(mixed $value, Constraint $constraint): void
5353
throw new ConstraintDefinitionException('The Choice constraint expects a valid callback.');
5454
}
5555
$choices = $choices();
56+
if (!is_array($choices)) {
57+
throw new ConstraintDefinitionException(sprintf('The Choice constraint callback "%s" is expected to return an array, but returned "%s".', trim($this->formatValue($constraint->callback), '"'), get_debug_type($choices)));
58+
}
5659
} else {
5760
$choices = $constraint->choices;
5861
}

Resources/translations/validators.tr.xlf

+27-27
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</trans-unit>
2121
<trans-unit id="5">
2222
<source>The value you selected is not a valid choice.</source>
23-
<target>Seçtiğiniz değer geçerli bir seçenek değil.</target>
23+
<target>Seçtiğiniz değer geçerli bir seçenek değildir.</target>
2424
</trans-unit>
2525
<trans-unit id="6">
2626
<source>You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.</source>
@@ -40,7 +40,7 @@
4040
</trans-unit>
4141
<trans-unit id="10">
4242
<source>This field is missing.</source>
43-
<target>Bu alan, eksik</target>
43+
<target>Bu alan, eksiktir</target>
4444
</trans-unit>
4545
<trans-unit id="11">
4646
<source>This value is not a valid date.</source>
@@ -60,7 +60,7 @@
6060
</trans-unit>
6161
<trans-unit id="15">
6262
<source>The file is not readable.</source>
63-
<target>Dosya okunabilir değil.</target>
63+
<target>Dosya okunabilir değildir.</target>
6464
</trans-unit>
6565
<trans-unit id="16">
6666
<source>The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.</source>
@@ -100,15 +100,15 @@
100100
</trans-unit>
101101
<trans-unit id="25">
102102
<source>This value is not valid.</source>
103-
<target>Bu değer geçerli değil.</target>
103+
<target>Bu değer geçerli değildir.</target>
104104
</trans-unit>
105105
<trans-unit id="26">
106106
<source>This value is not a valid time.</source>
107-
<target>Bu değer doğru bir saat değil.</target>
107+
<target>Bu değer doğru bir saat değildir.</target>
108108
</trans-unit>
109109
<trans-unit id="27">
110110
<source>This value is not a valid URL.</source>
111-
<target>Bu değer doğru bir URL değil.</target>
111+
<target>Bu değer doğru bir URL değildir.</target>
112112
</trans-unit>
113113
<trans-unit id="31">
114114
<source>The two values should be equal.</source>
@@ -136,11 +136,11 @@
136136
</trans-unit>
137137
<trans-unit id="37" resname="This is not a valid IP address.">
138138
<source>This value is not a valid IP address.</source>
139-
<target state="needs-review-translation">Bu değer geçerli bir IP adresi değil.</target>
139+
<target>Bu değer geçerli bir IP adresi değildir.</target>
140140
</trans-unit>
141141
<trans-unit id="38">
142142
<source>This value is not a valid language.</source>
143-
<target>Bu değer geçerli bir lisan değil.</target>
143+
<target>Bu değer geçerli bir lisan değildir.</target>
144144
</trans-unit>
145145
<trans-unit id="39">
146146
<source>This value is not a valid locale.</source>
@@ -192,7 +192,7 @@
192192
</trans-unit>
193193
<trans-unit id="51" resname="No temporary folder was configured in php.ini.">
194194
<source>No temporary folder was configured in php.ini, or the configured folder does not exist.</source>
195-
<target state="needs-review-translation">php.ini'de geçici bir klasör yapılandırılmadı, veya yapılandırılan klasör mevcut değil.</target>
195+
<target state="needs-review-translation">php.ini'de geçici bir klasör yapılandırılmadı, veya yapılandırılan klasör mevcut değildir.</target>
196196
</trans-unit>
197197
<trans-unit id="52">
198198
<source>Cannot write temporary file to disk.</source>
@@ -224,7 +224,7 @@
224224
</trans-unit>
225225
<trans-unit id="59" resname="This is not a valid International Bank Account Number (IBAN).">
226226
<source>This value is not a valid International Bank Account Number (IBAN).</source>
227-
<target state="needs-review-translation">Bu değer geçerli bir Uluslararası Banka Hesap Numarası (IBAN) değil.</target>
227+
<target>Bu değer geçerli bir Uluslararası Banka Hesap Numarası (IBAN) değildir.</target>
228228
</trans-unit>
229229
<trans-unit id="60">
230230
<source>This value is not a valid ISBN-10.</source>
@@ -244,7 +244,7 @@
244244
</trans-unit>
245245
<trans-unit id="64">
246246
<source>This value is not a valid currency.</source>
247-
<target>Bu değer geçerli bir para birimi değil.</target>
247+
<target>Bu değer geçerli bir para birimi değildir.</target>
248248
</trans-unit>
249249
<trans-unit id="65">
250250
<source>This value should be equal to {{ compared_value }}.</source>
@@ -312,15 +312,15 @@
312312
</trans-unit>
313313
<trans-unit id="81" resname="This is not a valid Business Identifier Code (BIC).">
314314
<source>This value is not a valid Business Identifier Code (BIC).</source>
315-
<target state="needs-review-translation">Bu değer geçerli bir İşletme Tanımlama Kodu (BIC) değil.</target>
315+
<target>Bu değer geçerli bir İşletme Tanımlama Kodu (BIC) değildir.</target>
316316
</trans-unit>
317317
<trans-unit id="82">
318318
<source>Error</source>
319319
<target>Hata</target>
320320
</trans-unit>
321321
<trans-unit id="83" resname="This is not a valid UUID.">
322322
<source>This value is not a valid UUID.</source>
323-
<target state="needs-review-translation">Bu değer geçerli bir UUID değil.</target>
323+
<target>Bu değer geçerli bir UUID değildir.</target>
324324
</trans-unit>
325325
<trans-unit id="84">
326326
<source>This value should be a multiple of {{ compared_value }}.</source>
@@ -340,7 +340,7 @@
340340
</trans-unit>
341341
<trans-unit id="88">
342342
<source>This value should be positive.</source>
343-
<target>Bu değer pozitif olmalı.</target>
343+
<target>Bu değer pozitif olmalıdır.</target>
344344
</trans-unit>
345345
<trans-unit id="89">
346346
<source>This value should be either positive or zero.</source>
@@ -356,7 +356,7 @@
356356
</trans-unit>
357357
<trans-unit id="92">
358358
<source>This value is not a valid timezone.</source>
359-
<target>Bu değer, geçerli bir saat dilimi değil.</target>
359+
<target>Bu değer, geçerli bir saat dilimi değildir.</target>
360360
</trans-unit>
361361
<trans-unit id="93">
362362
<source>This password has been leaked in a data breach, it must not be used. Please use another password.</source>
@@ -368,7 +368,7 @@
368368
</trans-unit>
369369
<trans-unit id="95">
370370
<source>This value is not a valid hostname.</source>
371-
<target>Bu değer, geçerli bir ana bilgisayar adı değil.</target>
371+
<target>Bu değer, geçerli bir ana bilgisayar adı değildir.</target>
372372
</trans-unit>
373373
<trans-unit id="96">
374374
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
@@ -384,19 +384,19 @@
384384
</trans-unit>
385385
<trans-unit id="99">
386386
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
387-
<target>Bu değer geçerli bir Uluslararası Menkul Kıymetler Kimlik Numarası değil (ISIN).</target>
387+
<target>Bu değer geçerli bir Uluslararası Menkul Kıymetler Kimlik Numarası (ISIN) değildir.</target>
388388
</trans-unit>
389389
<trans-unit id="100">
390390
<source>This value should be a valid expression.</source>
391391
<target>Bu değer geçerli bir ifade olmalıdır.</target>
392392
</trans-unit>
393393
<trans-unit id="101">
394394
<source>This value is not a valid CSS color.</source>
395-
<target>Bu değer geçerli bir CSS rengi değil.</target>
395+
<target>Bu değer geçerli bir CSS rengi değildir.</target>
396396
</trans-unit>
397397
<trans-unit id="102">
398398
<source>This value is not a valid CIDR notation.</source>
399-
<target>Bu değer geçerli bir CIDR yazımı değil.</target>
399+
<target>Bu değer geçerli bir CIDR yazımı değildir.</target>
400400
</trans-unit>
401401
<trans-unit id="103">
402402
<source>The value of the netmask should be between {{ min }} and {{ max }}.</source>
@@ -436,35 +436,35 @@
436436
</trans-unit>
437437
<trans-unit id="112">
438438
<source>This value is not a valid MAC address.</source>
439-
<target state="needs-review-translation">Bu değer geçerli bir MAC adresi değil.</target>
439+
<target>Bu değer geçerli bir MAC adresi değildir.</target>
440440
</trans-unit>
441441
<trans-unit id="113">
442442
<source>This URL is missing a top-level domain.</source>
443-
<target state="needs-review-translation">Bu URL bir üst düzey alan adı eksik.</target>
443+
<target>Bu URL bir üst seviye alan adı eksik.</target>
444444
</trans-unit>
445445
<trans-unit id="114">
446446
<source>This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words.</source>
447-
<target state="needs-translation">This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words.</target>
447+
<target>Bu değer çok kısa. En az bir kelime içermelidir.|Bu değer çok kısa. En az {{ min }} kelime içermelidir.</target>
448448
</trans-unit>
449449
<trans-unit id="115">
450450
<source>This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less.</source>
451-
<target state="needs-translation">This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less.</target>
451+
<target>Bu değer çok uzun. Tek bir kelime içermelidir.|Bu değer çok uzun. {{ max }} veya daha az kelime içermelidir.</target>
452452
</trans-unit>
453453
<trans-unit id="116">
454454
<source>This value does not represent a valid week in the ISO 8601 format.</source>
455-
<target state="needs-translation">This value does not represent a valid week in the ISO 8601 format.</target>
455+
<target>Bu değer ISO 8601 formatında geçerli bir haftayı temsil etmezdir.</target>
456456
</trans-unit>
457457
<trans-unit id="117">
458458
<source>This value is not a valid week.</source>
459-
<target state="needs-translation">This value is not a valid week.</target>
459+
<target>Bu değer geçerli hafta değildir.</target>
460460
</trans-unit>
461461
<trans-unit id="118">
462462
<source>This value should not be before week "{{ min }}".</source>
463-
<target state="needs-translation">This value should not be before week "{{ min }}".</target>
463+
<target>Bu değer “{{ min }}” haftasından önce olmamalıdır.</target>
464464
</trans-unit>
465465
<trans-unit id="119">
466466
<source>This value should not be after week "{{ max }}".</source>
467-
<target state="needs-translation">This value should not be after week "{{ max }}".</target>
467+
<target>Bu değer “{{ max }}” haftasından sonra olmamalıdır</target>
468468
</trans-unit>
469469
</body>
470470
</file>

Tests/Constraints/ChoiceValidatorTest.php

+18
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ public function objectMethodCallback()
3939
return ['foo', 'bar'];
4040
}
4141

42+
public static function staticCallbackInvalid()
43+
{
44+
return null;
45+
}
46+
4247
public function testExpectArrayIfMultipleIsTrue()
4348
{
4449
$this->expectException(UnexpectedValueException::class);
@@ -126,6 +131,19 @@ public function testValidChoiceCallbackContextMethod()
126131
$this->assertNoViolation();
127132
}
128133

134+
public function testInvalidChoiceCallbackContextMethod()
135+
{
136+
$this->expectException(ConstraintDefinitionException::class);
137+
$this->expectExceptionMessage('The Choice constraint callback "staticCallbackInvalid" is expected to return an array, but returned "null".');
138+
139+
// search $this for "staticCallbackInvalid"
140+
$this->setObject($this);
141+
142+
$constraint = new Choice(['callback' => 'staticCallbackInvalid']);
143+
144+
$this->validator->validate('bar', $constraint);
145+
}
146+
129147
public function testValidChoiceCallbackContextObjectMethod()
130148
{
131149
// search $this for "objectMethodCallback"

0 commit comments

Comments
 (0)