diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6b5be184c..e8146d2a5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,66 @@
CHANGELOG
=========
+7.3
+---
+
+ * Add the `filenameCharset` and `filenameCountUnit` options to the `File` constraint
+ * Deprecate defining custom constraints not supporting named arguments
+
+ Before:
+
+ ```php
+ use Symfony\Component\Validator\Constraint;
+
+ class CustomConstraint extends Constraint
+ {
+ public function __construct(array $options)
+ {
+ // ...
+ }
+ }
+ ```
+
+ After:
+
+ ```php
+ use Symfony\Component\Validator\Attribute\HasNamedArguments;
+ use Symfony\Component\Validator\Constraint;
+
+ class CustomConstraint extends Constraint
+ {
+ #[HasNamedArguments]
+ public function __construct($option1, $option2, $groups, $payload)
+ {
+ // ...
+ }
+ }
+ ```
+ * Deprecate passing an array of options to the constructors of the constraint classes, pass each option as a dedicated argument instead
+
+ Before:
+
+ ```php
+ new NotNull([
+ 'groups' => ['foo', 'bar'],
+ 'message' => 'a custom constraint violation message',
+ ])
+ ```
+
+ After:
+
+ ```php
+ new NotNull(
+ groups: ['foo', 'bar'],
+ message: 'a custom constraint violation message',
+ )
+ ```
+ * Add support for ratio checks for SVG files to the `Image` constraint
+ * Add support for the `otherwise` option in the `When` constraint
+ * Add support for multiple fields containing nested constraints in `Composite` constraints
+ * Add the `stopOnFirstError` option to the `Unique` constraint to validate all elements
+ * Add support for closures in the `When` constraint
+
7.2
---
@@ -13,6 +73,7 @@ CHANGELOG
* Add the `Week` constraint
* Add `CompoundConstraintTestCase` to ease testing Compound Constraints
* Add context variable to `WhenValidator`
+ * Add `format` parameter to `DateTime` constraint violation message
7.1
---
diff --git a/ConstraintValidator.php b/ConstraintValidator.php
index 75f3195b8..cb71c5dc7 100644
--- a/ConstraintValidator.php
+++ b/ConstraintValidator.php
@@ -121,6 +121,10 @@ protected function formatValue(mixed $value, int $format = 0): string
return 'true';
}
+ if (is_nan($value)) {
+ return 'NAN';
+ }
+
return (string) $value;
}
diff --git a/Constraints/AbstractComparison.php b/Constraints/AbstractComparison.php
index 4d34b1401..3830da789 100644
--- a/Constraints/AbstractComparison.php
+++ b/Constraints/AbstractComparison.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Constraints;
use Symfony\Component\PropertyAccess\PropertyAccess;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
use Symfony\Component\Validator\Exception\LogicException;
@@ -28,11 +29,20 @@ abstract class AbstractComparison extends Constraint
public mixed $value = null;
public ?string $propertyPath = null;
- public function __construct(mixed $value = null, ?string $propertyPath = null, ?string $message = null, ?array $groups = null, mixed $payload = null, array $options = [])
+ #[HasNamedArguments]
+ public function __construct(mixed $value = null, ?string $propertyPath = null, ?string $message = null, ?array $groups = null, mixed $payload = null, ?array $options = null)
{
if (\is_array($value)) {
- $options = array_merge($value, $options);
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+
+ $options = array_merge($value, $options ?? []);
} elseif (null !== $value) {
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ } else {
+ $options = [];
+ }
+
$options['value'] = $value;
}
diff --git a/Constraints/All.php b/Constraints/All.php
index 128454584..92ded329b 100644
--- a/Constraints/All.php
+++ b/Constraints/All.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
/**
@@ -28,8 +29,13 @@ class All extends Composite
* @param array|array|Constraint|null $constraints
* @param string[]|null $groups
*/
+ #[HasNamedArguments]
public function __construct(mixed $constraints = null, ?array $groups = null, mixed $payload = null)
{
+ if (\is_array($constraints) && !array_is_list($constraints)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ }
+
parent::__construct($constraints ?? [], $groups, $payload);
}
diff --git a/Constraints/AtLeastOneOf.php b/Constraints/AtLeastOneOf.php
index 7fe57972d..20d55f458 100644
--- a/Constraints/AtLeastOneOf.php
+++ b/Constraints/AtLeastOneOf.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
/**
@@ -39,8 +40,13 @@ class AtLeastOneOf extends Composite
* @param string|null $messageCollection Failure message for All and Collection inner constraints
* @param bool|null $includeInternalMessages Whether to include inner constraint messages (defaults to true)
*/
+ #[HasNamedArguments]
public function __construct(mixed $constraints = null, ?array $groups = null, mixed $payload = null, ?string $message = null, ?string $messageCollection = null, ?bool $includeInternalMessages = null)
{
+ if (\is_array($constraints) && !array_is_list($constraints)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ }
+
parent::__construct($constraints ?? [], $groups, $payload);
$this->message = $message ?? $this->message;
diff --git a/Constraints/Bic.php b/Constraints/Bic.php
index 692d83117..5390d5556 100644
--- a/Constraints/Bic.php
+++ b/Constraints/Bic.php
@@ -13,6 +13,7 @@
use Symfony\Component\Intl\Countries;
use Symfony\Component\PropertyAccess\PropertyAccess;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
use Symfony\Component\Validator\Exception\InvalidArgumentException;
@@ -70,6 +71,7 @@ class Bic extends Constraint
* @param string[]|null $groups
* @param self::VALIDATION_MODE_*|null $mode The mode used to validate the BIC; pass null to use the default mode (strict)
*/
+ #[HasNamedArguments]
public function __construct(
?array $options = null,
?string $message = null,
@@ -90,6 +92,10 @@ public function __construct(
throw new InvalidArgumentException('The "mode" parameter value is not valid.');
}
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ }
+
parent::__construct($options, $groups, $payload);
$this->message = $message ?? $this->message;
diff --git a/Constraints/Blank.php b/Constraints/Blank.php
index 283164fc1..72fbae57a 100644
--- a/Constraints/Blank.php
+++ b/Constraints/Blank.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
/**
@@ -33,8 +34,13 @@ class Blank extends Constraint
* @param array|null $options
* @param string[]|null $groups
*/
+ #[HasNamedArguments]
public function __construct(?array $options = null, ?string $message = null, ?array $groups = null, mixed $payload = null)
{
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ }
+
parent::__construct($options ?? [], $groups, $payload);
$this->message = $message ?? $this->message;
diff --git a/Constraints/Callback.php b/Constraints/Callback.php
index 5ef48d880..44b51ac2a 100644
--- a/Constraints/Callback.php
+++ b/Constraints/Callback.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
/**
@@ -30,17 +31,28 @@ class Callback extends Constraint
* @param string|string[]|callable|array|null $callback The callback definition
* @param string[]|null $groups
*/
- public function __construct(array|string|callable|null $callback = null, ?array $groups = null, mixed $payload = null, array $options = [])
+ #[HasNamedArguments]
+ public function __construct(array|string|callable|null $callback = null, ?array $groups = null, mixed $payload = null, ?array $options = null)
{
// Invocation through attributes with an array parameter only
if (\is_array($callback) && 1 === \count($callback) && isset($callback['value'])) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+
$callback = $callback['value'];
}
if (!\is_array($callback) || (!isset($callback['callback']) && !isset($callback['groups']) && !isset($callback['payload']))) {
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ } else {
+ $options = [];
+ }
+
$options['callback'] = $callback;
} else {
- $options = array_merge($callback, $options);
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+
+ $options = array_merge($callback, $options ?? []);
}
parent::__construct($options, $groups, $payload);
diff --git a/Constraints/CardScheme.php b/Constraints/CardScheme.php
index 7fe49d3d5..81de342f5 100644
--- a/Constraints/CardScheme.php
+++ b/Constraints/CardScheme.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
/**
@@ -49,14 +50,25 @@ class CardScheme extends Constraint
/**
* @param non-empty-string|non-empty-string[]|array|null $schemes Name(s) of the number scheme(s) used to validate the credit card number
* @param string[]|null $groups
- * @param array $options
+ * @param array|null $options
*/
- public function __construct(array|string|null $schemes, ?string $message = null, ?array $groups = null, mixed $payload = null, array $options = [])
+ #[HasNamedArguments]
+ public function __construct(array|string|null $schemes, ?string $message = null, ?array $groups = null, mixed $payload = null, ?array $options = null)
{
if (\is_array($schemes) && \is_string(key($schemes))) {
- $options = array_merge($schemes, $options);
- } elseif (null !== $schemes) {
- $options['value'] = $schemes;
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+
+ $options = array_merge($schemes, $options ?? []);
+ } else {
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ } else {
+ $options = [];
+ }
+
+ if (null !== $schemes) {
+ $options['value'] = $schemes;
+ }
}
parent::__construct($options, $groups, $payload);
diff --git a/Constraints/Cascade.php b/Constraints/Cascade.php
index 4f0efd6af..7d90cfcf7 100644
--- a/Constraints/Cascade.php
+++ b/Constraints/Cascade.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
@@ -28,12 +29,19 @@ class Cascade extends Constraint
* @param non-empty-string[]|non-empty-string|array|null $exclude Properties excluded from validation
* @param array|null $options
*/
+ #[HasNamedArguments]
public function __construct(array|string|null $exclude = null, ?array $options = null)
{
if (\is_array($exclude) && !array_is_list($exclude)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+
$options = array_merge($exclude, $options ?? []);
$options['exclude'] = array_flip((array) ($options['exclude'] ?? []));
} else {
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ }
+
$this->exclude = array_flip((array) $exclude);
}
diff --git a/Constraints/Choice.php b/Constraints/Choice.php
index 18570c5c9..1435a762b 100644
--- a/Constraints/Choice.php
+++ b/Constraints/Choice.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
/**
@@ -59,6 +60,7 @@ public function getDefaultOption(): ?string
* @param string[]|null $groups
* @param bool|null $match Whether to validate the values are part of the choices or not (defaults to true)
*/
+ #[HasNamedArguments]
public function __construct(
string|array $options = [],
?array $choices = null,
@@ -78,7 +80,10 @@ public function __construct(
if (\is_array($options) && $options && array_is_list($options)) {
$choices ??= $options;
$options = [];
+ } elseif (\is_array($options) && [] !== $options) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
}
+
if (null !== $choices) {
$options['value'] = $choices;
}
diff --git a/Constraints/Cidr.php b/Constraints/Cidr.php
index 349c29b66..a6e470177 100644
--- a/Constraints/Cidr.php
+++ b/Constraints/Cidr.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
use Symfony\Component\Validator\Exception\InvalidArgumentException;
@@ -74,6 +75,7 @@ class Cidr extends Constraint
/** @var callable|null */
public $normalizer;
+ #[HasNamedArguments]
public function __construct(
?array $options = null,
?string $version = null,
@@ -84,6 +86,10 @@ public function __construct(
$payload = null,
?callable $normalizer = null,
) {
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ }
+
$this->version = $version ?? $options['version'] ?? $this->version;
if (!\array_key_exists($this->version, self::NET_MAXES)) {
diff --git a/Constraints/Collection.php b/Constraints/Collection.php
index 3ffd0a6fc..b59caa89d 100644
--- a/Constraints/Collection.php
+++ b/Constraints/Collection.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
/**
@@ -41,13 +42,22 @@ class Collection extends Composite
* @param bool|null $allowExtraFields Whether to allow additional keys not declared in the configured fields (defaults to false)
* @param bool|null $allowMissingFields Whether to allow the collection to lack some fields declared in the configured fields (defaults to false)
*/
+ #[HasNamedArguments]
public function __construct(mixed $fields = null, ?array $groups = null, mixed $payload = null, ?bool $allowExtraFields = null, ?bool $allowMissingFields = null, ?string $extraFieldsMessage = null, ?string $missingFieldsMessage = null)
{
+ $options = $fields;
+
if (self::isFieldsOption($fields)) {
- $fields = ['fields' => $fields];
+ $options = [];
+
+ if (null !== $fields) {
+ $options['fields'] = $fields;
+ }
+ } else {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
}
- parent::__construct($fields, $groups, $payload);
+ parent::__construct($options, $groups, $payload);
$this->allowExtraFields = $allowExtraFields ?? $this->allowExtraFields;
$this->allowMissingFields = $allowMissingFields ?? $this->allowMissingFields;
@@ -84,6 +94,10 @@ protected function getCompositeOption(): string
private static function isFieldsOption($options): bool
{
+ if (null === $options) {
+ return true;
+ }
+
if (!\is_array($options)) {
return false;
}
diff --git a/Constraints/Composite.php b/Constraints/Composite.php
index f6a88021e..1710d9a49 100644
--- a/Constraints/Composite.php
+++ b/Constraints/Composite.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
@@ -49,63 +50,65 @@ abstract class Composite extends Constraint
* cached. When constraints are loaded from the cache, no more group
* checks need to be done.
*/
+ #[HasNamedArguments]
public function __construct(mixed $options = null, ?array $groups = null, mixed $payload = null)
{
parent::__construct($options, $groups, $payload);
$this->initializeNestedConstraints();
- /** @var Constraint[] $nestedConstraints */
- $compositeOption = $this->getCompositeOption();
- $nestedConstraints = $this->$compositeOption;
+ foreach ((array) $this->getCompositeOption() as $option) {
+ /** @var Constraint[] $nestedConstraints */
+ $nestedConstraints = $this->$option;
- if (!\is_array($nestedConstraints)) {
- $nestedConstraints = [$nestedConstraints];
- }
-
- foreach ($nestedConstraints as $constraint) {
- if (!$constraint instanceof Constraint) {
- if (\is_object($constraint)) {
- $constraint = $constraint::class;
- }
-
- throw new ConstraintDefinitionException(\sprintf('The value "%s" is not an instance of Constraint in constraint "%s".', $constraint, static::class));
+ if (!\is_array($nestedConstraints)) {
+ $nestedConstraints = [$nestedConstraints];
}
- if ($constraint instanceof Valid) {
- throw new ConstraintDefinitionException(\sprintf('The constraint Valid cannot be nested inside constraint "%s". You can only declare the Valid constraint directly on a field or method.', static::class));
- }
- }
+ foreach ($nestedConstraints as $constraint) {
+ if (!$constraint instanceof Constraint) {
+ if (\is_object($constraint)) {
+ $constraint = get_debug_type($constraint);
+ }
- if (!isset(((array) $this)['groups'])) {
- $mergedGroups = [];
+ throw new ConstraintDefinitionException(\sprintf('The value "%s" is not an instance of Constraint in constraint "%s".', $constraint, get_debug_type($this)));
+ }
- foreach ($nestedConstraints as $constraint) {
- foreach ($constraint->groups as $group) {
- $mergedGroups[$group] = true;
+ if ($constraint instanceof Valid) {
+ throw new ConstraintDefinitionException(\sprintf('The constraint Valid cannot be nested inside constraint "%s". You can only declare the Valid constraint directly on a field or method.', get_debug_type($this)));
}
}
- // prevent empty composite constraint to have empty groups
- $this->groups = array_keys($mergedGroups) ?: [self::DEFAULT_GROUP];
- $this->$compositeOption = $nestedConstraints;
+ if (!isset(((array) $this)['groups'])) {
+ $mergedGroups = [];
- return;
- }
+ foreach ($nestedConstraints as $constraint) {
+ foreach ($constraint->groups as $group) {
+ $mergedGroups[$group] = true;
+ }
+ }
+
+ // prevent empty composite constraint to have empty groups
+ $this->groups = array_keys($mergedGroups) ?: [self::DEFAULT_GROUP];
+ $this->$option = $nestedConstraints;
- foreach ($nestedConstraints as $constraint) {
- if (isset(((array) $constraint)['groups'])) {
- $excessGroups = array_diff($constraint->groups, $this->groups);
+ continue;
+ }
- if (\count($excessGroups) > 0) {
- throw new ConstraintDefinitionException(\sprintf('The group(s) "%s" passed to the constraint "%s" should also be passed to its containing constraint "%s".', implode('", "', $excessGroups), get_debug_type($constraint), static::class));
+ foreach ($nestedConstraints as $constraint) {
+ if (isset(((array) $constraint)['groups'])) {
+ $excessGroups = array_diff($constraint->groups, $this->groups);
+
+ if (\count($excessGroups) > 0) {
+ throw new ConstraintDefinitionException(\sprintf('The group(s) "%s" passed to the constraint "%s" should also be passed to its containing constraint "%s".', implode('", "', $excessGroups), get_debug_type($constraint), get_debug_type($this)));
+ }
+ } else {
+ $constraint->groups = $this->groups;
}
- } else {
- $constraint->groups = $this->groups;
}
- }
- $this->$compositeOption = $nestedConstraints;
+ $this->$option = $nestedConstraints;
+ }
}
/**
@@ -115,18 +118,20 @@ public function addImplicitGroupName(string $group): void
{
parent::addImplicitGroupName($group);
- /** @var Constraint[] $nestedConstraints */
- $nestedConstraints = $this->{$this->getCompositeOption()};
+ foreach ((array) $this->getCompositeOption() as $option) {
+ /* @var Constraint[] $nestedConstraints */
+ $nestedConstraints = (array) $this->$option;
- foreach ($nestedConstraints as $constraint) {
- $constraint->addImplicitGroupName($group);
+ foreach ($nestedConstraints as $constraint) {
+ $constraint->addImplicitGroupName($group);
+ }
}
}
/**
* Returns the name of the property that contains the nested constraints.
*/
- abstract protected function getCompositeOption(): string;
+ abstract protected function getCompositeOption(): array|string;
/**
* @internal Used by metadata
@@ -135,8 +140,12 @@ abstract protected function getCompositeOption(): string;
*/
public function getNestedConstraints(): array
{
- /** @var Constraint[] $nestedConstraints */
- return $this->{$this->getCompositeOption()};
+ $constraints = [];
+ foreach ((array) $this->getCompositeOption() as $option) {
+ $constraints = array_merge($constraints, (array) $this->$option);
+ }
+
+ return $constraints;
}
/**
diff --git a/Constraints/Compound.php b/Constraints/Compound.php
index ac2b5ac98..261871533 100644
--- a/Constraints/Compound.php
+++ b/Constraints/Compound.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
@@ -24,6 +25,7 @@ abstract class Compound extends Composite
/** @var Constraint[] */
public array $constraints = [];
+ #[HasNamedArguments]
public function __construct(mixed $options = null, ?array $groups = null, mixed $payload = null)
{
if (isset($options[$this->getCompositeOption()])) {
diff --git a/Constraints/Count.php b/Constraints/Count.php
index 38ea8d6e7..108872904 100644
--- a/Constraints/Count.php
+++ b/Constraints/Count.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\MissingOptionsException;
@@ -48,8 +49,9 @@ class Count extends Constraint
* @param int<0, max>|null $max Maximum expected number of elements
* @param positive-int|null $divisibleBy The number the collection count should be divisible by
* @param string[]|null $groups
- * @param array $options
+ * @param array|null $options
*/
+ #[HasNamedArguments]
public function __construct(
int|array|null $exactly = null,
?int $min = null,
@@ -61,11 +63,17 @@ public function __construct(
?string $divisibleByMessage = null,
?array $groups = null,
mixed $payload = null,
- array $options = [],
+ ?array $options = null,
) {
if (\is_array($exactly)) {
- $options = array_merge($exactly, $options);
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+
+ $options = array_merge($exactly, $options ?? []);
$exactly = $options['value'] ?? null;
+ } elseif (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ } else {
+ $options = [];
}
$min ??= $options['min'] ?? null;
diff --git a/Constraints/CountValidator.php b/Constraints/CountValidator.php
index 04f539333..40d889fe9 100644
--- a/Constraints/CountValidator.php
+++ b/Constraints/CountValidator.php
@@ -70,10 +70,10 @@ public function validate(mixed $value, Constraint $constraint): void
->getValidator()
->inContext($this->context)
->validate($count, [
- new DivisibleBy([
- 'value' => $constraint->divisibleBy,
- 'message' => $constraint->divisibleByMessage,
- ]),
+ new DivisibleBy(
+ value: $constraint->divisibleBy,
+ message: $constraint->divisibleByMessage,
+ ),
], $this->context->getGroup());
}
}
diff --git a/Constraints/Country.php b/Constraints/Country.php
index cb0016212..135f996dd 100644
--- a/Constraints/Country.php
+++ b/Constraints/Country.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Constraints;
use Symfony\Component\Intl\Countries;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\LogicException;
@@ -41,6 +42,7 @@ class Country extends Constraint
*
* @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Current_codes
*/
+ #[HasNamedArguments]
public function __construct(
?array $options = null,
?string $message = null,
@@ -52,6 +54,10 @@ public function __construct(
throw new LogicException('The Intl component is required to use the Country constraint. Try running "composer require symfony/intl".');
}
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ }
+
parent::__construct($options, $groups, $payload);
$this->message = $message ?? $this->message;
diff --git a/Constraints/CssColor.php b/Constraints/CssColor.php
index 4f61df18f..793a4a576 100644
--- a/Constraints/CssColor.php
+++ b/Constraints/CssColor.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\InvalidArgumentException;
@@ -66,6 +67,7 @@ class CssColor extends Constraint
* @param string[]|null $groups
* @param array|null $options
*/
+ #[HasNamedArguments]
public function __construct(array|string $formats = [], ?string $message = null, ?array $groups = null, $payload = null, ?array $options = null)
{
$validationModesAsString = implode(', ', self::$validationModes);
@@ -73,6 +75,8 @@ public function __construct(array|string $formats = [], ?string $message = null,
if (!$formats) {
$options['value'] = self::$validationModes;
} elseif (\is_array($formats) && \is_string(key($formats))) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+
$options = array_merge($formats, $options ?? []);
} elseif (\is_array($formats)) {
if ([] === array_intersect(self::$validationModes, $formats)) {
diff --git a/Constraints/Currency.php b/Constraints/Currency.php
index 337481543..c8f6417b3 100644
--- a/Constraints/Currency.php
+++ b/Constraints/Currency.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Constraints;
use Symfony\Component\Intl\Currencies;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\LogicException;
@@ -38,12 +39,17 @@ class Currency extends Constraint
* @param array|null $options
* @param string[]|null $groups
*/
+ #[HasNamedArguments]
public function __construct(?array $options = null, ?string $message = null, ?array $groups = null, mixed $payload = null)
{
if (!class_exists(Currencies::class)) {
throw new LogicException('The Intl component is required to use the Currency constraint. Try running "composer require symfony/intl".');
}
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ }
+
parent::__construct($options, $groups, $payload);
$this->message = $message ?? $this->message;
diff --git a/Constraints/Date.php b/Constraints/Date.php
index add108079..adb48474f 100644
--- a/Constraints/Date.php
+++ b/Constraints/Date.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
/**
@@ -37,8 +38,13 @@ class Date extends Constraint
* @param array|null $options
* @param string[]|null $groups
*/
+ #[HasNamedArguments]
public function __construct(?array $options = null, ?string $message = null, ?array $groups = null, mixed $payload = null)
{
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ }
+
parent::__construct($options, $groups, $payload);
$this->message = $message ?? $this->message;
diff --git a/Constraints/DateTime.php b/Constraints/DateTime.php
index 5b3fd1b0b..6b287be75 100644
--- a/Constraints/DateTime.php
+++ b/Constraints/DateTime.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
/**
@@ -39,13 +40,22 @@ class DateTime extends Constraint
/**
* @param non-empty-string|array|null $format The datetime format to match (defaults to 'Y-m-d H:i:s')
* @param string[]|null $groups
- * @param array $options
+ * @param array|null $options
*/
- public function __construct(string|array|null $format = null, ?string $message = null, ?array $groups = null, mixed $payload = null, array $options = [])
+ #[HasNamedArguments]
+ public function __construct(string|array|null $format = null, ?string $message = null, ?array $groups = null, mixed $payload = null, ?array $options = null)
{
if (\is_array($format)) {
- $options = array_merge($format, $options);
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+
+ $options = array_merge($format, $options ?? []);
} elseif (null !== $format) {
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ } else {
+ $options = [];
+ }
+
$options['value'] = $format;
}
diff --git a/Constraints/DateTimeValidator.php b/Constraints/DateTimeValidator.php
index 9784a5797..f5765cbf6 100644
--- a/Constraints/DateTimeValidator.php
+++ b/Constraints/DateTimeValidator.php
@@ -44,6 +44,7 @@ public function validate(mixed $value, Constraint $constraint): void
if (0 < $errors['error_count']) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
+ ->setParameter('{{ format }}', $this->formatValue($constraint->format))
->setCode(DateTime::INVALID_FORMAT_ERROR)
->addViolation();
@@ -58,16 +59,19 @@ public function validate(mixed $value, Constraint $constraint): void
if ('The parsed date was invalid' === $warning) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
+ ->setParameter('{{ format }}', $this->formatValue($constraint->format))
->setCode(DateTime::INVALID_DATE_ERROR)
->addViolation();
} elseif ('The parsed time was invalid' === $warning) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
+ ->setParameter('{{ format }}', $this->formatValue($constraint->format))
->setCode(DateTime::INVALID_TIME_ERROR)
->addViolation();
} else {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
+ ->setParameter('{{ format }}', $this->formatValue($constraint->format))
->setCode(DateTime::INVALID_FORMAT_ERROR)
->addViolation();
}
diff --git a/Constraints/DisableAutoMapping.php b/Constraints/DisableAutoMapping.php
index 2b762059f..7cbea8b38 100644
--- a/Constraints/DisableAutoMapping.php
+++ b/Constraints/DisableAutoMapping.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
@@ -28,13 +29,18 @@ class DisableAutoMapping extends Constraint
/**
* @param array|null $options
*/
- public function __construct(?array $options = null)
+ #[HasNamedArguments]
+ public function __construct(?array $options = null, mixed $payload = null)
{
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ }
+
if (\is_array($options) && \array_key_exists('groups', $options)) {
throw new ConstraintDefinitionException(\sprintf('The option "groups" is not supported by the constraint "%s".', __CLASS__));
}
- parent::__construct($options);
+ parent::__construct($options, null, $payload);
}
public function getTargets(): string|array
diff --git a/Constraints/Email.php b/Constraints/Email.php
index 7b9b9ba2b..4a66986b2 100644
--- a/Constraints/Email.php
+++ b/Constraints/Email.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Constraints;
use Egulias\EmailValidator\EmailValidator as StrictEmailValidator;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\InvalidArgumentException;
use Symfony\Component\Validator\Exception\LogicException;
@@ -50,6 +51,7 @@ class Email extends Constraint
* @param self::VALIDATION_MODE_*|null $mode The pattern used to validate the email address; pass null to use the default mode configured for the EmailValidator
* @param string[]|null $groups
*/
+ #[HasNamedArguments]
public function __construct(
?array $options = null,
?string $message = null,
@@ -66,6 +68,10 @@ public function __construct(
throw new InvalidArgumentException('The "mode" parameter value is not valid.');
}
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ }
+
parent::__construct($options, $groups, $payload);
$this->message = $message ?? $this->message;
diff --git a/Constraints/EnableAutoMapping.php b/Constraints/EnableAutoMapping.php
index a4808d08c..873430677 100644
--- a/Constraints/EnableAutoMapping.php
+++ b/Constraints/EnableAutoMapping.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
@@ -28,13 +29,18 @@ class EnableAutoMapping extends Constraint
/**
* @param array|null $options
*/
- public function __construct(?array $options = null)
+ #[HasNamedArguments]
+ public function __construct(?array $options = null, mixed $payload = null)
{
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ }
+
if (\is_array($options) && \array_key_exists('groups', $options)) {
throw new ConstraintDefinitionException(\sprintf('The option "groups" is not supported by the constraint "%s".', __CLASS__));
}
- parent::__construct($options);
+ parent::__construct($options, null, $payload);
}
public function getTargets(): string|array
diff --git a/Constraints/Expression.php b/Constraints/Expression.php
index 298f797c4..f40577d7b 100644
--- a/Constraints/Expression.php
+++ b/Constraints/Expression.php
@@ -13,6 +13,7 @@
use Symfony\Component\ExpressionLanguage\Expression as ExpressionObject;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\LogicException;
@@ -42,16 +43,17 @@ class Expression extends Constraint
* @param string|ExpressionObject|array|null $expression The expression to evaluate
* @param array|null $values The values of the custom variables used in the expression (defaults to an empty array)
* @param string[]|null $groups
- * @param array $options
- * @param bool|null $negate Whether to fail if the expression evaluates to true (defaults to false)
+ * @param array|null $options
+ * @param bool|null $negate When set to true, if the expression returns true, the validation will pass (defaults to true)
*/
+ #[HasNamedArguments]
public function __construct(
string|ExpressionObject|array|null $expression,
?string $message = null,
?array $values = null,
?array $groups = null,
mixed $payload = null,
- array $options = [],
+ ?array $options = null,
?bool $negate = null,
) {
if (!class_exists(ExpressionLanguage::class)) {
@@ -59,9 +61,19 @@ public function __construct(
}
if (\is_array($expression)) {
- $options = array_merge($expression, $options);
- } elseif (null !== $expression) {
- $options['value'] = $expression;
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+
+ $options = array_merge($expression, $options ?? []);
+ } else {
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ } else {
+ $options = [];
+ }
+
+ if (null !== $expression) {
+ $options['value'] = $expression;
+ }
}
parent::__construct($options, $groups, $payload);
diff --git a/Constraints/ExpressionSyntax.php b/Constraints/ExpressionSyntax.php
index 8f4f59834..5a0a09de1 100644
--- a/Constraints/ExpressionSyntax.php
+++ b/Constraints/ExpressionSyntax.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
/**
@@ -37,8 +38,13 @@ class ExpressionSyntax extends Constraint
* @param string[]|null $allowedVariables Restrict the available variables in the expression to these values (defaults to null that allows any variable)
* @param string[]|null $groups
*/
+ #[HasNamedArguments]
public function __construct(?array $options = null, ?string $message = null, ?string $service = null, ?array $allowedVariables = null, ?array $groups = null, mixed $payload = null)
{
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ }
+
parent::__construct($options, $groups, $payload);
$this->message = $message ?? $this->message;
diff --git a/Constraints/File.php b/Constraints/File.php
index 8948b9ea6..7d93a2084 100644
--- a/Constraints/File.php
+++ b/Constraints/File.php
@@ -11,8 +11,10 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
+use Symfony\Component\Validator\Exception\InvalidArgumentException;
/**
* Validates that a value is a valid "file".
@@ -37,6 +39,17 @@ class File extends Constraint
public const INVALID_MIME_TYPE_ERROR = '744f00bc-4389-4c74-92de-9a43cde55534';
public const INVALID_EXTENSION_ERROR = 'c8c7315c-6186-4719-8b71-5659e16bdcb7';
public const FILENAME_TOO_LONG = 'e5706483-91a8-49d8-9a59-5e81a3c634a8';
+ public const FILENAME_INVALID_CHARACTERS = '04ee58e1-42b4-45c7-8423-8a4a145fedd9';
+
+ public const FILENAME_COUNT_BYTES = 'bytes';
+ public const FILENAME_COUNT_CODEPOINTS = 'codepoints';
+ public const FILENAME_COUNT_GRAPHEMES = 'graphemes';
+
+ private const FILENAME_VALID_COUNT_UNITS = [
+ self::FILENAME_COUNT_BYTES,
+ self::FILENAME_COUNT_CODEPOINTS,
+ self::FILENAME_COUNT_GRAPHEMES,
+ ];
protected const ERROR_NAMES = [
self::NOT_FOUND_ERROR => 'NOT_FOUND_ERROR',
@@ -46,12 +59,17 @@ class File extends Constraint
self::INVALID_MIME_TYPE_ERROR => 'INVALID_MIME_TYPE_ERROR',
self::INVALID_EXTENSION_ERROR => 'INVALID_EXTENSION_ERROR',
self::FILENAME_TOO_LONG => 'FILENAME_TOO_LONG',
+ self::FILENAME_INVALID_CHARACTERS => 'FILENAME_INVALID_CHARACTERS',
];
public ?bool $binaryFormat = null;
public array|string $mimeTypes = [];
public ?int $filenameMaxLength = null;
public array|string $extensions = [];
+ public ?string $filenameCharset = null;
+ /** @var self::FILENAME_COUNT_* */
+ public string $filenameCountUnit = self::FILENAME_COUNT_BYTES;
+
public string $notFoundMessage = 'The file could not be found.';
public string $notReadableMessage = 'The file is not readable.';
public string $maxSizeMessage = 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.';
@@ -59,6 +77,7 @@ class File extends Constraint
public string $extensionsMessage = 'The extension of the file is invalid ({{ extension }}). Allowed extensions are {{ extensions }}.';
public string $disallowEmptyMessage = 'An empty file is not allowed.';
public string $filenameTooLongMessage = 'The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less.';
+ public string $filenameCharsetMessage = 'This filename does not match the expected charset.';
public string $uploadIniSizeErrorMessage = 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.';
public string $uploadFormSizeErrorMessage = 'The file is too large.';
@@ -86,9 +105,12 @@ class File extends Constraint
* @param string|null $uploadErrorMessage Message if an unknown error occurred on upload
* @param string[]|null $groups
* @param array|string|null $extensions A list of valid extensions to check. Related media types are also enforced ({@see https://symfony.com/doc/current/reference/constraints/File.html#extensions})
+ * @param string|null $filenameCharset The charset to be used when computing filename length (defaults to null)
+ * @param self::FILENAME_COUNT_*|null $filenameCountUnit The character count unit used for checking the filename length (defaults to {@see File::FILENAME_COUNT_BYTES})
*
* @see https://www.iana.org/assignments/media-types/media-types.xhtml Existing media types
*/
+ #[HasNamedArguments]
public function __construct(
?array $options = null,
int|string|null $maxSize = null,
@@ -112,16 +134,24 @@ public function __construct(
?string $uploadErrorMessage = null,
?array $groups = null,
mixed $payload = null,
-
array|string|null $extensions = null,
?string $extensionsMessage = null,
+ ?string $filenameCharset = null,
+ ?string $filenameCountUnit = null,
+ ?string $filenameCharsetMessage = null,
) {
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ }
+
parent::__construct($options, $groups, $payload);
$this->maxSize = $maxSize ?? $this->maxSize;
$this->binaryFormat = $binaryFormat ?? $this->binaryFormat;
$this->mimeTypes = $mimeTypes ?? $this->mimeTypes;
$this->filenameMaxLength = $filenameMaxLength ?? $this->filenameMaxLength;
+ $this->filenameCharset = $filenameCharset ?? $this->filenameCharset;
+ $this->filenameCountUnit = $filenameCountUnit ?? $this->filenameCountUnit;
$this->extensions = $extensions ?? $this->extensions;
$this->notFoundMessage = $notFoundMessage ?? $this->notFoundMessage;
$this->notReadableMessage = $notReadableMessage ?? $this->notReadableMessage;
@@ -130,6 +160,7 @@ public function __construct(
$this->extensionsMessage = $extensionsMessage ?? $this->extensionsMessage;
$this->disallowEmptyMessage = $disallowEmptyMessage ?? $this->disallowEmptyMessage;
$this->filenameTooLongMessage = $filenameTooLongMessage ?? $this->filenameTooLongMessage;
+ $this->filenameCharsetMessage = $filenameCharsetMessage ?? $this->filenameCharsetMessage;
$this->uploadIniSizeErrorMessage = $uploadIniSizeErrorMessage ?? $this->uploadIniSizeErrorMessage;
$this->uploadFormSizeErrorMessage = $uploadFormSizeErrorMessage ?? $this->uploadFormSizeErrorMessage;
$this->uploadPartialErrorMessage = $uploadPartialErrorMessage ?? $this->uploadPartialErrorMessage;
@@ -142,6 +173,10 @@ public function __construct(
if (null !== $this->maxSize) {
$this->normalizeBinaryFormat($this->maxSize);
}
+
+ if (!\in_array($this->filenameCountUnit, self::FILENAME_VALID_COUNT_UNITS, true)) {
+ throw new InvalidArgumentException(\sprintf('The "filenameCountUnit" option must be one of the "%s::FILENAME_COUNT_*" constants ("%s" given).', __CLASS__, $this->filenameCountUnit));
+ }
}
public function __set(string $option, mixed $value): void
diff --git a/Constraints/FileValidator.php b/Constraints/FileValidator.php
index 03c12b91e..2b8e33494 100644
--- a/Constraints/FileValidator.php
+++ b/Constraints/FileValidator.php
@@ -137,10 +137,36 @@ public function validate(mixed $value, Constraint $constraint): void
return;
}
- $sizeInBytes = filesize($path);
$basename = $value instanceof UploadedFile ? $value->getClientOriginalName() : basename($path);
+ $filenameCharset = $constraint->filenameCharset ?? (File::FILENAME_COUNT_BYTES !== $constraint->filenameCountUnit ? 'UTF-8' : null);
+
+ if ($invalidFilenameCharset = null !== $filenameCharset) {
+ try {
+ $invalidFilenameCharset = !@mb_check_encoding($basename, $constraint->filenameCharset);
+ } catch (\ValueError $e) {
+ if (!str_starts_with($e->getMessage(), 'mb_check_encoding(): Argument #2 ($encoding) must be a valid encoding')) {
+ throw $e;
+ }
+ }
+ }
+
+ $filenameLength = $invalidFilenameCharset ? 0 : match ($constraint->filenameCountUnit) {
+ File::FILENAME_COUNT_BYTES => \strlen($basename),
+ File::FILENAME_COUNT_CODEPOINTS => mb_strlen($basename, $filenameCharset),
+ File::FILENAME_COUNT_GRAPHEMES => grapheme_strlen($basename),
+ };
+
+ if ($invalidFilenameCharset || false === ($filenameLength ?? false)) {
+ $this->context->buildViolation($constraint->filenameCharsetMessage)
+ ->setParameter('{{ name }}', $this->formatValue($basename))
+ ->setParameter('{{ charset }}', $filenameCharset)
+ ->setCode(File::FILENAME_INVALID_CHARACTERS)
+ ->addViolation();
+
+ return;
+ }
- if ($constraint->filenameMaxLength && $constraint->filenameMaxLength < $filenameLength = \strlen($basename)) {
+ if ($constraint->filenameMaxLength && $constraint->filenameMaxLength < $filenameLength) {
$this->context->buildViolation($constraint->filenameTooLongMessage)
->setParameter('{{ filename_max_length }}', $this->formatValue($constraint->filenameMaxLength))
->setCode(File::FILENAME_TOO_LONG)
@@ -150,7 +176,7 @@ public function validate(mixed $value, Constraint $constraint): void
return;
}
- if (0 === $sizeInBytes) {
+ if (!$sizeInBytes = filesize($path)) {
$this->context->buildViolation($constraint->disallowEmptyMessage)
->setParameter('{{ file }}', $this->formatValue($path))
->setParameter('{{ name }}', $this->formatValue($basename))
diff --git a/Constraints/GroupSequence.php b/Constraints/GroupSequence.php
index 3c2cc48ba..e3e4f47f9 100644
--- a/Constraints/GroupSequence.php
+++ b/Constraints/GroupSequence.php
@@ -11,6 +11,8 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
+
/**
* A sequence of validation groups.
*
@@ -75,6 +77,7 @@ class GroupSequence
*
* @param array $groups The groups in the sequence
*/
+ #[HasNamedArguments]
public function __construct(array $groups)
{
$this->groups = $groups['value'] ?? $groups;
diff --git a/Constraints/Hostname.php b/Constraints/Hostname.php
index 3090f1ecc..ca9bc3a32 100644
--- a/Constraints/Hostname.php
+++ b/Constraints/Hostname.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
/**
@@ -35,6 +36,7 @@ class Hostname extends Constraint
* @param bool|null $requireTld Whether to require the hostname to include its top-level domain (defaults to true)
* @param string[]|null $groups
*/
+ #[HasNamedArguments]
public function __construct(
?array $options = null,
?string $message = null,
@@ -42,6 +44,10 @@ public function __construct(
?array $groups = null,
mixed $payload = null,
) {
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ }
+
parent::__construct($options, $groups, $payload);
$this->message = $message ?? $this->message;
diff --git a/Constraints/Iban.php b/Constraints/Iban.php
index 71b6d18c7..459fb5fb0 100644
--- a/Constraints/Iban.php
+++ b/Constraints/Iban.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
/**
@@ -45,8 +46,13 @@ class Iban extends Constraint
* @param array|null $options
* @param string[]|null $groups
*/
+ #[HasNamedArguments]
public function __construct(?array $options = null, ?string $message = null, ?array $groups = null, mixed $payload = null)
{
+ if (\is_array($options)) {
+ trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
+ }
+
parent::__construct($options, $groups, $payload);
$this->message = $message ?? $this->message;
diff --git a/Constraints/Image.php b/Constraints/Image.php
index 5812b9a49..d9b7c8822 100644
--- a/Constraints/Image.php
+++ b/Constraints/Image.php
@@ -11,6 +11,8 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\Validator\Attribute\HasNamedArguments;
+
/**
* Validates that a file (or a path to a file) is a valid image.
*
@@ -118,6 +120,7 @@ class Image extends File
*
* @see https://www.iana.org/assignments/media-types/media-types.xhtml Existing media types
*/
+ #[HasNamedArguments]
public function __construct(
?array $options = null,
int|string|null $maxSize = null,
@@ -167,6 +170,9 @@ public function __construct(
mixed $payload = null,
array|string|null $extensions = null,
?string $extensionsMessage = null,
+ ?string $filenameCharset = null,
+ ?string $filenameCountUnit = null,
+ ?string $filenameCharsetMessage = null,
) {
parent::__construct(
$options,
@@ -192,6 +198,9 @@ public function __construct(
$payload,
$extensions,
$extensionsMessage,
+ $filenameCharset,
+ $filenameCountUnit,
+ $filenameCharsetMessage,
);
$this->minWidth = $minWidth ?? $this->minWidth;
diff --git a/Constraints/ImageValidator.php b/Constraints/ImageValidator.php
index a715471d9..9075a5b23 100644
--- a/Constraints/ImageValidator.php
+++ b/Constraints/ImageValidator.php
@@ -11,6 +11,8 @@
namespace Symfony\Component\Validator\Constraints;
+use Symfony\Component\HttpFoundation\File\File;
+use Symfony\Component\Mime\MimeTypes;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
use Symfony\Component\Validator\Exception\LogicException;
@@ -50,7 +52,13 @@ public function validate(mixed $value, Constraint $constraint): void
return;
}
- $size = @getimagesize($value);
+ $isSvg = $this->isSvg($value);
+
+ if ($isSvg) {
+ $size = $this->getSvgSize($value);
+ } else {
+ $size = @getimagesize($value);
+ }
if (!$size || (0 === $size[0]) || (0 === $size[1])) {
$this->context->buildViolation($constraint->sizeNotDetectedMessage)
@@ -63,7 +71,7 @@ public function validate(mixed $value, Constraint $constraint): void
$width = $size[0];
$height = $size[1];
- if ($constraint->minWidth) {
+ if (!$isSvg && $constraint->minWidth) {
if (!ctype_digit((string) $constraint->minWidth)) {
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid minimum width.', $constraint->minWidth));
}
@@ -79,7 +87,7 @@ public function validate(mixed $value, Constraint $constraint): void
}
}
- if ($constraint->maxWidth) {
+ if (!$isSvg && $constraint->maxWidth) {
if (!ctype_digit((string) $constraint->maxWidth)) {
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid maximum width.', $constraint->maxWidth));
}
@@ -95,7 +103,7 @@ public function validate(mixed $value, Constraint $constraint): void
}
}
- if ($constraint->minHeight) {
+ if (!$isSvg && $constraint->minHeight) {
if (!ctype_digit((string) $constraint->minHeight)) {
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid minimum height.', $constraint->minHeight));
}
@@ -111,7 +119,7 @@ public function validate(mixed $value, Constraint $constraint): void
}
}
- if ($constraint->maxHeight) {
+ if (!$isSvg && $constraint->maxHeight) {
if (!ctype_digit((string) $constraint->maxHeight)) {
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid maximum height.', $constraint->maxHeight));
}
@@ -127,7 +135,7 @@ public function validate(mixed $value, Constraint $constraint): void
$pixels = $width * $height;
- if (null !== $constraint->minPixels) {
+ if (!$isSvg && null !== $constraint->minPixels) {
if (!ctype_digit((string) $constraint->minPixels)) {
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid minimum amount of pixels.', $constraint->minPixels));
}
@@ -143,7 +151,7 @@ public function validate(mixed $value, Constraint $constraint): void
}
}
- if (null !== $constraint->maxPixels) {
+ if (!$isSvg && null !== $constraint->maxPixels) {
if (!ctype_digit((string) $constraint->maxPixels)) {
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid maximum amount of pixels.', $constraint->maxPixels));
}
@@ -227,8 +235,54 @@ public function validate(mixed $value, Constraint $constraint): void
return;
}
+ }
+ }
+
+ private function isSvg(mixed $value): bool
+ {
+ if ($value instanceof File) {
+ $mime = $value->getMimeType();
+ } elseif (class_exists(MimeTypes::class)) {
+ $mime = MimeTypes::getDefault()->guessMimeType($value);
+ } elseif (!class_exists(File::class)) {
+ return false;
+ } else {
+ $mime = (new File($value))->getMimeType();
+ }
- imagedestroy($resource);
+ return 'image/svg+xml' === $mime;
+ }
+
+ /**
+ * @return array{int, int}|null index 0 and 1 contains respectively the width and the height of the image, null if size can't be found
+ */
+ private function getSvgSize(mixed $value): ?array
+ {
+ if ($value instanceof File) {
+ $content = $value->getContent();
+ } elseif (!class_exists(File::class)) {
+ return null;
+ } else {
+ $content = (new File($value))->getContent();
}
+
+ if (1 === preg_match('/
This value should be false.
- falseである必要があります。
+ この値はfalseでなければなりません。This value should be true.
- trueである必要があります。
+ この値はtrueでなければなりません。This value should be of type {{ type }}.
- {{ type }}型でなければなりません。
+ この値は{{ type }}型でなければなりません。This value should be blank.
- 空でなければなりません。
+ この値は空でなければなりません。The value you selected is not a valid choice.
@@ -28,7 +28,7 @@
You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.
- {{ limit }}個以内で選択してください。
+ {{ limit }}個以下で選択してください。One or more of the given values is invalid.
@@ -44,15 +44,15 @@
This value is not a valid date.
- 無効な日付です。
+ 有効な日付ではありません。This value is not a valid datetime.
- 無効な日時です。
+ 有効な日時ではありません。This value is not a valid email address.
- 無効なメールアドレスです。
+ 有効なメールアドレスではありません。The file could not be found.
@@ -64,35 +64,35 @@
The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.
- ファイルのサイズが大きすぎます({{ size }} {{ suffix }})。ファイルサイズは{{ limit }} {{ suffix }}以下にしてください。
+ ファイルのサイズが大きすぎます({{ size }} {{ suffix }})。{{ limit }} {{ suffix }}以下にしてください。The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.
- ファイルのMIMEタイプが無効です({{ type }})。有効なMIMEタイプは{{ types }}です。
+ ファイルのMIMEタイプが無効です({{ type }})。有効なMIMEタイプは{{ types }}です。This value should be {{ limit }} or less.
- {{ limit }}以下でなければなりません。
+ この値は{{ limit }}以下でなければなりません。This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.
- この値は、{{ limit }}文字以内で入力してください。
+ 長すぎます。この値は{{ limit }}文字以下で入力してください。This value should be {{ limit }} or more.
- {{ limit }}以上でなければなりません。
+ この値は{{ limit }}以上でなければなりません。This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.
- この値は、{{ limit }}文字以上で入力してください。
+ 短すぎます。この値は{{ limit }}文字以上で入力してください。This value should not be blank.
- 入力してください。
+ この値は空にできません。This value should not be null.
- 入力してください。
+ 値を入力してください。This value should be null.
@@ -100,23 +100,23 @@
This value is not valid.
- 無効な値です。
+ 有効な値ではありません。This value is not a valid time.
- 無効な時刻です。
+ 有効な時刻ではありません。This value is not a valid URL.
- 無効なURLです。
+ 有効なURLではありません。The two values should be equal.
- 2つの値が同じでなければなりません。
+ 2つの値は同じでなければなりません。The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.
- ファイルのサイズが大きすぎます。有効な最大サイズは{{ limit }} {{ suffix }}です。
+ ファイルのサイズが大きすぎます。許可されている最大サイズは{{ limit }} {{ suffix }}です。The file is too large.
@@ -128,19 +128,19 @@
This value should be a valid number.
- 有効な数値ではありません。
+ この値は有効な数値でなければなりません。This file is not a valid image.
- ファイルが画像ではありません。
+ 選択されたファイルは有効な画像ではありません。This value is not a valid IP address.
- 無効なIPアドレスです。
+ 有効なIPアドレスではありません。This value is not a valid language.
- 無効な言語名です。
+ 有効な言語名ではありません。This value is not a valid locale.
@@ -160,19 +160,19 @@
The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.
- 画像の幅が大きすぎます({{ width }}ピクセル)。{{ max_width }}ピクセル以下にしてください。
+ 画像の幅が大きすぎます({{ width }}px)。{{ max_width }}px以下にしてください。The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.
- 画像の幅が小さすぎます({{ width }}ピクセル)。{{ min_width }}ピクセル以上にしてください。
+ 画像の幅が小さすぎます({{ width }}px)。{{ min_width }}px以上にしてください。The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.
- 画像の高さが大きすぎます({{ height }}ピクセル)。{{ max_height }}ピクセル以下にしてください。
+ 画像の高さが大きすぎます({{ height }}px)。{{ max_height }}px以下にしてください。The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.
- 画像の高さが小さすぎます({{ height }}ピクセル)。{{ min_height }}ピクセル以上にしてください。
+ 画像の高さが小さすぎます({{ height }}px)。{{ min_height }}px以上にしてください。This value should be the user's current password.
@@ -180,11 +180,11 @@
This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.
- {{ limit }}文字ちょうどで入力してください。
+ この値は{{ limit }}文字ちょうどで入力してください。The file was only partially uploaded.
- ファイルのアップロードに失敗しました。
+ ファイルのアップロードが完了しませんでした。No file was uploaded.
@@ -204,11 +204,11 @@
This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.
- 少なくとも{{ limit }}個の要素を含む必要があります。
+ 要素は{{ limit }}個以上でなければなりません。This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.
- {{ limit }}個以下の要素を含む必要があります。
+ 要素は{{ limit }}個以下でなければなりません。This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.
@@ -220,7 +220,7 @@
Unsupported card type or invalid card number.
- 未対応のカード種類または無効なカード番号です。
+ 対応していないカードまたは無効なカード番号です。This value is not a valid International Bank Account Number (IBAN).
@@ -248,59 +248,59 @@
This value should be equal to {{ compared_value }}.
- {{ compared_value }}と同じ値でなければなりません。
+ この値は{{ compared_value }}と同じ値でなければなりません。This value should be greater than {{ compared_value }}.
- {{ compared_value }}より大きくなければなりません。
+ この値は{{ compared_value }}より大きくなければなりません。This value should be greater than or equal to {{ compared_value }}.
- {{ compared_value }}以上でなければなりません。
+ この値は{{ compared_value }}以上でなければなりません。This value should be identical to {{ compared_value_type }} {{ compared_value }}.
- この値は{{ compared_value_type }} {{ compared_value }}と同じでなければなりません。
+ この値は{{ compared_value_type }}型の{{ compared_value }}と同じでなければなりません。This value should be less than {{ compared_value }}.
- {{ compared_value }}未満でなければなりません。
+ この値は{{ compared_value }}未満でなければなりません。This value should be less than or equal to {{ compared_value }}.
- {{ compared_value }}以下でなければなりません。
+ この値は{{ compared_value }}以下でなければなりません。This value should not be equal to {{ compared_value }}.
- {{ compared_value }}と等しくてはいけません。
+ この値は{{ compared_value }}と等しくてはいけません。This value should not be identical to {{ compared_value_type }} {{ compared_value }}.
- この値は{{ compared_value_type }}の{{ compared_value }}と異なる値にしてください。
+ この値は{{ compared_value_type }}型の{{ compared_value }}と異なる値にしてください。The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.
- 画像のアスペクト比が大きすぎます({{ ratio }})。{{ max_ratio }}までにしてください。
+ 画像のアスペクト比が大きすぎます({{ ratio }})。{{ max_ratio }}までにしてください。The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.
- 画像のアスペクト比が小さすぎます({{ ratio }})。{{ min_ratio }}以上にしてください。
+ 画像のアスペクト比が小さすぎます({{ ratio }})。{{ min_ratio }}以上にしてください。The image is square ({{ width }}x{{ height }}px). Square images are not allowed.
- 画像が正方形になっています({{ width }}x{{ height }}ピクセル)。正方形の画像は許可されていません。
+ 画像が正方形になっています({{ width }}x{{ height }}px)。正方形の画像は許可されていません。The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.
- 画像が横向きになっています({{ width }}x{{ height }}ピクセル)。横向きの画像は許可されていません。
+ 画像が横向きになっています({{ width }}x{{ height }}px)。横向きの画像は許可されていません。The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.
- 画像が縦向きになっています({{ width }}x{{ height }}ピクセル)。縦向きの画像は許可されていません。
+ 画像が縦向きになっています({{ width }}x{{ height }}px)。縦向きの画像は許可されていません。An empty file is not allowed.
- 空のファイルは無効です。
+ 空のファイルは許可されていません。The host could not be resolved.
@@ -308,11 +308,11 @@
This value does not match the expected {{ charset }} charset.
- 文字コードが{{ charset }}と一致しません。
+ この値の文字コードが期待される{{ charset }}と一致しません。This value is not a valid Business Identifier Code (BIC).
- 有効なSWIFTコードではありません。
+ 有効な事業者識別コード(BIC)ではありません。Error
@@ -324,7 +324,7 @@
This value should be a multiple of {{ compared_value }}.
- {{ compared_value }}の倍数でなければなりません。
+ この値は{{ compared_value }}の倍数でなければなりません。This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.
@@ -332,7 +332,7 @@
This value should be valid JSON.
- 有効なJSONでなければなりません。
+ この値は有効なJSONでなければなりません。This collection should contain only unique elements.
@@ -340,19 +340,19 @@
This value should be positive.
- 正の数でなければなりません。
+ この値は正の数でなければなりません。This value should be either positive or zero.
- 正の数、または0でなければなりません。
+ この値は正の数、または0でなければなりません。This value should be negative.
- 負の数でなければなりません。
+ この値は負の数でなければなりません。This value should be either negative or zero.
- 負の数、または0でなければなりません。
+ この値は負の数、または0でなければなりません。This value is not a valid timezone.
@@ -364,7 +364,7 @@
This value should be between {{ min }} and {{ max }}.
- {{ min }}以上{{ max }}以下でなければなりません。
+ この値は{{ min }}以上{{ max }}以下でなければなりません。This value is not a valid hostname.
@@ -376,11 +376,11 @@
This value should satisfy at least one of the following constraints:
- 以下の制約のうち少なくとも1つを満たす必要があります:
+ 以下の制約のうち少なくとも1つを満たさなければなりません。Each element of this collection should satisfy its own set of constraints.
- コレクションの各要素は、それぞれの制約を満たす必要があります。
+ コレクションの各要素は、それぞれの制約を満たさなければなりません。This value is not a valid International Securities Identification Number (ISIN).
@@ -388,7 +388,7 @@
This value should be a valid expression.
- 有効な式でなければなりません。
+ この値は有効な式形式でなければなりません。This value is not a valid CSS color.
@@ -400,7 +400,7 @@
The value of the netmask should be between {{ min }} and {{ max }}.
- ネットマスクは{{ min }}から{{ max }}の範囲で入力してください。
+ サブネットマスクは{{ min }}から{{ max }}の範囲で入力してください。The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less.
@@ -428,11 +428,11 @@
The extension of the file is invalid ({{ extension }}). Allowed extensions are {{ extensions }}.
- ファイルの拡張子が無効です({{ extension }})。有効な拡張子は{{ extensions }}です。
+ ファイルの拡張子が無効です({{ extension }})。有効な拡張子は{{ extensions }}です。The detected character encoding is invalid ({{ detected }}). Allowed encodings are {{ encodings }}.
- 検出された文字コードは無効です({{ detected }})。有効な文字コードは{{ encodings }}です。
+ 検出された文字コードは無効です({{ detected }})。有効な文字コードは{{ encodings }}です。This value is not a valid MAC address.
@@ -444,11 +444,11 @@
This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words.
- 短すぎます。{{ min }}単語以上にする必要があります。
+ 短すぎます。この値は{{ min }}単語以上にする必要があります。This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less.
- 長すぎます。{{ max }}単語以下にする必要があります。
+ 長すぎます。この値は{{ max }}単語以下にする必要があります。This value does not represent a valid week in the ISO 8601 format.
@@ -456,7 +456,7 @@
This value is not a valid week.
- 無効な週形式です。
+ 有効な週形式ではありません。This value should not be before week "{{ min }}".
@@ -470,6 +470,90 @@
This value is not a valid Twig template.有効なTwigテンプレートではありません。
+
+ This file is not a valid video.
+ 選択されたファイルは有効な動画ではありません。
+
+
+ The size of the video could not be detected.
+ 動画のファイルサイズを検出できませんでした。
+
+
+ The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.
+ 動画の幅が大きすぎます({{ width }}px)。許可されている最大の幅は {{ max_width }}px です。
+
+
+ The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.
+ 動画の幅が小さすぎます({{ width }}px)。許可されている最小の幅は {{ min_width }}px です。
+
+
+ The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.
+ 動画の高さが大きすぎます ({{ height }}px)。許可されている最大の高さは {{ max_height }}px です。
+
+
+ The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.
+ 動画の高さが小さすぎます ({{ height }}px)。許可されている最小の高さは {{ min_height }}px です。
+
+
+ The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels.
+ この動画のピクセル数が少なすぎます ({{ pixels }})。許可されている最小ピクセル数は {{ min_pixels }} です。
+
+
+ The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels.
+ この動画のピクセル数が多すぎます ({{ pixels }})。許可されている最大ピクセル数は {{ max_pixels }} です。
+
+
+ The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.
+ 動画のアスペクト比が大きすぎます ({{ ratio }})。許可されている最大比率は {{ max_ratio }} です。
+
+
+ The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.
+ 動画のアスペクト比が小さすぎます ({{ ratio }})。許可されている最小比率は {{ min_ratio }} です。
+
+
+ The video is square ({{ width }}x{{ height }}px). Square videos are not allowed.
+ 動画は正方形です ({{ width }}x{{ height }}px)。正方形の動画は許可されていません。
+
+
+ The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed.
+ 動画は横向きです({{ width }}x{{ height }}px)。横向きの動画は許可されていません。
+
+
+ The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed.
+ 動画は縦向きです({{ width }}x{{ height }}px)。縦向きの動画は許可されていません。
+
+
+ The video file is corrupted.
+ 動画ファイルが破損しています。
+
+
+ The video contains multiple streams. Only one stream is allowed.
+ この動画には複数のストリームが含まれています。許可されるのは1つのストリームのみです。
+
+
+ Unsupported video codec "{{ codec }}".
+ サポートされていないビデオコーデック「{{ codec }}」です。
+
+
+ Unsupported video container "{{ container }}".
+ サポートされていない動画コンテナ「{{ container }}」です。
+
+
+ The image file is corrupted.
+ 画像ファイルが破損しています。
+
+
+ The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels.
+ 画像のピクセル数が少なすぎます({{ pixels }})。許可されている最小ピクセル数は {{ min_pixels }} です。
+
+
+ The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels.
+ 画像のピクセル数が多すぎます({{ pixels }})。許可されている最大ピクセル数は {{ max_pixels }} です。
+
+
+ This filename does not match the expected charset.
+ このファイル名は期待される文字セットと一致しません。
+ This value should be false.
- Această valoare ar trebui să fie falsă (false).
+ Această valoare ar trebui să fie falsă.This value should be true.
- Această valoare ar trebui să fie adevărată (true).
+ Această valoare ar trebui să fie adevărată.This value should be of type {{ type }}.
@@ -16,7 +16,7 @@
This value should be blank.
- Această valoare ar trebui sa fie goală.
+ Această valoare ar trebui să fie necompletată.The value you selected is not a valid choice.
@@ -24,11 +24,11 @@
You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.
- Trebuie să selectați cel puțin {{ limit }} opțiune.|Trebuie să selectați cel puțin {{ limit }} opțiuni.|Trebuie să selectați cel puțin {{ limit }} de opțiuni
+ Trebuie să selectați cel puțin {{ limit }} opțiune.|Trebuie să selectați cel puțin {{ limit }} opțiuni.You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.
- Trebuie să selectați cel mult {{ limit }} opțiune.|Trebuie să selectați cel mult {{ limit }} opțiuni.|Trebuie să selectați cel mult {{ limit }} de opțiuni.
+ Trebuie să selectați cel mult {{ limit }} opțiune.|Trebuie să selectați cel mult {{ limit }} opțiuni.One or more of the given values is invalid.
@@ -36,11 +36,11 @@
This field was not expected.
- Acest câmp nu era de aşteptat.
+ Acest câmp nu era prevăzut.This field is missing.
- Acest câmp este lipsă.
+ Acest câmp lipsește.This value is not a valid date.
@@ -68,7 +68,7 @@
The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.
- Tipul fișierului este invalid ({{ type }}). Tipurile permise de fișiere sunt ({{ types }}).
+ Tipul fișierului este invalid ({{ type }}). Tipurile de fișiere permise sunt {{ types }}.This value should be {{ limit }} or less.
@@ -76,7 +76,7 @@
This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.
- Această valoare este prea lungă. Ar trebui să aibă maxim {{ limit }} caracter.|Această valoare este prea lungă. Ar trebui să aibă maxim {{ limit }} caractere.|Această valoare este prea lungă. Ar trebui să aibă maxim {{ limit }} de caractere.
+ Această valoare este prea lungă. Ar trebui să aibă maxim {{ limit }} caracter.|Această valoare este prea lungă. Ar trebui să aibă maxim {{ limit }} caractere.This value should be {{ limit }} or more.
@@ -84,19 +84,19 @@
This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.
- Această valoare este prea scurtă. Ar trebui să aibă minim {{ limit }} caracter.|Această valoare este prea scurtă. Ar trebui să aibă minim {{ limit }} caractere.|Această valoare este prea scurtă. Ar trebui să aibă minim {{ limit }} de caractere.
+ Această valoare este prea scurtă. Ar trebui să aibă minim {{ limit }} caracter.|Această valoare este prea scurtă. Ar trebui să aibă minim {{ limit }} caractere.This value should not be blank.
- Această valoare nu ar trebui să fie goală.
+ Această valoare nu ar trebui să fie necompletată.This value should not be null.
- Această valoare nu ar trebui să fie nulă (null).
+ Această valoare nu ar trebui să fie nulă.This value should be null.
- Această valoare ar trebui să fie nulă (null).
+ Această valoare ar trebui să fie nulă.This value is not valid.
@@ -108,7 +108,7 @@
This value is not a valid URL.
- Această valoare nu reprezintă un URL (link) valid.
+ Această valoare nu reprezintă un URL valid.The two values should be equal.
@@ -116,7 +116,7 @@
The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.
- Fișierul este prea mare. Mărimea maximă permisă este {{ limit }} {{ suffix }}.
+ Fișierul este prea mare. Mărimea maximă permisă este de {{ limit }} {{ suffix }}.The file is too large.
@@ -144,7 +144,7 @@
This value is not a valid locale.
- Această valoare nu reprezintă un dialect (o limbă) corect.
+ Această valoare nu este o localizare validă.This value is not a valid country.
@@ -180,7 +180,7 @@
This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.
- Această valoare trebuie să conțină exact {{ limit }} caracter.|Această valoare trebuie să conțină exact {{ limit }} caractere.|Această valoare trebuie să conțină exact {{ limit }} de caractere.
+ Această valoare trebuie să conțină exact {{ limit }} caracter.|Această valoare trebuie să conțină exact {{ limit }} caractere.The file was only partially uploaded.
@@ -188,7 +188,7 @@
No file was uploaded.
- Nu a fost încărcat nici un fișier.
+ Nu a fost încărcat niciun fișier.No temporary folder was configured in php.ini, or the configured folder does not exist.
@@ -200,27 +200,27 @@
A PHP extension caused the upload to fail.
- O extensie PHP a prevenit încărcarea cu succes a fișierului.
+ O extensie PHP a cauzat eșecul încărcării.This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.
- Această colecție trebuie să conțină cel puțin {{ limit }} element.|Această colecție trebuie să conțină cel puțin {{ limit }} elemente.|Această colecție trebuie să conțină cel puțin {{ limit }} de elemente.
+ Această colecție trebuie să conțină cel puțin {{ limit }} element.|Această colecție trebuie să conțină cel puțin {{ limit }} elemente.This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.
- Această colecție trebuie să conțină cel mult {{ limit }} element.|Această colecție trebuie să conțină cel mult {{ limit }} elemente.|Această colecție trebuie să conțină cel mult {{ limit }} de elemente.
+ Această colecție trebuie să conțină cel mult {{ limit }} element.|Această colecție trebuie să conțină cel mult {{ limit }} elemente.This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.
- Această colecție trebuie să conțină {{ limit }} element.|Această colecție trebuie să conțină {{ limit }} elemente.|Această colecție trebuie să conțină {{ limit }} de elemente.
+ Această colecție trebuie să conțină exact {{ limit }} element.|Această colecție trebuie să conțină exact {{ limit }} elemente.Invalid card number.
- Numărul card invalid.
+ Numărul cardului este invalid.Unsupported card type or invalid card number.
- Tipul sau numărul cardului nu sunt valide.
+ Tipul sau numărul cardului sunt invalide.This value is not a valid International Bank Account Number (IBAN).
@@ -252,7 +252,7 @@
This value should be greater than {{ compared_value }}.
- Această valoare trebuie să fie mai mare de {{ compared_value }}.
+ Această valoare trebuie să fie mai mare decât {{ compared_value }}.This value should be greater than or equal to {{ compared_value }}.
@@ -260,11 +260,11 @@
This value should be identical to {{ compared_value_type }} {{ compared_value }}.
- Această valoare trebuie identică cu {{ compared_value_type }} {{ compared_value }}.
+ Această valoare trebuie să fie identică cu {{ compared_value_type }} {{ compared_value }}.This value should be less than {{ compared_value }}.
- Această valoare trebuie să fie mai mică de {{ compared_value }}.
+ Această valoare trebuie să fie mai mică decât {{ compared_value }}.This value should be less than or equal to {{ compared_value }}.
@@ -288,11 +288,11 @@
The image is square ({{ width }}x{{ height }}px). Square images are not allowed.
- Imaginea este un pătrat ({{ width }}x{{ height }}px). Imaginile pătrat nu sunt permise.
+ Imaginea este pătrată ({{ width }}x{{ height }}px). Imaginile pătrate nu sunt permise.The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.
- Imaginea are orientarea peisaj ({{ width }}x{{ height }}px). Imaginile cu orientare peisaj nu sunt permise.
+ Imaginea are orientarea orizontală ({{ width }}x{{ height }}px). Imaginile cu orientare orizontală nu sunt permise.The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.
@@ -304,7 +304,7 @@
The host could not be resolved.
- Numele host nu a putut fi rezolvat către o adresă IP.
+ Host-ul nu a putut fi rezolvat.This value does not match the expected {{ charset }} charset.
@@ -336,7 +336,7 @@
This collection should contain only unique elements.
- Acest set ar trebui să conțină numai elemente unice.
+ Această colecție ar trebui să conțină numai elemente unice.This value should be positive.
@@ -368,19 +368,19 @@
This value is not a valid hostname.
- Această valoare nu este un numele gazdei valid.
+ Această valoare nu este un hostname valid.The number of elements in this collection should be a multiple of {{ compared_value }}.
- Numărul de elemente din această colecție ar trebui să fie un multiplu al {{ compared_value }}.
+ Numărul de elemente din această colecție ar trebui să fie un multiplu de {{ compared_value }}.This value should satisfy at least one of the following constraints:
- Această valoare trebuie să îndeplinească cel puțin una dintre următoarele reguli:
+ Această valoare trebuie să îndeplinească cel puțin una dintre următoarele condiții:Each element of this collection should satisfy its own set of constraints.
- Fiecare element din acest set ar trebui să îndeplinească propriul set de reguli.
+ Fiecare element din acest set ar trebui să îndeplinească propriul set de condiții.This value is not a valid International Securities Identification Number (ISIN).
@@ -400,11 +400,11 @@
The value of the netmask should be between {{ min }} and {{ max }}.
- Valoarea netmask-ului trebuie sa fie intre {{ min }} si {{ max }}.
+ Valoarea măștii de rețea trebuie să fie între {{ min }} și {{ max }}.The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less.
- Denumirea fișierului este prea lungă. Ea trebuie să conțină {{ filename_max_length }} caractere sau mai puține.|Denumirea fișierului este prea lungă. Ea trebuie să conțină {{ filename_max_length }} caractere sau mai puține.
+ Denumirea fișierului este prea lungă. Trebuie să conțină {{ filename_max_length }} caracter sau mai puțin.|Denumirea fișierului este prea lungă. Trebuie să conțină {{ filename_max_length }} caractere sau mai puține.The password strength is too low. Please use a stronger password.
@@ -424,7 +424,7 @@
Using hidden overlay characters is not allowed.
- Folosirea caracterelor invizibile suprapuse nu este permisă.
+ Folosirea caracterelor ascunse nu este permisă.The extension of the file is invalid ({{ extension }}). Allowed extensions are {{ extensions }}.
@@ -432,7 +432,7 @@
The detected character encoding is invalid ({{ detected }}). Allowed encodings are {{ encodings }}.
- Codificarea caracterelor detectate nu este valabilă ({{ detected }}). Codificările permise sunt {{ encodings }}.
+ Codificarea caracterelor detectate este invalidă ({{ detected }}). Codificările permise sunt {{ encodings }}.This value is not a valid MAC address.
@@ -468,7 +468,91 @@
This value is not a valid Twig template.
- Această valoare nu este un șablon Twig valid.
+ Această valoare nu este un șablon Twig valid.
+
+
+ This file is not a valid video.
+ Acest fișier nu este un videoclip valid.
+
+
+ The size of the video could not be detected.
+ Dimensiunea videoclipului nu a putut fi detectată.
+
+
+ The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.
+ Lățimea videoclipului este prea mare ({{ width }}px). Lățimea maximă permisă este {{ max_width }}px.
+
+
+ The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.
+ Lățimea videoclipului este prea mică ({{ width }}px). Lățimea minimă așteptată este {{ min_width }}px.
+
+
+ The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.
+ Înălțimea videoclipului este prea mare ({{ height }}px). Înălțimea maximă permisă este {{ max_height }}px.
+
+
+ The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.
+ Înălțimea videoclipului este prea mică ({{ height }}px). Înălțimea minimă așteptată este {{ min_height }}px.
+
+
+ The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels.
+ Videoclipul are prea puțini pixeli ({{ pixels }}). Cantitatea minimă așteptată este {{ min_pixels }}.
+
+
+ The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels.
+ Videoclipul are prea mulți pixeli ({{ pixels }}). Cantitatea maximă așteptată este {{ max_pixels }}.
+
+
+ The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.
+ Raportul video este prea mare ({{ ratio }}). Raportul maxim permis este {{ max_ratio }}.
+
+
+ The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.
+ Raportul video este prea mic ({{ ratio }}). Raportul minim așteptat este {{ min_ratio }}.
+
+
+ The video is square ({{ width }}x{{ height }}px). Square videos are not allowed.
+ Videoclipul este pătrat ({{ width }}x{{ height }}px). Videoclipurile pătrate nu sunt permise.
+
+
+ The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed.
+ Videoclipul are orientare peisaj ({{ width }}x{{ height }} px). Videoclipurile în orientare peisaj nu sunt permise.
+
+
+ The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed.
+ Videoclipul este în orientare portret ({{ width }}x{{ height }}px). Videoclipurile cu orientare portret nu sunt permise.
+
+
+ The video file is corrupted.
+ Fișierul video este corupt.
+
+
+ The video contains multiple streams. Only one stream is allowed.
+ Videoclipul conține mai multe fluxuri. Doar un singur flux este permis.
+
+
+ Unsupported video codec "{{ codec }}".
+ Codec video nesuportat „{{ codec }}”.
+
+
+ Unsupported video container "{{ container }}".
+ Container video nesuportat "{{ container }}".
+
+
+ The image file is corrupted.
+ Fișierul imagine este corupt.
+
+
+ The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels.
+ Imaginea are prea puțini pixeli ({{ pixels }}). Cantitatea minimă așteptată este {{ min_pixels }}.
+
+
+ The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels.
+ Imaginea are prea mulți pixeli ({{ pixels }}). Cantitatea maximă așteptată este {{ max_pixels }}.
+
+
+ This filename does not match the expected charset.
+ Acest nume de fișier nu corespunde setului de caractere așteptat.This value should be false.
- 该变量的值应为 false 。
+ 该值应为 false 。This value should be true.
- 该变量的值应为 true 。
+ 该值应为 true 。This value should be of type {{ type }}.
- 该变量的类型应为 {{ type }} 。
+ 该值的类型应为 {{ type }} 。This value should be blank.
- 该变量值应为空。
+ 该值应为空。The value you selected is not a valid choice.
- 选定变量的值不是有效的选项。
+ 该值不是有效的选项。You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.
@@ -36,11 +36,11 @@
This field was not expected.
- 此字段是多余的。
+ 该字段是多余的。This field is missing.
- 此字段缺失。
+ 该字段缺失。This value is not a valid date.
@@ -64,43 +64,43 @@
The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.
- 文件太大 ({{ size }} {{ suffix }})。文件大小不可以超过 {{ limit }} {{ suffix }} 。
+ 文件太大 ({{ size }} {{ suffix }}),文件大小不应超过 {{ limit }} {{ suffix }} 。The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.
- 无效的文件类型 ({{ type }}) 。允许的文件类型有 {{ types }} 。
+ 无效的文件类型 ({{ type }}) ,允许的文件类型有 {{ types }} 。This value should be {{ limit }} or less.
- 这个变量的值应该小于或等于 {{ limit }}。
+ 该值应小于或等于 {{ limit }} 。This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.
- 字符串太长,长度不可超过 {{ limit }} 个字符。
+ 该值太长,长度不应超过 {{ limit }} 个字符。This value should be {{ limit }} or more.
- 该变量的值应该大于或等于 {{ limit }}。
+ 该值应大于或等于 {{ limit }} 。This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.
- 字符串太短,长度不可少于 {{ limit }} 个字符。
+ 该值太短,长度不应少于 {{ limit }} 个字符。This value should not be blank.
- 该变量不应为空。
+ 该值不应为空。This value should not be null.
- 该变量不应为 null 。
+ 该值不应为 null 。This value should be null.
- 该变量应为空 null 。
+ 该值应为 null 。This value is not valid.
- 该变量值无效 。
+ 该值无效。This value is not a valid time.
@@ -112,11 +112,11 @@
The two values should be equal.
- 这两个变量的值应该相等。
+ 该两个变量值应相等。The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.
- 文件太大,文件大小不可以超过 {{ limit }} {{ suffix }}。
+ 文件太大,文件大小不可以超过 {{ limit }} {{ suffix }} 。The file is too large.
@@ -128,7 +128,7 @@
This value should be a valid number.
- 该值应该为有效的数字。
+ 该值应为有效的数字。This file is not a valid image.
@@ -136,19 +136,19 @@
This value is not a valid IP address.
- 该值不是有效的IP地址。
+ 该值不是有效的 IP 地址。This value is not a valid language.
- 该值不是有效的语言名。
+ 该值不是有效的语言名称(language)。This value is not a valid locale.
- 该值不是有效的区域值(locale)。
+ 该值不是有效的区域名称(locale)。This value is not a valid country.
- 该值不是有效的国家名。
+ 该值不是有效的国家名称(country)。This value is already used.
@@ -176,15 +176,15 @@
This value should be the user's current password.
- 该变量的值应为用户当前的密码。
+ 该值应为用户当前的密码。This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.
- 该变量应为 {{ limit }} 个字符。
+ 该值应为 {{ limit }} 个字符。The file was only partially uploaded.
- 该文件的上传不完整。
+ 文件的上传不完整。No file was uploaded.
@@ -204,15 +204,15 @@
This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.
- 该集合最少应包含 {{ limit }} 个元素。
+ 该集合不应少于 {{ limit }} 个元素。This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.
- 该集合最多包含 {{ limit }} 个元素。
+ 该集合不应超过 {{ limit }} 个元素。This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.
- 该集合应包含 {{ limit }} 个元素 element 。
+ 该集合应为 {{ limit }} 个元素。Invalid card number.
@@ -228,11 +228,11 @@
This value is not a valid ISBN-10.
- 该值不是有效的10位国际标准书号(ISBN-10)。
+ 该值不是有效的 10 位国际标准书号(ISBN-10)。This value is not a valid ISBN-13.
- 该值不是有效的13位国际标准书号(ISBN-13)。
+ 该值不是有效的 13 位国际标准书号(ISBN-13)。This value is neither a valid ISBN-10 nor a valid ISBN-13.
@@ -244,7 +244,7 @@
This value is not a valid currency.
- 该值不是有效的货币名(currency)。
+ 该值不是有效的货币名称(currency)。This value should be equal to {{ compared_value }}.
@@ -272,7 +272,7 @@
This value should not be equal to {{ compared_value }}.
- 该值不应先等于 {{ compared_value }} 。
+ 该值不应等于 {{ compared_value }} 。This value should not be identical to {{ compared_value_type }} {{ compared_value }}.
@@ -280,11 +280,11 @@
The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.
- 图片宽高比太大 ({{ ratio }})。允许的最大宽高比为 {{ max_ratio }}。
+ 图片宽高比太大 ({{ ratio }})。允许的最大宽高比为 {{ max_ratio }} 。The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.
- 图片宽高比太小 ({{ ratio }})。允许的最大宽高比为 {{ min_ratio }}。
+ 图片宽高比太小 ({{ ratio }})。允许的最大宽高比为 {{ min_ratio }} 。The image is square ({{ width }}x{{ height }}px). Square images are not allowed.
@@ -320,43 +320,43 @@
This value is not a valid UUID.
- 该值不是有效的UUID。
+ 该值不是有效的 UUID 。This value should be a multiple of {{ compared_value }}.
- 此值应为 {{ compared_value }} 的倍数。
+ 该值应为 {{ compared_value }} 的倍数。This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.
- 此业务标识符代码(BIC)与IBAN {{ iban }} 无关。
+ 该业务标识符代码(BIC)与 IBAN {{ iban }} 无关。This value should be valid JSON.
- 该值应该是有效的JSON。
+ 该值应为有效的 JSON 。This collection should contain only unique elements.
- 该集合应仅包含独一无二的元素。
+ 该集合不能包含重复项。This value should be positive.
- 数值应为正数。
+ 该值应为正数。This value should be either positive or zero.
- 数值应是正数,或为零。
+ 该值应为正数或零。This value should be negative.
- 数值应为负数。
+ 该值应为负数。This value should be either negative or zero.
- 数值应是负数,或为零。
+ 该值应为负数或零。This value is not a valid timezone.
- 无效时区。
+ 该值不是有效的时区。This password has been leaked in a data breach, it must not be used. Please use another password.
@@ -364,7 +364,7 @@
This value should be between {{ min }} and {{ max }}.
- 该数值应在 {{ min }} 和 {{ max }} 之间。
+ 该值应在 {{ min }} 和 {{ max }} 之间。This value is not a valid hostname.
@@ -372,31 +372,31 @@
The number of elements in this collection should be a multiple of {{ compared_value }}.
- 该集合内的元素数量得是 {{ compared_value }} 的倍数。
+ 该集合的元素数量应为 {{ compared_value }} 的倍数。This value should satisfy at least one of the following constraints:
- 该值需符合以下其中一个约束:
+ 该值应符合以下其中一个约束:Each element of this collection should satisfy its own set of constraints.
- 该集合内的每个元素需符合元素本身规定的约束。
+ 该集合的每个元素应符合元素本身规定的约束。This value is not a valid International Securities Identification Number (ISIN).
- 该值不是有效的国际证券识别码 (ISIN)。
+ 该值不是有效的国际证券识别码(ISIN)。This value should be a valid expression.
- 该值需为一个有效的表达式。
+ 该值应为一个有效的表达式。This value is not a valid CSS color.
- 该值不是有效的CSS颜色。
+ 该值不是有效的 CSS 颜色。This value is not a valid CIDR notation.
- 该值不是一个有效的CIDR表示。
+ 该值不是一个有效的 CIDR 表示。The value of the netmask should be between {{ min }} and {{ max }}.
@@ -404,11 +404,11 @@
The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less.
- 该文件名过长,最长不应超过{{ filename_max_length }} 个字符。
+ 文件名过长,最长不应超过{{ filename_max_length }} 个字符。The password strength is too low. Please use a stronger password.
- 该密码强度太低。请使用更复杂的密码。
+ 密码强度太低。请使用更复杂的密码。This value contains characters that are not allowed by the current restriction-level.
@@ -428,27 +428,27 @@
The extension of the file is invalid ({{ extension }}). Allowed extensions are {{ extensions }}.
- 文件的扩展名无效 ({{ extension }})。允许的扩展名为 {{ extensions }}。
+ 文件的扩展名无效 ({{ extension }})。允许的扩展名为 {{ extensions }} 。The detected character encoding is invalid ({{ detected }}). Allowed encodings are {{ encodings }}.
- 检测到的字符编码无效 ({{ detected }})。允许的编码为 {{ encodings }}。
+ 检测到的字符编码无效 ({{ detected }})。允许的编码为 {{ encodings }} 。This value is not a valid MAC address.
- 该值不是有效的MAC地址。
+ 该值不是有效的 MAC 地址。This URL is missing a top-level domain.
- 此URL缺少顶级域名。
+ 该 URL 缺少顶级域名。This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words.
- 该值太短,应该至少包含一个词。|该值太短,应该至少包含 {{ min }} 个词。
+ 该值太短,应至少包含一个词。|该值太短,应至少包含 {{ min }} 个词。This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less.
- 该值太长,应该只包含一个词。|该值太长,应该只包含 {{ max }} 个或更少个词。
+ 该值太长,应只包含一个词。|该值太长,应只包含 {{ max }} 个或更少个词。This value does not represent a valid week in the ISO 8601 format.
@@ -468,7 +468,91 @@
This value is not a valid Twig template.
- 此值不是有效的 Twig 模板。
+ 该值不是有效的 Twig 模板。
+
+
+ This file is not a valid video.
+ 此文件不是有效的视频。
+
+
+ The size of the video could not be detected.
+ 无法检测到视频的大小。
+
+
+ The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.
+ 视频宽度过大({{ width }}px)。允许的最大宽度为 {{ max_width }}px。
+
+
+ The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.
+ 视频宽度太小({{ width }}px)。预期的最小宽度为 {{ min_width }} 像素。
+
+
+ The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.
+ 视频高度过大({{ height }}px)。允许的最大高度为 {{ max_height }}px。
+
+
+ The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.
+ 视频高度太小({{ height }}px)。期望的最小高度为 {{ min_height }}px。
+
+
+ The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels.
+ 该视频像素过少 ({{ pixels }}). 期望的最小值为 {{ min_pixels }}。
+
+
+ The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels.
+ 该视频的像素过多({{ pixels }})。预期的最大数量为 {{ max_pixels }}。
+
+
+ The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.
+ 视频纵横比过大({{ ratio }})。允许的最大纵横比为 {{ max_ratio }}。
+
+
+ The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.
+ 视频纵横比过小({{ ratio }})。预期的最低比例为 {{ min_ratio }}。
+
+
+ The video is square ({{ width }}x{{ height }}px). Square videos are not allowed.
+ 视频为正方形 ({{ width }}x{{ height }}px)。不允许正方形视频。
+
+
+ The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed.
+ 视频为横向({{ width }}x{{ height }} 像素)。不允许横向视频。
+
+
+ The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed.
+ 该视频为竖屏方向({{ width }}x{{ height }}px)。不允许竖屏视频。
+
+
+ The video file is corrupted.
+ 视频文件已损坏。
+
+
+ The video contains multiple streams. Only one stream is allowed.
+ 该视频包含多个流。只允许一个流。
+
+
+ Unsupported video codec "{{ codec }}".
+ 不支持的视频编解码器“{{ codec }}”。
+
+
+ Unsupported video container "{{ container }}".
+ 不支持的视频容器 "{{ container }}".
+
+
+ The image file is corrupted.
+ 图像文件已损坏。
+
+
+ The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels.
+ 图像的像素太少({{ pixels }})。预期的最小数量为 {{ min_pixels }}。
+
+
+ The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels.
+ 图像的像素过多 ({{ pixels }}). 预期的最大数量为 {{ max_pixels }}.
+
+
+ This filename does not match the expected charset.
+ 该文件名与预期的字符集不匹配。