Skip to content

Commit 1c170f9

Browse files
[Validator] Update Charset constraint message
1 parent 6d68a8b commit 1c170f9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/Validator/Constraints/Charset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class Charset extends Constraint
2727
];
2828

2929
public array|string $encodings = [];
30-
public string $message = 'The detected encoding "{{ detected }}" does not match one of the accepted encoding: "{{ encodings }}".';
30+
public string $message = 'The detected character encoding "{{ detected }}" is invalid. Allowed encodings are "{{ encodings }}".';
3131

3232
public function __construct(array|string $encodings = null, string $message = null, array $groups = null, mixed $payload = null, array $options = null)
3333
{

src/Symfony/Component/Validator/Tests/Constraints/CharsetValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function testInvalidValues(string $value, array $encodings)
4040
{
4141
$this->validator->validate($value, new Charset(encodings: $encodings));
4242

43-
$this->buildViolation('The detected encoding "{{ detected }}" does not match one of the accepted encoding: "{{ encodings }}".')
43+
$this->buildViolation('The detected character encoding "{{ detected }}" is invalid. Allowed encodings are "{{ encodings }}".')
4444
->setParameter('{{ detected }}', mb_detect_encoding($value, $encodings, true))
4545
->setParameter('{{ encodings }}', implode(', ', $encodings))
4646
->setCode(Charset::BAD_ENCODING_ERROR)

0 commit comments

Comments
 (0)