Charset.php
Namespace
Symfony\Component\Validator\ConstraintsFile
-
vendor/
symfony/ validator/ Constraints/ Charset.php
View source
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
/**
* @author Alexandre Daubois <alex.daubois@gmail.com>
*/
final class Charset extends Constraint {
public const BAD_ENCODING_ERROR = '94c5e58b-f892-4e25-8fd6-9d89c80bfe81';
protected const ERROR_NAMES = [
self::BAD_ENCODING_ERROR => 'BAD_ENCODING_ERROR',
];
public function __construct(array|string $encodings = [], string $message = 'The detected character encoding is invalid ({{ detected }}). Allowed encodings are {{ encodings }}.', ?array $groups = null, mixed $payload = null) {
parent::__construct(null, $groups, $payload);
if ([] === $this->encodings) {
throw new ConstraintDefinitionException(\sprintf('The "%s" constraint requires at least one encoding.', static::class));
}
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
Charset | @author Alexandre Daubois <alex.daubois@gmail.com> |