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('/]+width="(?[0-9]+)"[^<>]*>/', $content, $widthMatches)) { + $width = (int) $widthMatches['width']; + } + + if (1 === preg_match('/]+height="(?[0-9]+)"[^<>]*>/', $content, $heightMatches)) { + $height = (int) $heightMatches['height']; + } + + if (1 === preg_match('/]+viewBox="-?[0-9]+ -?[0-9]+ (?-?[0-9]+) (?-?[0-9]+)"[^<>]*>/', $content, $viewBoxMatches)) { + $width ??= (int) $viewBoxMatches['width']; + $height ??= (int) $viewBoxMatches['height']; + } + + if (isset($width) && isset($height)) { + return [$width, $height]; + } + + return null; } } diff --git a/Constraints/Ip.php b/Constraints/Ip.php index 97743030d..4db552a76 100644 --- a/Constraints/Ip.php +++ b/Constraints/Ip.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; @@ -111,6 +112,7 @@ class Ip extends Constraint * @param self::V4*|self::V6*|self::ALL*|null $version The IP version to validate (defaults to {@see self::V4}) * @param string[]|null $groups */ + #[HasNamedArguments] public function __construct( ?array $options = null, ?string $version = null, @@ -119,6 +121,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->version = $version ?? $this->version; diff --git a/Constraints/IsFalse.php b/Constraints/IsFalse.php index a46b071c9..bcdadeaf9 100644 --- a/Constraints/IsFalse.php +++ b/Constraints/IsFalse.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 IsFalse 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/IsNull.php b/Constraints/IsNull.php index 9f86e8560..fa04703ea 100644 --- a/Constraints/IsNull.php +++ b/Constraints/IsNull.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 IsNull 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/IsTrue.php b/Constraints/IsTrue.php index c8418a280..3c0345e77 100644 --- a/Constraints/IsTrue.php +++ b/Constraints/IsTrue.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 IsTrue 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/Isbn.php b/Constraints/Isbn.php index c1bc83a34..45ca4e4b8 100644 --- a/Constraints/Isbn.php +++ b/Constraints/Isbn.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Constraints; +use Symfony\Component\Validator\Attribute\HasNamedArguments; use Symfony\Component\Validator\Constraint; /** @@ -52,8 +53,9 @@ class Isbn extends Constraint * @param self::ISBN_*|array|null $type The type of ISBN to validate (i.e. {@see Isbn::ISBN_10}, {@see Isbn::ISBN_13} or null to accept both, defaults to null) * @param string|null $message If defined, this message has priority over the others * @param string[]|null $groups - * @param array $options + * @param array|null $options */ + #[HasNamedArguments] public function __construct( string|array|null $type = null, ?string $message = null, @@ -62,11 +64,19 @@ public function __construct( ?string $bothIsbnMessage = null, ?array $groups = null, mixed $payload = null, - array $options = [], + ?array $options = null, ) { if (\is_array($type)) { - $options = array_merge($type, $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($type, $options ?? []); } elseif (null !== $type) { + 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'] = $type; } diff --git a/Constraints/Isin.php b/Constraints/Isin.php index 3f722d21a..7bd9abe2d 100644 --- a/Constraints/Isin.php +++ b/Constraints/Isin.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Constraints; +use Symfony\Component\Validator\Attribute\HasNamedArguments; use Symfony\Component\Validator\Constraint; /** @@ -42,8 +43,13 @@ class Isin 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/Issn.php b/Constraints/Issn.php index 7d0e5b515..048c18f5e 100644 --- a/Constraints/Issn.php +++ b/Constraints/Issn.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Constraints; +use Symfony\Component\Validator\Attribute\HasNamedArguments; use Symfony\Component\Validator\Constraint; /** @@ -50,6 +51,7 @@ class Issn extends Constraint * @param bool|null $requireHyphen Whether to require a hyphenated ISSN value (defaults to false) * @param string[]|null $groups */ + #[HasNamedArguments] public function __construct( ?array $options = null, ?string $message = null, @@ -58,6 +60,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/Json.php b/Constraints/Json.php index 3b85a347c..18078a2fe 100644 --- a/Constraints/Json.php +++ b/Constraints/Json.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 Json 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/Language.php b/Constraints/Language.php index 67c228448..61ac4644b 100644 --- a/Constraints/Language.php +++ b/Constraints/Language.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\Intl\Languages; +use Symfony\Component\Validator\Attribute\HasNamedArguments; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Exception\LogicException; @@ -39,6 +40,7 @@ class Language extends Constraint * @param bool|null $alpha3 Pass true to validate the language with three-letter code (ISO 639-2 (2T)) or false with two-letter code (ISO 639-1) (defaults to false) * @param string[]|null $groups */ + #[HasNamedArguments] public function __construct( ?array $options = null, ?string $message = null, @@ -50,6 +52,10 @@ public function __construct( throw new LogicException('The Intl component is required to use the Language 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/Length.php b/Constraints/Length.php index d1bc7b9dc..ce1460c6e 100644 --- a/Constraints/Length.php +++ b/Constraints/Length.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; use Symfony\Component\Validator\Exception\MissingOptionsException; @@ -65,8 +66,9 @@ class Length extends Constraint * @param callable|null $normalizer A callable to normalize value before it is validated * @param self::COUNT_*|null $countUnit The character count unit for the length check (defaults to {@see Length::COUNT_CODEPOINTS}) * @param string[]|null $groups - * @param array $options + * @param array|null $options */ + #[HasNamedArguments] public function __construct( int|array|null $exactly = null, ?int $min = null, @@ -80,11 +82,17 @@ public function __construct( ?string $charsetMessage = 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/Locale.php b/Constraints/Locale.php index fa31fbac4..0ffe4b0e8 100644 --- a/Constraints/Locale.php +++ b/Constraints/Locale.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\Intl\Locales; +use Symfony\Component\Validator\Attribute\HasNamedArguments; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Exception\LogicException; @@ -39,6 +40,7 @@ class Locale extends Constraint * @param bool|null $canonicalize Whether to canonicalize the value before validation (defaults to true) (see {@see https://www.php.net/manual/en/locale.canonicalize.php}) * @param string[]|null $groups */ + #[HasNamedArguments] public function __construct( ?array $options = null, ?string $message = null, @@ -50,6 +52,10 @@ public function __construct( throw new LogicException('The Intl component is required to use the Locale 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/Luhn.php b/Constraints/Luhn.php index df26b283e..9421fc3c7 100644 --- a/Constraints/Luhn.php +++ b/Constraints/Luhn.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Constraints; +use Symfony\Component\Validator\Attribute\HasNamedArguments; use Symfony\Component\Validator\Constraint; /** @@ -39,12 +40,17 @@ class Luhn 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/NoSuspiciousCharacters.php b/Constraints/NoSuspiciousCharacters.php index 2dd6fb8f5..f0d28dba2 100644 --- a/Constraints/NoSuspiciousCharacters.php +++ b/Constraints/NoSuspiciousCharacters.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\LogicException; @@ -89,6 +90,7 @@ class NoSuspiciousCharacters extends Constraint * @param string[]|null $locales Restrict the string's characters to those normally used with these locales. Pass null to use the default locales configured for the NoSuspiciousCharactersValidator. (defaults to null) * @param string[]|null $groups */ + #[HasNamedArguments] public function __construct( ?array $options = null, ?string $restrictionLevelMessage = null, @@ -105,6 +107,10 @@ public function __construct( throw new LogicException('The intl extension is required to use the NoSuspiciousCharacters constraint.'); } + 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->restrictionLevelMessage = $restrictionLevelMessage ?? $this->restrictionLevelMessage; diff --git a/Constraints/NotBlank.php b/Constraints/NotBlank.php index db3602615..725e7eede 100644 --- a/Constraints/NotBlank.php +++ b/Constraints/NotBlank.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; @@ -39,8 +40,13 @@ class NotBlank extends Constraint * @param bool|null $allowNull Whether to allow null values (defaults to false) * @param string[]|null $groups */ + #[HasNamedArguments] public function __construct(?array $options = null, ?string $message = null, ?bool $allowNull = null, ?callable $normalizer = 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/NotCompromisedPassword.php b/Constraints/NotCompromisedPassword.php index d11df3ba6..ef1e03da9 100644 --- a/Constraints/NotCompromisedPassword.php +++ b/Constraints/NotCompromisedPassword.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Constraints; +use Symfony\Component\Validator\Attribute\HasNamedArguments; use Symfony\Component\Validator\Constraint; /** @@ -37,6 +38,7 @@ class NotCompromisedPassword extends Constraint * @param bool|null $skipOnError Whether to ignore HTTP errors while requesting the API and thus consider the password valid (defaults to false) * @param string[]|null $groups */ + #[HasNamedArguments] public function __construct( ?array $options = null, ?string $message = null, @@ -45,6 +47,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/NotNull.php b/Constraints/NotNull.php index 32a327a57..28596925e 100644 --- a/Constraints/NotNull.php +++ b/Constraints/NotNull.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 NotNull 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/PasswordStrength.php b/Constraints/PasswordStrength.php index 42a93c530..3867cfbda 100644 --- a/Constraints/PasswordStrength.php +++ b/Constraints/PasswordStrength.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; @@ -43,8 +44,13 @@ final class PasswordStrength extends Constraint * @param self::STRENGTH_*|null $minScore The minimum required strength of the password (defaults to {@see PasswordStrength::STRENGTH_MEDIUM}) * @param string[]|null $groups */ + #[HasNamedArguments] public function __construct(?array $options = null, ?int $minScore = null, ?array $groups = null, mixed $payload = null, ?string $message = 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); + } + $options['minScore'] ??= self::STRENGTH_MEDIUM; parent::__construct($options, $groups, $payload); diff --git a/Constraints/Range.php b/Constraints/Range.php index cf26d3573..aac582430 100644 --- a/Constraints/Range.php +++ b/Constraints/Range.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; @@ -41,7 +42,7 @@ class Range extends Constraint public string $minMessage = 'This value should be {{ limit }} or more.'; public string $maxMessage = 'This value should be {{ limit }} or less.'; public string $invalidMessage = 'This value should be a valid number.'; - public string $invalidDateTimeMessage = 'This value should be a valid datetime.'; + public string $invalidDateTimeMessage = 'This value is not a valid datetime.'; public mixed $min = null; public ?string $minPropertyPath = null; public mixed $max = null; @@ -57,6 +58,7 @@ class Range extends Constraint * @param non-empty-string|null $maxPropertyPath Property path to the max value * @param string[]|null $groups */ + #[HasNamedArguments] public function __construct( ?array $options = null, ?string $notInRangeMessage = null, @@ -71,6 +73,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->notInRangeMessage = $notInRangeMessage ?? $this->notInRangeMessage; diff --git a/Constraints/Regex.php b/Constraints/Regex.php index d10cb5fa8..5c8501fa0 100644 --- a/Constraints/Regex.php +++ b/Constraints/Regex.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; @@ -40,8 +41,9 @@ class Regex extends Constraint * @param string|null $htmlPattern The pattern to use in the HTML5 pattern attribute * @param bool|null $match Whether to validate the value matches the configured pattern or not (defaults to true) * @param string[]|null $groups - * @param array $options + * @param array|null $options */ + #[HasNamedArguments] public function __construct( string|array|null $pattern, ?string $message = null, @@ -50,11 +52,19 @@ public function __construct( ?callable $normalizer = null, ?array $groups = null, mixed $payload = null, - array $options = [], + ?array $options = null, ) { if (\is_array($pattern)) { - $options = array_merge($pattern, $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($pattern, $options ?? []); } elseif (null !== $pattern) { + 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'] = $pattern; } diff --git a/Constraints/Sequentially.php b/Constraints/Sequentially.php index d2b45e4bb..6389ebb89 100644 --- a/Constraints/Sequentially.php +++ b/Constraints/Sequentially.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 Sequentially extends Composite * @param Constraint[]|array|null $constraints An array of validation 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/Time.php b/Constraints/Time.php index dca9537cf..a99702cb2 100644 --- a/Constraints/Time.php +++ b/Constraints/Time.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Constraints; +use Symfony\Component\Validator\Attribute\HasNamedArguments; use Symfony\Component\Validator\Constraint; /** @@ -37,6 +38,7 @@ class Time extends Constraint * @param string[]|null $groups * @param bool|null $withSeconds Whether to allow seconds in the given value (defaults to true) */ + #[HasNamedArguments] public function __construct( ?array $options = null, ?string $message = null, @@ -44,6 +46,10 @@ public function __construct( mixed $payload = null, ?bool $withSeconds = 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->withSeconds = $withSeconds ?? $this->withSeconds; diff --git a/Constraints/Timezone.php b/Constraints/Timezone.php index de10e2803..93b0692ef 100644 --- a/Constraints/Timezone.php +++ b/Constraints/Timezone.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; @@ -45,10 +46,11 @@ class Timezone extends Constraint * @param string|null $countryCode Restrict the valid timezones to this country if the zone option is {@see \DateTimeZone::PER_COUNTRY} * @param bool|null $intlCompatible Whether to restrict valid timezones to ones available in PHP's intl (defaults to false) * @param string[]|null $groups - * @param array $options + * @param array|null $options * * @see \DateTimeZone */ + #[HasNamedArguments] public function __construct( int|array|null $zone = null, ?string $message = null, @@ -56,11 +58,19 @@ public function __construct( ?bool $intlCompatible = null, ?array $groups = null, mixed $payload = null, - array $options = [], + ?array $options = null, ) { if (\is_array($zone)) { - $options = array_merge($zone, $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($zone, $options ?? []); } elseif (null !== $zone) { + 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'] = $zone; } diff --git a/Constraints/Traverse.php b/Constraints/Traverse.php index 80c7b2d31..d8546e323 100644 --- a/Constraints/Traverse.php +++ b/Constraints/Traverse.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; @@ -27,13 +28,18 @@ class Traverse extends Constraint /** * @param bool|array|null $traverse Whether to traverse the given object or not (defaults to true). Pass an associative array to configure the constraint's options (e.g. payload). */ - public function __construct(bool|array|null $traverse = null) + #[HasNamedArguments] + public function __construct(bool|array|null $traverse = null, mixed $payload = null) { if (\is_array($traverse) && \array_key_exists('groups', $traverse)) { throw new ConstraintDefinitionException(\sprintf('The option "groups" is not supported by the constraint "%s".', __CLASS__)); } - parent::__construct($traverse); + if (\is_array($traverse)) { + 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($traverse, null, $payload); } public function getDefaultOption(): ?string diff --git a/Constraints/Type.php b/Constraints/Type.php index eb410bb8a..f3fe56dbb 100644 --- a/Constraints/Type.php +++ b/Constraints/Type.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Constraints; +use Symfony\Component\Validator\Attribute\HasNamedArguments; use Symfony\Component\Validator\Constraint; /** @@ -33,14 +34,25 @@ class Type extends Constraint /** * @param string|list|array|null $type The type(s) to enforce on the value * @param string[]|null $groups - * @param array $options + * @param array|null $options */ - public function __construct(string|array|null $type, ?string $message = null, ?array $groups = null, mixed $payload = null, array $options = []) + #[HasNamedArguments] + public function __construct(string|array|null $type, ?string $message = null, ?array $groups = null, mixed $payload = null, ?array $options = null) { if (\is_array($type) && \is_string(key($type))) { - $options = array_merge($type, $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($type, $options ?? []); } elseif (null !== $type) { + 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'] = $type; + } 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); } parent::__construct($options, $groups, $payload); diff --git a/Constraints/Ulid.php b/Constraints/Ulid.php index b73757c13..91d395fd2 100644 --- a/Constraints/Ulid.php +++ b/Constraints/Ulid.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; @@ -50,6 +51,7 @@ class Ulid extends Constraint * @param string[]|null $groups * @param self::FORMAT_*|null $format */ + #[HasNamedArguments] public function __construct( ?array $options = null, ?string $message = null, @@ -57,6 +59,10 @@ public function __construct( mixed $payload = null, ?string $format = 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/Unique.php b/Constraints/Unique.php index 6e68e2c3a..1e6503785 100644 --- a/Constraints/Unique.php +++ b/Constraints/Unique.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; @@ -26,6 +27,7 @@ class Unique extends Constraint public array|string $fields = []; public ?string $errorPath = null; + public bool $stopOnFirstError = true; protected const ERROR_NAMES = [ self::IS_NOT_UNIQUE => 'IS_NOT_UNIQUE', @@ -40,6 +42,7 @@ class Unique extends Constraint * @param string[]|null $groups * @param string[]|string|null $fields Defines the key or keys in the collection that should be checked for uniqueness (defaults to null, which ensure uniqueness for all keys) */ + #[HasNamedArguments] public function __construct( ?array $options = null, ?string $message = null, @@ -48,13 +51,19 @@ public function __construct( mixed $payload = null, array|string|null $fields = null, ?string $errorPath = null, + ?bool $stopOnFirstError = 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; $this->normalizer = $normalizer ?? $this->normalizer; $this->fields = $fields ?? $this->fields; $this->errorPath = $errorPath ?? $this->errorPath; + $this->stopOnFirstError = $stopOnFirstError ?? $this->stopOnFirstError; if (null !== $this->normalizer && !\is_callable($this->normalizer)) { throw new InvalidArgumentException(\sprintf('The "normalizer" option must be a valid callable ("%s" given).', get_debug_type($this->normalizer))); diff --git a/Constraints/UniqueValidator.php b/Constraints/UniqueValidator.php index 8977fd221..bd78cac72 100644 --- a/Constraints/UniqueValidator.php +++ b/Constraints/UniqueValidator.php @@ -46,20 +46,24 @@ public function validate(mixed $value, Constraint $constraint): void continue; } - if (\in_array($element, $collectionElements, true)) { - $violationBuilder = $this->context->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($element)) - ->setCode(Unique::IS_NOT_UNIQUE); + if (!\in_array($element, $collectionElements, true)) { + $collectionElements[] = $element; + continue; + } - if (null !== $constraint->errorPath) { - $violationBuilder->atPath("[$index].{$constraint->errorPath}"); - } + $violationBuilder = $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($element)) + ->setCode(Unique::IS_NOT_UNIQUE); + + if (!$constraint->stopOnFirstError || null !== $constraint->errorPath) { + $violationBuilder->atPath("[$index]".(null !== $constraint->errorPath ? ".{$constraint->errorPath}" : '')); + } - $violationBuilder->addViolation(); + $violationBuilder->addViolation(); + if ($constraint->stopOnFirstError) { return; } - $collectionElements[] = $element; } } diff --git a/Constraints/Url.php b/Constraints/Url.php index 7225a8be0..b3e7256a0 100644 --- a/Constraints/Url.php +++ b/Constraints/Url.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; @@ -45,6 +46,7 @@ class Url extends Constraint * @param string[]|null $groups * @param bool|null $requireTld Whether to require the URL to include a top-level domain (defaults to false) */ + #[HasNamedArguments] public function __construct( ?array $options = null, ?string $message = null, @@ -56,6 +58,10 @@ public function __construct( ?bool $requireTld = null, ?string $tldMessage = 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); if (null === ($options['requireTld'] ?? $requireTld)) { diff --git a/Constraints/UrlValidator.php b/Constraints/UrlValidator.php index 0716b1173..dc4c2486a 100644 --- a/Constraints/UrlValidator.php +++ b/Constraints/UrlValidator.php @@ -21,34 +21,36 @@ */ class UrlValidator extends ConstraintValidator { - public const PATTERN = '~^ + public const PATTERN = <<<'REGEX' + {^ (%s):// # protocol - (((?:[\_\.\pL\pN-]|%%[0-9A-Fa-f]{2})+:)?((?:[\_\.\pL\pN-]|%%[0-9A-Fa-f]{2})+)@)? # basic auth + ((?:[\pL\pN\-._~!$&'()*+,;=]|%%[0-9A-Fa-f]{2})++(?::(?:[:\pL\pN\-._~!$&'()*+,;=]|%%[0-9A-Fa-f]{2})*+)?@)? # basic auth ( (?: (?: (?:[\pL\pN\pS\pM\-\_]++\.)+ (?: - (?:xn--[a-z0-9-]++) # punycode in tld + (?:xn--[a-z0-9-]++) # punycode in tld | - (?:[\pL\pN\pM]++) # no punycode in tld + (?:[\pL\pN\pM]++) # no punycode in tld ) - ) # a multi-level domain name + ) # a multi-level domain name | - [a-z0-9\-\_]++ # a single-level domain name + [a-z0-9\-\_]++ # a single-level domain name )\.? - | # or - \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address - | # or + | # or + \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address + | # or \[ (?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::)))) \] # an IPv6 address ) (:[0-9]+)? # a port (optional) - (?:/ (?:[\pL\pN\pS\pM\-._\~!$&\'()*+,;=:@]|%%[0-9A-Fa-f]{2})* )* # a path - (?:\? (?:[\pL\pN\-._\~!$&\'\[\]()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a query (optional) - (?:\# (?:[\pL\pN\-._\~!$&\'()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a fragment (optional) - $~ixuD'; + (?:/ (?:[\pL\pN\pS\pM\-._~!$&'()*+,;=:@]|%%[0-9A-Fa-f]{2})* )* # a path + (?:\? (?:[\pL\pN\-._~!$&'()*+,;=:@/?[\]]|%%[0-9A-Fa-f]{2})* )? # a query (optional) + (?:\# (?:[\pL\pN\-._~!$&'()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a fragment (optional) + $}ixuD + REGEX; public function validate(mixed $value, Constraint $constraint): void { diff --git a/Constraints/Uuid.php b/Constraints/Uuid.php index 2e65d1a00..9c6526457 100644 --- a/Constraints/Uuid.php +++ b/Constraints/Uuid.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; @@ -100,6 +101,7 @@ class Uuid extends Constraint * @param bool|null $strict Whether to force the value to follow the RFC's input format rules; pass false to allow alternate formats (defaults to true) * @param string[]|null $groups */ + #[HasNamedArguments] public function __construct( ?array $options = null, ?string $message = null, @@ -109,6 +111,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/Valid.php b/Constraints/Valid.php index f94d959a3..48deae8ac 100644 --- a/Constraints/Valid.php +++ b/Constraints/Valid.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 Valid extends Constraint * @param string[]|null $groups * @param bool|null $traverse Whether to validate {@see \Traversable} objects (defaults to true) */ + #[HasNamedArguments] public function __construct(?array $options = null, ?array $groups = null, $payload = null, ?bool $traverse = 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->traverse = $traverse ?? $this->traverse; diff --git a/Constraints/When.php b/Constraints/When.php index fde81af72..74601c1d1 100644 --- a/Constraints/When.php +++ b/Constraints/When.php @@ -13,6 +13,7 @@ use Symfony\Component\ExpressionLanguage\Expression; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; +use Symfony\Component\Validator\Attribute\HasNamedArguments; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Exception\LogicException; @@ -24,37 +25,52 @@ #[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] class When extends Composite { - public string|Expression $expression; + public string|Expression|\Closure $expression; public array|Constraint $constraints = []; public array $values = []; + public array|Constraint $otherwise = []; /** - * @param string|Expression|array $expression The condition to evaluate, written with the ExpressionLanguage syntax + * @param string|Expression|array|\Closure(object): bool $expression The condition to evaluate, either as a closure or using the ExpressionLanguage syntax * @param Constraint[]|Constraint|null $constraints One or multiple constraints that are applied if the expression returns true * @param array|null $values The values of the custom variables used in the expression (defaults to []) * @param string[]|null $groups - * @param array $options + * @param array|null $options + * @param Constraint[]|Constraint $otherwise One or multiple constraints that are applied if the expression returns false */ - public function __construct(string|Expression|array $expression, array|Constraint|null $constraints = null, ?array $values = null, ?array $groups = null, $payload = null, array $options = []) + #[HasNamedArguments] + public function __construct(string|Expression|array|\Closure $expression, array|Constraint|null $constraints = null, ?array $values = null, ?array $groups = null, $payload = null, ?array $options = null, array|Constraint $otherwise = []) { if (!class_exists(ExpressionLanguage::class)) { throw new LogicException(\sprintf('The "symfony/expression-language" component is required to use the "%s" constraint. Try running "composer require symfony/expression-language".', __CLASS__)); } if (\is_array($expression)) { - $options = array_merge($expression, $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($expression, $options ?? []); } else { - $options['expression'] = $expression; + 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['expression'] = $expression; if (null !== $constraints) { $options['constraints'] = $constraints; } + $options['otherwise'] = $otherwise; } - if (isset($options['constraints']) && !\is_array($options['constraints'])) { + if (!\is_array($options['constraints'] ?? [])) { $options['constraints'] = [$options['constraints']]; } + if (!\is_array($options['otherwise'] ?? [])) { + $options['otherwise'] = [$options['otherwise']]; + } + if (null !== $groups) { $options['groups'] = $groups; } @@ -78,8 +94,8 @@ public function getTargets(): string|array return [self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT]; } - protected function getCompositeOption(): string + protected function getCompositeOption(): array|string { - return 'constraints'; + return ['constraints', 'otherwise']; } } diff --git a/Constraints/WhenValidator.php b/Constraints/WhenValidator.php index b41ba83ff..1ef14469f 100644 --- a/Constraints/WhenValidator.php +++ b/Constraints/WhenValidator.php @@ -35,9 +35,18 @@ public function validate(mixed $value, Constraint $constraint): void $variables['this'] = $context->getObject(); $variables['context'] = $context; - if ($this->getExpressionLanguage()->evaluate($constraint->expression, $variables)) { + if ($constraint->expression instanceof \Closure) { + $result = ($constraint->expression)($context->getObject()); + } else { + $result = $this->getExpressionLanguage()->evaluate($constraint->expression, $variables); + } + + if ($result) { $context->getValidator()->inContext($context) ->validate($value, $constraint->constraints); + } elseif ($constraint->otherwise) { + $context->getValidator()->inContext($context) + ->validate($value, $constraint->otherwise); } } diff --git a/Constraints/YamlValidator.php b/Constraints/YamlValidator.php index 2675ed9aa..165e3fad8 100644 --- a/Constraints/YamlValidator.php +++ b/Constraints/YamlValidator.php @@ -39,17 +39,19 @@ public function validate(mixed $value, Constraint $constraint): void $value = (string) $value; + $parser = new Parser(); + /** @see \Symfony\Component\Yaml\Command\LintCommand::validate() */ - $prevErrorHandler = set_error_handler(function ($level, $message, $file, $line) use (&$prevErrorHandler) { + $prevErrorHandler = set_error_handler(static function ($level, $message, $file, $line) use (&$prevErrorHandler, $parser) { if (\E_USER_DEPRECATED === $level) { - throw new ParseException($message, $this->getParser()->getRealCurrentLineNb() + 1); + throw new ParseException($message, $parser->getRealCurrentLineNb() + 1); } return $prevErrorHandler ? $prevErrorHandler($level, $message, $file, $line) : false; }); try { - (new Parser())->parse($value, $constraint->flags); + $parser->parse($value, $constraint->flags); } catch (ParseException $e) { $this->context->buildViolation($constraint->message) ->setParameter('{{ error }}', $e->getMessage()) diff --git a/Constraints/ZeroComparisonConstraintTrait.php b/Constraints/ZeroComparisonConstraintTrait.php index 78fab1f54..d0841adea 100644 --- a/Constraints/ZeroComparisonConstraintTrait.php +++ b/Constraints/ZeroComparisonConstraintTrait.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Constraints; +use Symfony\Component\Validator\Attribute\HasNamedArguments; use Symfony\Component\Validator\Exception\ConstraintDefinitionException; /** @@ -21,15 +22,18 @@ */ trait ZeroComparisonConstraintTrait { + #[HasNamedArguments] public function __construct(?array $options = null, ?string $message = null, ?array $groups = null, mixed $payload = null) { - $options ??= []; + if (null !== $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 (isset($options['propertyPath'])) { + if (\is_array($options) && isset($options['propertyPath'])) { throw new ConstraintDefinitionException(\sprintf('The "propertyPath" option of the "%s" constraint cannot be set.', static::class)); } - if (isset($options['value'])) { + if (\is_array($options) && isset($options['value'])) { throw new ConstraintDefinitionException(\sprintf('The "value" option of the "%s" constraint cannot be set.', static::class)); } diff --git a/Context/ExecutionContext.php b/Context/ExecutionContext.php index 0378c3e6f..1fd373309 100644 --- a/Context/ExecutionContext.php +++ b/Context/ExecutionContext.php @@ -107,7 +107,7 @@ public function __construct( private ValidatorInterface $validator, private mixed $root, private TranslatorInterface $translator, - private ?string $translationDomain = null, + private string|false|null $translationDomain = null, ) { $this->violations = new ConstraintViolationList(); $this->cachedObjectsRefs = new \SplObjectStorage(); @@ -134,7 +134,9 @@ public function setConstraint(Constraint $constraint): void public function addViolation(string|\Stringable $message, array $parameters = []): void { $this->violations->add(new ConstraintViolation( - $this->translator->trans($message, $parameters, $this->translationDomain), + false === $this->translationDomain ? + strtr($message, $parameters) : + $this->translator->trans($message, $parameters, $this->translationDomain), $message, $parameters, $this->root, diff --git a/Context/ExecutionContextFactory.php b/Context/ExecutionContextFactory.php index a6a2844ad..39c2add35 100644 --- a/Context/ExecutionContextFactory.php +++ b/Context/ExecutionContextFactory.php @@ -25,7 +25,7 @@ class ExecutionContextFactory implements ExecutionContextFactoryInterface { public function __construct( private TranslatorInterface $translator, - private ?string $translationDomain = null, + private string|false|null $translationDomain = null, ) { } diff --git a/Context/ExecutionContextInterface.php b/Context/ExecutionContextInterface.php index bd7ec5f96..56e39bd6a 100644 --- a/Context/ExecutionContextInterface.php +++ b/Context/ExecutionContextInterface.php @@ -95,7 +95,7 @@ public function buildViolation(string $message, array $parameters = []): Constra * { * $validator = $this->context->getValidator(); * - * $violations = $validator->validate($value, new Length(['min' => 3])); + * $violations = $validator->validate($value, new Length(min: 3)); * * if (count($violations) > 0) { * // ... diff --git a/Mapping/Loader/AbstractLoader.php b/Mapping/Loader/AbstractLoader.php index a74b53348..ebff64fd5 100644 --- a/Mapping/Loader/AbstractLoader.php +++ b/Mapping/Loader/AbstractLoader.php @@ -97,9 +97,27 @@ protected function newConstraint(string $name, mixed $options = null): Constrain return new $className($options['value']); } - return new $className(...$options); + if (array_is_list($options)) { + return new $className($options); + } + + try { + return new $className(...$options); + } catch (\Error $e) { + if (str_starts_with($e->getMessage(), 'Unknown named parameter ')) { + return new $className($options); + } + + throw $e; + } + } + + if ($options) { + trigger_deprecation('symfony/validator', '7.3', 'Using constraints not supporting named arguments is deprecated. Try adding the HasNamedArguments attribute to %s.', $className); + + return new $className($options); } - return new $className($options); + return new $className(); } } diff --git a/Mapping/Loader/PropertyInfoLoader.php b/Mapping/Loader/PropertyInfoLoader.php index 444e864f2..57d65696e 100644 --- a/Mapping/Loader/PropertyInfoLoader.php +++ b/Mapping/Loader/PropertyInfoLoader.php @@ -134,7 +134,7 @@ public function loadClassMetadata(ClassMetadata $metadata): bool $metadata->addPropertyConstraint($property, $this->getTypeConstraintLegacy($builtinTypes[0], $types[0])); } elseif ($scalar) { - $metadata->addPropertyConstraint($property, new Type(['type' => 'scalar'])); + $metadata->addPropertyConstraint($property, new Type(type: 'scalar')); } } } else { @@ -203,10 +203,10 @@ private function getPropertyTypes(string $className, string $property): TypeInfo private function getTypeConstraintLegacy(string $builtinType, PropertyInfoType $type): Type { if (PropertyInfoType::BUILTIN_TYPE_OBJECT === $builtinType && null !== $className = $type->getClassName()) { - return new Type(['type' => $className]); + return new Type(type: $className); } - return new Type(['type' => $builtinType]); + return new Type(type: $builtinType); } private function getTypeConstraint(TypeInfoType $type): ?Type @@ -220,11 +220,11 @@ private function getTypeConstraint(TypeInfoType $type): ?Type $baseType = $type->getBaseType(); if ($baseType instanceof ObjectType) { - return new Type(['type' => $baseType->getClassName()]); + return new Type(type: $baseType->getClassName()); } if (TypeIdentifier::MIXED !== $baseType->getTypeIdentifier()) { - return new Type(['type' => $baseType->getTypeIdentifier()->value]); + return new Type(type: $baseType->getTypeIdentifier()->value); } return null; @@ -238,7 +238,7 @@ private function getTypeConstraint(TypeInfoType $type): ?Type TypeIdentifier::BOOL, TypeIdentifier::TRUE, TypeIdentifier::FALSE, - ) ? new Type(['type' => 'scalar']) : null; + ) ? new Type(type: 'scalar') : null; } while ($type instanceof WrappingTypeInterface) { @@ -246,11 +246,11 @@ private function getTypeConstraint(TypeInfoType $type): ?Type } if ($type instanceof ObjectType) { - return new Type(['type' => $type->getClassName()]); + return new Type(type: $type->getClassName()); } if ($type instanceof BuiltinType && TypeIdentifier::MIXED !== $type->getTypeIdentifier()) { - return new Type(['type' => $type->getTypeIdentifier()->value]); + return new Type(type: $type->getTypeIdentifier()->value); } return null; @@ -284,7 +284,7 @@ private function handleAllConstraint(string $property, ?All $allConstraint, Type } if (null === $allConstraint) { - $metadata->addPropertyConstraint($property, new All(['constraints' => $constraints])); + $metadata->addPropertyConstraint($property, new All(constraints: $constraints)); } else { $allConstraint->constraints = array_merge($allConstraint->constraints, $constraints); } @@ -318,7 +318,7 @@ private function handleAllConstraintLegacy(string $property, ?All $allConstraint } if (null === $allConstraint) { - $metadata->addPropertyConstraint($property, new All(['constraints' => $constraints])); + $metadata->addPropertyConstraint($property, new All(constraints: $constraints)); } else { $allConstraint->constraints = array_merge($allConstraint->constraints, $constraints); } diff --git a/Resources/translations/validators.af.xlf b/Resources/translations/validators.af.xlf index 9f53b1afe..61a8b3724 100644 --- a/Resources/translations/validators.af.xlf +++ b/Resources/translations/validators.af.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Hierdie waarde is nie 'n geldige Twig-sjabloon nie. + + This file is not a valid video. + Hierdie lêer is nie 'n geldige video nie. + + + The size of the video could not be detected. + Die grootte van die video kon nie bepaal word nie. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Die videowydte is te groot ({{ width }}px). Toegelate maksimum wydte is {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Die videobreedte is te klein ({{ width }}px). Minimum verwagte breedte is {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Die videohoogte is te groot ({{ height }}px). Toegelate maksimum hoogte is {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Die videohoogte is te klein ({{ height }}px). Minimum hoogte verwag is {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Die video het te min pixels ({{ pixels }}). Minimum hoeveelheid verwag is {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Die video het te veel pixels ({{ pixels }}). Maksimum verwagte hoeveelheid is {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Die videoratio is te groot ({{ ratio }}). Toegelate maksimum ratio is {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Die videoratio is te klein ({{ ratio }}). Minimum verwagte ratio is {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Die video is vierkantig ({{ width }}x{{ height }}px). Vierkantige video's word nie toegelaat nie. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Die video is landskap georiënteer ({{ width }}x{{ height }} px). Landskapvideo's word nie toegelaat nie. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Die video is portretgeoriënteerd ({{ width }}x{{ height }}px). Portretgeoriënteerde video's word nie toegelaat nie. + + + The video file is corrupted. + Die videolêer is korrup. + + + The video contains multiple streams. Only one stream is allowed. + Die video bevat veelvuldige strome. Slegs een stroom word toegelaat. + + + Unsupported video codec "{{ codec }}". + Nie-ondersteunde videokodek "{{ codec }}". + + + Unsupported video container "{{ container }}". + Nie-ondersteunde videohouer "{{ container }}". + + + The image file is corrupted. + Die beeldlêer is beskadig. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Die beeld het te min pixels ({{ pixels }}). Minimum hoeveelheid verwag is {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Die beeld het te veel pixels ({{ pixels }}). Maksimum verwagte aantal is {{ max_pixels }}. + + + This filename does not match the expected charset. + Hierdie lêernaam stem nie ooreen met die verwagte karakterstel nie. + diff --git a/Resources/translations/validators.ar.xlf b/Resources/translations/validators.ar.xlf index 827eed1bc..783f63dd7 100644 --- a/Resources/translations/validators.ar.xlf +++ b/Resources/translations/validators.ar.xlf @@ -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 }} بكسل). الارتفاع الأدنى المتوقع هو {{ min_height }} بكسل. + + + 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 }} بكسل). مقاطع الفيديو ذات الاتجاه العمودي غير مسموح بها. + + + 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. + اسم الملف يحتوي على أحرف غير مسموح بها. diff --git a/Resources/translations/validators.az.xlf b/Resources/translations/validators.az.xlf index 9332c9ec2..a9d281384 100644 --- a/Resources/translations/validators.az.xlf +++ b/Resources/translations/validators.az.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Bu dəyər etibarlı Twig şablonu deyil. + + This file is not a valid video. + Bu fayl etibarlı video deyil. + + + The size of the video could not be detected. + Videonun ölçüsünü təyin etmək mümkün olmadı. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Video enliyi çox böyükdür ({{ width }}px). İcazə verilən maksimal enlik {{ max_width }}px-dir. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Video eni çox kiçikdir ({{ width }}px). Gözlənilən minimum en {{ min_width }}px-dir. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Video hündürlüyü çox böyükdür ({{ height }}px). İcazə verilən maksimum hündürlük {{ max_height }}px-dir. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Videonun hündürlüyü çox kiçikdir ({{ height }}px). Gözlənilən minimum hündürlük {{ min_height }}px-dir. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Videoda piksellərin sayı çox azdır ({{ pixels }}). Gözlənilən minimum miqdar {{ min_pixels }}-dir. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Videoda həddindən artıq piksel var ({{ pixels }}). Gözlənilən maksimum miqdar {{ max_pixels }}-dir. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Video nisbəti çox böyükdür ({{ ratio }}). İcazə verilən maksimal nisbət {{ max_ratio }}‑dir. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Video nisbəti çox kiçikdir ({{ ratio }}). Gözlənilən minimal nisbət {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Video kvadratdır ({{ width }}x{{ height }}px). Kvadrat videolara icazə verilmir. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Video üfiqi istiqamətdədir ({{ width }}x{{ height }} piksel). Üfiqi videolara icazə verilmir. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Video portret istiqamətindədir ({{ width }}x{{ height }} piksel). Portret istiqamətli videolara icazə verilmir. + + + The video file is corrupted. + Video faylı zədələnib. + + + The video contains multiple streams. Only one stream is allowed. + Video bir neçə axın ehtiva edir. Yalnız bir axına icazə verilir. + + + Unsupported video codec "{{ codec }}". + Dəstəklənməyən video kodeki "{{ codec }}". + + + Unsupported video container "{{ container }}". + Dəstəklənməyən video konteyneri "{{ container }}". + + + The image file is corrupted. + Şəkil faylı korlanıb. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Şəkildə piksel sayı çox azdır ({{ pixels }}). Gözlənilən minimum miqdar {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Şəkildə çox piksel var ({{ pixels }}). Gözlənilən maksimum say {{ max_pixels }}. + + + This filename does not match the expected charset. + Bu fayl adı gözlənilən simvol dəstinə uyğun gəlmir. + diff --git a/Resources/translations/validators.be.xlf b/Resources/translations/validators.be.xlf index 7b24df5e5..448a2e9e4 100644 --- a/Resources/translations/validators.be.xlf +++ b/Resources/translations/validators.be.xlf @@ -20,7 +20,7 @@ The value you selected is not a valid choice. - Абранае вамі значэнне не сапраўднае. + Выбранае вамі значэнне не з’яўляецца сапраўдным. You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. @@ -32,7 +32,7 @@ One or more of the given values is invalid. - Адзін або некалькі пазначаных значэнняў з'яўляецца несапраўдным. + Адно або некалькі з зададзеных значэнняў не з’яўляюцца сапраўднымі. This field was not expected. @@ -76,15 +76,15 @@ 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 }} сімвалаў або менш. + Значэнне занадта доўгае. Яно павінна мець не больш за {{ 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 }} сімвалаў. + Значэнне занадта кароткае. Яно павінна мець не менш за {{ limit }} сімвал.|Значэнне занадта кароткае. Яно павінна мець не менш за {{ limit }} сімвалаў. This value should not be blank. @@ -100,7 +100,7 @@ This value is not valid. - Значэнне з'яўляецца не сапраўдным. + Значэнне не з'яўляецца сапраўдным. This value is not a valid time. @@ -112,7 +112,7 @@ The two values should be equal. - Абодва значэнні павінны быць аднолькавымі. + Абодва значэнні павінны супадаць. The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. @@ -140,7 +140,7 @@ This value is not a valid language. - Значэнне не з'яўляецца сапраўдным мовай. + Значэнне не з'яўляецца сапраўднай мовай. This value is not a valid locale. @@ -168,11 +168,11 @@ The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. - Гэты выява занадта вялікая ({{ width }}px). Дазваляецца максімальная вышыня {{ max_width }}px. + Гэтая выява занадта высокая ({{ height }}px). Дазваляецца максімальная вышыня — {{ max_height }}px. The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. - Гэта выява занадта маленькая ({{ width }}px). Дазваляецца мінімальная вышыня {{ min_width }}px. + Гэтая выява занадта нізкая ({{ height }}px). Дазваляецца мінімальная вышыня — {{ min_height }}px. This value should be the user's current password. @@ -204,11 +204,11 @@ This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. - Калекцыя павінна змяшчаць прынамсі {{ limit }} элемент.|Калекцыя павінна змяшчаць прынамсі {{ limit }} элементаў. + Калекцыя павінна змяшчаць не менш за {{ limit }} элемент.|Калекцыя павінна змяшчаць не менш за {{ limit }} элементаў. This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. - Калекцыя павінна змяшчаць {{ limit }} або менш элемент.|Калекцыя павінна змяшчаць {{ limit }} або менш элементаў. + Калекцыя павінна змяшчаць не больш за {{ limit }} элемент.|Калекцыя павінна змяшчаць не больш за {{ limit }} элементаў. This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. @@ -236,7 +236,7 @@ This value is neither a valid ISBN-10 nor a valid ISBN-13. - Гэта значэнне не з'яўляецца сапраўдным ISBN-10 або ISBN-13. + Гэта значэнне не з'яўляецца ні сапраўдным ISBN-10, ні сапраўдным ISBN-13. This value is not a valid ISSN. @@ -252,11 +252,11 @@ 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 }}. @@ -264,11 +264,11 @@ 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 }}. @@ -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. @@ -304,7 +304,7 @@ The host could not be resolved. - Не магчыма знайсці імя хоста. + Не магчыма вызначыць імя хоста. This value does not match the expected {{ charset }} charset. @@ -344,7 +344,7 @@ This value should be either positive or zero. - Значэнне павінна быць дадатным ці нуль. + Значэнне павінна быць або дадатным, або роўным нулю. This value should be negative. @@ -352,7 +352,7 @@ This value should be either negative or zero. - Значэнне павінна быць адмоўным ці нуль. + Значэнне павінна быць або адмоўным, або роўным нулю. This value is not a valid timezone. @@ -368,11 +368,11 @@ This value is not a valid hostname. - Значэнне не з'яўляецца карэктным імем хаста. + Значэнне не з'яўляецца сапраўднай/карэктнай назвай хоста. 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: @@ -388,7 +388,7 @@ This value should be a valid expression. - Значэнне не з'яўляецца сапраўдным выразам. + Значэнне павінна быць сапраўдным выразам. This value is not a valid CSS color. @@ -404,7 +404,7 @@ 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 }} сімвалы або менш.|Назва файла занадта доўгая. Ён павінен мець {{ filename_max_length }} сімвалаў або менш. + Назва файла занадта доўгая. Яна павинна мець {{ filename_max_length }} сімвал або менш.|Назва файла занадта доўгая. Яна павінна мець {{ filename_max_length }} сімвалы або менш.|Назва файла занадта доўгая. Яна павінна мець {{ filename_max_length }} сімвалаў або менш. The password strength is too low. Please use a stronger password. @@ -420,7 +420,7 @@ Mixing numbers from different scripts is not allowed. - Змешванне лікаў з розных алфавітаў не дапускаецца. + Змешванне лічбаў з розных алфавітаў не дапускаецца. Using hidden overlay characters is not allowed. @@ -440,7 +440,7 @@ 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. @@ -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. + Відэа змяшчае некалькі патокаў. Дазволены толькі адзін паток. + + + 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. + Гэта назва файла не адпавядае чаканаму набору знакаў. + diff --git a/Resources/translations/validators.bg.xlf b/Resources/translations/validators.bg.xlf index afd7590f5..79c06e5bc 100644 --- a/Resources/translations/validators.bg.xlf +++ b/Resources/translations/validators.bg.xlf @@ -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. + Видеото съдържа множество потоци. Разрешен е само един поток. + + + 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. + Името на файла не съответства на очаквания набор от знаци. + diff --git a/Resources/translations/validators.bs.xlf b/Resources/translations/validators.bs.xlf index d6b7de576..43a118e08 100644 --- a/Resources/translations/validators.bs.xlf +++ b/Resources/translations/validators.bs.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Ova vrijednost nije važeći Twig šablon. + + This file is not a valid video. + Ova datoteka nije važeći video. + + + The size of the video could not be detected. + Veličina videa nije mogla biti utvrđena. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Širina videa je prevelika ({{ width }}px). Dozvoljena maksimalna širina je {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Širina videa je premala ({{ width }}px). Minimalna očekivana širina je {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Visina videa je prevelika ({{ height }}px). Dozvoljena maksimalna visina je {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Visina videa je premala ({{ height }}px). Očekivana minimalna visina je {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Video ima premalo piksela ({{ pixels }}). Očekivana minimalna količina je {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Video ima previše piksela ({{ pixels }}). Očekivana maksimalna količina je {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Omjer videa je prevelik ({{ ratio }}). Dozvoljeni maksimalni omjer je {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Omjer videa je premali ({{ ratio }}). Minimalni očekivani omjer je {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Video je kvadratan ({{ width }}x{{ height }}px). Kvadratni video zapisi nisu dozvoljeni. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Video je vodoravne orijentacije ({{ width }}x{{ height }} px). Vodoravni video zapisi nisu dozvoljeni. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Video je uspravno orijentisan ({{ width }}x{{ height }}px). Video zapisi uspravne orijentacije nisu dozvoljeni. + + + The video file is corrupted. + Video datoteka je oštećena. + + + The video contains multiple streams. Only one stream is allowed. + Video sadrži više tokova. Dozvoljen je samo jedan tok. + + + Unsupported video codec "{{ codec }}". + Nepodržani video kodek "{{ codec }}". + + + Unsupported video container "{{ container }}". + Nepodržani video kontejner "{{ container }}". + + + The image file is corrupted. + Datoteka slike je oštećena. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Slika ima premalo piksela ({{ pixels }}). Očekivani minimalni broj je {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Slika ima previše piksela ({{ pixels }}). Očekivani maksimalni broj je {{ max_pixels }}. + + + This filename does not match the expected charset. + Naziv ove datoteke ne odgovara očekivanom skupu znakova. + diff --git a/Resources/translations/validators.ca.xlf b/Resources/translations/validators.ca.xlf index d656ef540..e78fd8724 100644 --- a/Resources/translations/validators.ca.xlf +++ b/Resources/translations/validators.ca.xlf @@ -468,7 +468,91 @@ This value is not a valid Twig template. - Aquest valor no és una plantilla Twig vàlida. + Aquest valor no és una plantilla Twig vàlida. + + + This file is not a valid video. + Aquest fitxer no és un vídeo vàlid. + + + The size of the video could not be detected. + No s'ha pogut detectar la mida del vídeo. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + L'amplada del vídeo és massa gran ({{ width }}px). L'amplada màxima permesa és {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + L'amplada del vídeo és massa petita ({{ width }}px). L'amplada mínima esperada és {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + L'altura del vídeo és massa gran ({{ height }}px). L'altura màxima permesa és {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + L'altura del vídeo és massa petita ({{ height }}px). L'altura mínima esperada és {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + El vídeo no té suficients píxels ({{ pixels }}). La quantitat mínima esperada és {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + El vídeo té massa píxels ({{ pixels }}). La quantitat màxima prevista és {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + La relació del vídeo és massa gran ({{ ratio }}). La relació màxima permesa és {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + La relació del vídeo és massa petita ({{ ratio }}). La relació mínima esperada és {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + El vídeo és quadrat ({{ width }}x{{ height }}px). No es permeten vídeos quadrats. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + El vídeo té orientació horitzontal ({{ width }}x{{ height }} px). No es permeten vídeos horitzontals. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + El vídeo és en orientació vertical ({{ width }}x{{ height }} px). No es permeten vídeos en orientació vertical. + + + The video file is corrupted. + El fitxer de vídeo està espatllat. + + + The video contains multiple streams. Only one stream is allowed. + El vídeo conté diversos fluxos. Només es permet un sol flux. + + + Unsupported video codec "{{ codec }}". + Còdec de vídeo incompatible «{{ codec }}». + + + Unsupported video container "{{ container }}". + Contenidor de vídeo incompatible "{{ container }}". + + + The image file is corrupted. + El fitxer d'imatge està espatllat. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + La imatge no té suficients píxels ({{ pixels }}). La quantitat mínima esperada és {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + La imatge té massa píxels ({{ pixels }}). El nombre màxim esperat és {{ max_pixels }}. + + + This filename does not match the expected charset. + Aquest nom de fitxer no coincideix amb el charset esperat. diff --git a/Resources/translations/validators.cs.xlf b/Resources/translations/validators.cs.xlf index d5f48f0ae..11a8cbab8 100644 --- a/Resources/translations/validators.cs.xlf +++ b/Resources/translations/validators.cs.xlf @@ -160,19 +160,19 @@ The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. - Obrázek je příliš široký ({{ width }}px). Maximální povolená šířka obrázku je {{ max_width }}px. + Obrázek je příliš široký ({{ width }}px). Maximální povolená šířka je {{ max_width }}px. The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. - Obrázek je příliš úzký ({{ width }}px). Minimální šířka musí být {{ min_width }}px. + Obrázek je příliš úzký ({{ width }}px). Minimální očekávaná šířka je {{ min_width }}px. The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. - Obrázek je příliš vysoký ({{ height }}px). Maximální povolená výška obrázku je {{ max_height }}px. + Obrázek je příliš vysoký ({{ height }}px). Maximální povolená výška je {{ max_height }}px. The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. - Obrázek je příliš nízký ({{ height }}px). Minimální výška obrázku musí být {{ min_height }}px. + Obrázek je příliš nízký ({{ height }}px). Minimální očekávaná výška je {{ min_height }}px. This value should be the user's current password. @@ -280,15 +280,15 @@ The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. - Poměr stran obrázku je příliš velký ({{ ratio }}). Maximální povolený poměr stran obrázku je {{ max_ratio }}. + Poměr stran obrázku je příliš velký ({{ ratio }}). Maximální povolený poměr stran je {{ max_ratio }}. The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. - Poměr stran obrázku je příliš malý ({{ ratio }}). Minimální povolený poměr stran obrázku je {{ min_ratio }}. + Poměr stran obrázku je příliš malý ({{ ratio }}). Minimální očekávaný poměr stran je {{ min_ratio }}. The image is square ({{ width }}x{{ height }}px). Square images are not allowed. - Strany obrázku jsou čtvercové ({{ width }}x{{ height }}px). Čtvercové obrázky nejsou povolené. + Obrázek je čtvercový ({{ width }}x{{ height }}px). Čtvercové obrázky nejsou povolené. The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. @@ -470,6 +470,90 @@ This value is not a valid Twig template. Tato hodnota není platná Twig šablona. + + This file is not a valid video. + Tento soubor není video. + + + The size of the video could not be detected. + Nepodařily se zjistit rozměry videa. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Video je příliš široké ({{ width }}px). Maximální povolená šířka je {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Video je příliš úzké ({{ width }}px). Minimální očekávaná šířka je {{ min_width }} px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Video je příliš vysoké ({{ height }}px). Maximální povolená výška je {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Video je příliš nízké ({{ height }}px). Minimální očekávaná výška je {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Video má příliš málo pixelů ({{ pixels }} pixelů). Minimální očekávané množství je {{ min_pixels }} pixelů. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Video má příliš mnoho pixelů ({{ pixels }} pixelů). Maximální očekávané množství je {{ max_pixels }} pixelů. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Poměr stran videa je příliš velký ({{ ratio }}). Maximální povolený poměr stran je {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Poměr stran videa je příliš malý ({{ ratio }}). Minimální očekávaný poměr stran je {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Video je čtvercové ({{ width }}x{{ height }}px). Čtvercová videa nejsou povolená. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Video je orientované na šířku ({{ width }}x{{ height }} px). Videa orientovaná na šířku nejsou povolená. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Video je orientované na výšku ({{ width }}x{{ height }} px). Videa orientovaná na výšku nejsou povolená. + + + The video file is corrupted. + Soubor videa je poškozený. + + + The video contains multiple streams. Only one stream is allowed. + Video obsahuje více proudů. Povolen je pouze jeden proud. + + + Unsupported video codec "{{ codec }}". + Nepodporovaný kodek videa "{{ codec }}". + + + Unsupported video container "{{ container }}". + Nepodporovaný kontejner videa "{{ container }}". + + + The image file is corrupted. + Soubor obrázku je poškozený. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Obrázek má příliš málo pixelů ({{ pixels }} pixelů). Minimální očekávané množství je {{ min_pixels }} pixelů. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Obrázek má příliš mnoho pixelů ({{ pixels }} pixelů). Maximální očekávané množství je {{ max_pixels }} pixelů. + + + This filename does not match the expected charset. + Tento název souboru neodpovídá očekávané znakové sadě. + diff --git a/Resources/translations/validators.cy.xlf b/Resources/translations/validators.cy.xlf index 08a76667d..366edef03 100644 --- a/Resources/translations/validators.cy.xlf +++ b/Resources/translations/validators.cy.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Nid yw'r gwerth hwn yn dempled Twig dilys. + + This file is not a valid video. + Nid yw’r ffeil hon yn fideo dilys. + + + The size of the video could not be detected. + Nid oedd modd canfod maint y fideo. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Mae lled y fideo yn rhy fawr ({{ width }}px). Y lled uchaf a ganiateir yw {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Mae lled y fideo yn rhy fach ({{ width }}px). Lled lleiaf disgwyliedig yw {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Mae uchder y fideo yn rhy fawr ({{ height }}px). Yr uchder mwyaf a ganiateir yw {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Mae uchder y fideo yn rhy fach ({{ height }}px). Yr uchder lleiaf disgwyliedig yw {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Mae gan y fideo rhy ychydig o bicseli ({{ pixels }}). Y swm lleiaf disgwyliedig yw {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Mae gan y fideo ormod o bicseli ({{ pixels }}). Y swm uchaf disgwyliedig yw {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Mae cymhareb y fideo yn rhy fawr ({{ ratio }}). Y gymhareb uchaf a ganiateir yw {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Mae cymhareb y fideo yn rhy fach ({{ ratio }}). Y gymhareb leiaf ddisgwyliedig yw {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Mae'r fideo'n sgwâr ({{ width }}x{{ height }}px). Nid yw fideos sgwâr yn cael eu caniatáu. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Mae’r fideo yn dirwedd ({{ width }}x{{ height }} px). Ni chaniateir fideos tirwedd. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Mae'r fideo wedi'i gyfeirio'n bortread ({{ width }}x{{ height }}px). Nid yw fideos portread yn cael eu caniatáu. + + + The video file is corrupted. + Mae'r ffeil fideo wedi'i llygru. + + + The video contains multiple streams. Only one stream is allowed. + Mae'r fideo yn cynnwys sawl ffrwd. Dim ond un ffrwd a ganiateir. + + + Unsupported video codec "{{ codec }}". + Codec fideo heb ei gefnogi "{{ codec }}". + + + Unsupported video container "{{ container }}". + Cynhwysydd fideo heb ei gefnogi "{{ container }}". + + + The image file is corrupted. + Mae'r ffeil delwedd wedi'i llygru. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Mae gan y ddelwedd rhy ychydig o bicseli ({{ pixels }}). Y lleiafswm disgwyliedig yw {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Mae gan y ddelwedd ormod o bicseli ({{ pixels }}). Y nifer uchaf disgwyliedig yw {{ max_pixels }}. + + + This filename does not match the expected charset. + Nid yw'r enw ffeil hwn yn cyfateb i'r set nodau ddisgwyliedig. + diff --git a/Resources/translations/validators.da.xlf b/Resources/translations/validators.da.xlf index bb05bba2e..ee93fae92 100644 --- a/Resources/translations/validators.da.xlf +++ b/Resources/translations/validators.da.xlf @@ -136,7 +136,7 @@ This value is not a valid IP address. - Denne værdi er ikke en gyldig IP-adresse. + Denne værdi er ikke en gyldig IP-adresse. This value is not a valid language. @@ -192,7 +192,7 @@ No temporary folder was configured in php.ini, or the configured folder does not exist. - Der blev ikke konfigureret en midlertidig mappe i php.ini, eller den konfigurerede mappe eksisterer ikke. + Der blev ikke konfigureret en midlertidig mappe i php.ini, eller den konfigurerede mappe eksisterer ikke. Cannot write temporary file to disk. @@ -224,7 +224,7 @@ This value is not a valid International Bank Account Number (IBAN). - Denne værdi er ikke et gyldigt internationalt bankkontonummer (IBAN). + Denne værdi er ikke et gyldigt internationalt bankkontonummer (IBAN). This value is not a valid ISBN-10. @@ -312,7 +312,7 @@ This value is not a valid Business Identifier Code (BIC). - Denne værdi er ikke en gyldig forretningsidentifikationskode (BIC). + Denne værdi er ikke en gyldig forretningsidentifikationskode (BIC). Error @@ -320,7 +320,7 @@ This value is not a valid UUID. - Denne værdi er ikke en gyldig UUID. + Denne værdi er ikke en gyldig UUID. This value should be a multiple of {{ compared_value }}. @@ -436,39 +436,123 @@ This value is not a valid MAC address. - Denne værdi er ikke en gyldig MAC-adresse. + Denne værdi er ikke en gyldig MAC-adresse. This URL is missing a top-level domain. - Denne URL mangler et topdomæne. + Denne URL mangler et topdomæne. This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. - Denne værdi er for kort. Den skal indeholde mindst ét ord.|Denne værdi er for kort. Den skal indeholde mindst {{ min }} ord. + Denne værdi er for kort. Den skal indeholde mindst ét ord.|Denne værdi er for kort. Den skal indeholde mindst {{ min }} ord. This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. - Denne værdi er for lang. Den skal indeholde ét ord.|Denne værdi er for lang. Den skal indeholde {{ max }} ord eller færre. + Denne værdi er for lang. Den skal indeholde ét ord.|Denne værdi er for lang. Den skal indeholde {{ max }} ord eller færre. This value does not represent a valid week in the ISO 8601 format. - Denne værdi repræsenterer ikke en gyldig uge i ISO 8601-formatet. + Denne værdi repræsenterer ikke en gyldig uge i ISO 8601-formatet. This value is not a valid week. - Denne værdi er ikke en gyldig uge. + Denne værdi er ikke en gyldig uge. This value should not be before week "{{ min }}". - Denne værdi bør ikke være før uge "{{ min }}". + Denne værdi bør ikke være før uge "{{ min }}". This value should not be after week "{{ max }}". - Denne værdi bør ikke være efter uge "{{ max }}". + Denne værdi bør ikke være efter uge "{{ max }}". This value is not a valid Twig template. - Denne værdi er ikke en gyldig Twig-skabelon. + Denne værdi er ikke en gyldig Twig-skabelon. + + + This file is not a valid video. + Denne fil er ikke en gyldig video. + + + The size of the video could not be detected. + Videostørrelsen kunne ikke registreres. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Videobredden er for stor ({{ width }}px). Tilladt maksimal bredde er {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Videobredden er for lille ({{ width }}px). Mindste forventede bredde er {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Videoens højde er for stor ({{ height }}px). Tilladt maksimal højde er {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Videoens højde er for lille ({{ height }}px). Forventet minimumshøjde er {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Videoen har for få pixels ({{ pixels }}). Forventet minimum er {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Videoen har for mange pixels ({{ pixels }}). Forventet maksimummængde er {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Videoforholdet er for stort ({{ ratio }}). Tilladt maksimalforhold er {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Videoforholdet er for lille ({{ ratio }}). Forventet minimumsforhold er {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Videoen er kvadratisk ({{ width }}x{{ height }}px). Kvadratiske videoer er ikke tilladt. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Videoen er i liggende format ({{ width }}x{{ height }} px). Liggende videoer er ikke tilladt. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Videoen er i portrætformat ({{ width }}x{{ height }}px). Portrætvideoer er ikke tilladt. + + + The video file is corrupted. + Videofilen er beskadiget. + + + The video contains multiple streams. Only one stream is allowed. + Videoen indeholder flere streams. Kun én stream er tilladt. + + + Unsupported video codec "{{ codec }}". + Ikke-understøttet videokodek "{{ codec }}". + + + Unsupported video container "{{ container }}". + Ikke-understøttet videocontainer "{{ container }}". + + + The image file is corrupted. + Billedfilen er beskadiget. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Billedet har for få pixels ({{ pixels }}). Forventet minimum er {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Billedet har for mange pixels ({{ pixels }}). Forventet maksimalt antal er {{ max_pixels }}. + + + This filename does not match the expected charset. + Dette filnavn matcher ikke det forventede tegnsæt. diff --git a/Resources/translations/validators.de.xlf b/Resources/translations/validators.de.xlf index f02c56c6c..36463f3c0 100644 --- a/Resources/translations/validators.de.xlf +++ b/Resources/translations/validators.de.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Dieser Wert ist kein valides Twig-Template. + + This file is not a valid video. + Diese Datei ist kein gültiges Video. + + + The size of the video could not be detected. + Die Größe des Videos konnte nicht ermittelt werden. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Das Video ist zu breit ({{ width }}px). Die zulässige maximale Breite ist {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Das Video ist nicht breit genug ({{ width }}px). Die erwartete Mindestbreite ist {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Die Videohöhe ist zu hoch ({{ height }}px). Die zulässige maximale Höhe ist {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Die Videohöhe ist zu klein ({{ height }}px). Die erwartete Mindesthöhe ist {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Das Video hat zu wenige Pixel ({{ pixels }}). Die erwartete Mindestanzahl ist {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Das Video hat zu viele Pixel ({{ pixels }}). Die erwartete Höchstanzahl ist {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Das Video-Seitenverhältnis ist zu hoch ({{ ratio }}). Das zulässige maximale Verhältnis ist {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Das Video-Seitenverhältnis ist zu klein ({{ ratio }}). Das erwartete Mindestverhältnis ist {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Das Video ist quadratisch ({{ width }}x{{ height }}px). Quadratische Videos sind nicht erlaubt. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Das Video ist im Querformat ({{ width }}x{{ height }} px). Querformat-Videos sind nicht erlaubt. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Das Video ist hochkant ausgerichtet ({{ width }}x{{ height }}px). Hochkant-Videos sind nicht erlaubt. + + + The video file is corrupted. + Die Videodatei ist beschädigt. + + + The video contains multiple streams. Only one stream is allowed. + Das Video enthält mehrere Streams. Es ist nur ein Stream erlaubt. + + + Unsupported video codec "{{ codec }}". + Nicht unterstützter Videocodec "{{ codec }}". + + + Unsupported video container "{{ container }}". + Nicht unterstützter Videocontainer "{{ container }}". + + + The image file is corrupted. + Die Bilddatei ist beschädigt. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Das Bild hat zu wenige Pixel ({{ pixels }}). Erwartete Mindestanzahl ist {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Das Bild hat zu viele Pixel ({{ pixels }}). Erwartete Höchstanzahl ist {{ max_pixels }}. + + + This filename does not match the expected charset. + Dieser Dateiname entspricht nicht dem erwarteten Zeichensatz. + diff --git a/Resources/translations/validators.el.xlf b/Resources/translations/validators.el.xlf index 9aec12ff8..dc5f1a961 100644 --- a/Resources/translations/validators.el.xlf +++ b/Resources/translations/validators.el.xlf @@ -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. + Το βίντεο περιέχει πολλαπλά ρεύματα. Επιτρέπεται μόνο ένα ρεύμα. + + + 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. + Αυτό το όνομα αρχείου δεν αντιστοιχεί στο αναμενόμενο σύνολο χαρακτήρων. + diff --git a/Resources/translations/validators.en.xlf b/Resources/translations/validators.en.xlf index f8c664f18..9a00253e3 100644 --- a/Resources/translations/validators.en.xlf +++ b/Resources/translations/validators.en.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. This value is not a valid Twig template. + + This file is not a valid video. + This file is not a valid video. + + + The size of the video could not be detected. + The size of the video could not be detected. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + + + The video file is corrupted. + The video file is corrupted. + + + The video contains multiple streams. Only one stream is allowed. + The video contains multiple streams. Only one stream is allowed. + + + Unsupported video codec "{{ codec }}". + Unsupported video codec "{{ codec }}". + + + Unsupported video container "{{ container }}". + Unsupported video container "{{ container }}". + + + The image file is corrupted. + The image file is corrupted. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + + + This filename does not match the expected charset. + This filename does not match the expected charset. + diff --git a/Resources/translations/validators.es.xlf b/Resources/translations/validators.es.xlf index a9ad8a76b..c2bdb7c4e 100644 --- a/Resources/translations/validators.es.xlf +++ b/Resources/translations/validators.es.xlf @@ -468,7 +468,91 @@ This value is not a valid Twig template. - Este valor no es una plantilla Twig válida. + Este valor no es una plantilla Twig válida. + + + This file is not a valid video. + Este archivo no es un video válido. + + + The size of the video could not be detected. + No se pudo detectar el tamaño del video. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + El ancho del vídeo es demasiado grande ({{ width }}px). El ancho máximo permitido es {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + El ancho del video es demasiado pequeño ({{ width }}px). El ancho mínimo esperado es {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + La altura del video es demasiado grande ({{ height }}px). La altura máxima permitida es {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + La altura del video es demasiado pequeña ({{ height }}px). La altura mínima esperada es {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + El vídeo tiene muy pocos píxeles ({{ pixels }}). La cantidad mínima esperada es {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + El vídeo tiene demasiados píxeles ({{ pixels }}). La cantidad máxima esperada es {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + La relación del video es demasiado grande ({{ ratio }}). La relación máxima permitida es {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + La relación del video es demasiado pequeña ({{ ratio }}). La relación mínima esperada es {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + El video es cuadrado ({{ width }}x{{ height }}px). No se permiten videos cuadrados. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + El video tiene orientación horizontal ({{ width }}x{{ height }} px). No se permiten videos en formato horizontal. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + El video tiene orientación vertical ({{ width }}x{{ height }} px). No se permiten videos en orientación vertical. + + + The video file is corrupted. + El archivo de video está dañado. + + + The video contains multiple streams. Only one stream is allowed. + El video contiene múltiples flujos. Solo se permite un flujo. + + + Unsupported video codec "{{ codec }}". + Códec de vídeo no compatible «{{ codec }}». + + + Unsupported video container "{{ container }}". + Contenedor de vídeo no compatible "{{ container }}". + + + The image file is corrupted. + El archivo de imagen está dañado. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + La imagen tiene muy pocos píxeles ({{ pixels }}). La cantidad mínima esperada es {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + La imagen tiene demasiados píxeles ({{ pixels }}). La cantidad máxima esperada es {{ max_pixels }}. + + + This filename does not match the expected charset. + Este nombre de archivo no coincide con el conjunto de caracteres esperado. diff --git a/Resources/translations/validators.et.xlf b/Resources/translations/validators.et.xlf index 2375aa4ad..12a2671d9 100644 --- a/Resources/translations/validators.et.xlf +++ b/Resources/translations/validators.et.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. See väärtus ei ole kehtiv Twig'i mall. + + This file is not a valid video. + See fail ei ole kehtiv video. + + + The size of the video could not be detected. + Video suurust ei õnnestunud tuvastada. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Video laius on liiga suur ({{ width }}px). Lubatud maksimaalne laius on {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Video laius on liiga väike ({{ width }}px). Oodatav minimaalne laius on {{ min_width }} px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Video kõrgus on liiga suur ({{ height }}px). Lubatud maksimaalne kõrgus on {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Video kõrgus on liiga väike ({{ height }}px). Oodatav minimaalne kõrgus on {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Videol on liiga vähe piksleid ({{ pixels }}). Oodatav miinimum on {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Videol on liiga palju piksleid ({{ pixels }}). Eeldatav maksimaalne kogus on {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Video suhe on liiga suur ({{ ratio }}). Lubatud maksimaalne suhe on {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Video kuvasuhe on liiga väike ({{ ratio }}). Eeldatav miinimumsuhe on {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Video on ruudukujuline ({{ width }}x{{ height }}px). Ruutvideod pole lubatud. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Video on horisontaalses asendis ({{ width }}x{{ height }} px). Horisontaalseid videoid ei ole lubatud. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Video on püstsuunas ({{ width }}x{{ height }} px). Püstsuunalised videod pole lubatud. + + + The video file is corrupted. + Videofail on rikutud. + + + The video contains multiple streams. Only one stream is allowed. + Video sisaldab mitu voogu. Lubatud on ainult üks voog. + + + Unsupported video codec "{{ codec }}". + Toetamata videokoodek „{{ codec }}“. + + + Unsupported video container "{{ container }}". + Toetamata videokonteiner "{{ container }}". + + + The image file is corrupted. + Pildifail on rikutud. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Pildil on liiga vähe piksleid ({{ pixels }}). Oodatav miinimum on {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Pildil on liiga palju piksleid ({{ pixels }}). Oodatav maksimaalne hulk on {{ max_pixels }}. + + + This filename does not match the expected charset. + See failinimi ei vasta eeldatavale märgistikule. + diff --git a/Resources/translations/validators.eu.xlf b/Resources/translations/validators.eu.xlf index 830f8673d..e498afc26 100644 --- a/Resources/translations/validators.eu.xlf +++ b/Resources/translations/validators.eu.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Balio hau ez da Twig txantiloi baliozko bat. + + This file is not a valid video. + Fitxategi hau ez da baliozko bideo bat. + + + The size of the video could not be detected. + Ezin izan da bideoaren tamaina detektatu. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Bideoaren zabalera handiegia da ({{ width }}px). Baimendutako gehieneko zabalera {{ max_width }}px da. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Bideoaren zabalera txikiegia da ({{ width }}px). Gutxieneko espero den zabalera {{ min_width }}px da. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Bideoaren altuera handiegia da ({{ height }}px). Onartutako gehienezko altuera {{ max_height }}px da. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Bideoaren altuera txikiegia da ({{ height }}px). Espero den gutxieneko altuera {{ min_height }}px da. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Bideoak pixel gutiegi ditu ({{ pixels }}). Gutxieneko espero den kopurua {{ min_pixels }} da. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Bideoak pixel gehiegi ditu ({{ pixels }}). Espero den gehieneko kopurua {{ max_pixels }} da. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Bideoaren erlazioa handiegia da ({{ ratio }}). Onartutako gehieneko erlazioa {{ max_ratio }} da. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Bideoaren erlazioa txikiegia da ({{ ratio }}). Espero den gutxieneko erlazioa {{ min_ratio }} da. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Bideoa karratua da ({{ width }}x{{ height }}px). Bideo karratuak ez dira onartzen. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Bideoa paisaia orientazioan dago ({{ width }}x{{ height }} px). Paisaia-orientazioko bideoak ez daude baimenduta. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Bideoa bertikal orientatuta dago ({{ width }}x{{ height }} px). Orientazio bertikaleko bideoak ez dira onartzen. + + + The video file is corrupted. + Bideo fitxategia hondatuta dago. + + + The video contains multiple streams. Only one stream is allowed. + Bideoak korronte anitz ditu. Korronte bakarra onartzen da. + + + Unsupported video codec "{{ codec }}". + Bideo kodek onartugabea "{{ codec }}". + + + Unsupported video container "{{ container }}". + Onartzen ez den bideo edukiontzia "{{ container }}". + + + The image file is corrupted. + Irudi fitxategia hondatuta dago. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Irudiak pixelen kopuru gutiegi du ({{ pixels }}). Espero den gutxienekoa {{ min_pixels }} da. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Irudiak pixel gehiegi ditu ({{ pixels }}). Espero den gehienezko kopurua {{ max_pixels }} da. + + + This filename does not match the expected charset. + Fitxategi-izen honek ez du espero zen karaktere multzoarekin bat egiten. + diff --git a/Resources/translations/validators.fa.xlf b/Resources/translations/validators.fa.xlf index f47633fd4..2e7516799 100644 --- a/Resources/translations/validators.fa.xlf +++ b/Resources/translations/validators.fa.xlf @@ -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. + نام این فایل با مجموعه نویسه‌های مورد انتظار مطابقت ندارد. diff --git a/Resources/translations/validators.fi.xlf b/Resources/translations/validators.fi.xlf index c046963f7..04d99cf57 100644 --- a/Resources/translations/validators.fi.xlf +++ b/Resources/translations/validators.fi.xlf @@ -136,7 +136,7 @@ This value is not a valid IP address. - Tämä arvo ei ole kelvollinen IP-osoite. + Tämä arvo ei ole kelvollinen IP-osoite. This value is not a valid language. @@ -192,7 +192,7 @@ No temporary folder was configured in php.ini, or the configured folder does not exist. - Väliaikaista kansiota ei ole määritetty php.ini:ssä, tai määritetty kansio ei ole olemassa. + Väliaikaista kansiota ei ole määritetty php.ini:ssä, tai määritetty kansio ei ole olemassa. Cannot write temporary file to disk. @@ -224,7 +224,7 @@ This value is not a valid International Bank Account Number (IBAN). - Tämä arvo ei ole kelvollinen kansainvälinen pankkitilinumero (IBAN). + Tämä arvo ei ole kelvollinen kansainvälinen pankkitilinumero (IBAN). This value is not a valid ISBN-10. @@ -312,7 +312,7 @@ This value is not a valid Business Identifier Code (BIC). - Tämä arvo ei ole kelvollinen liiketoiminnan tunnistekoodi (BIC). + Tämä arvo ei ole kelvollinen liiketoiminnan tunnistekoodi (BIC). Error @@ -320,7 +320,7 @@ This value is not a valid UUID. - Tämä arvo ei ole kelvollinen UUID. + Tämä arvo ei ole kelvollinen UUID. This value should be a multiple of {{ compared_value }}. @@ -440,35 +440,119 @@ This URL is missing a top-level domain. - Tästä URL-osoitteesta puuttuu ylätason verkkotunnus. + Tästä URL-osoitteesta puuttuu ylätason verkkotunnus. This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. - Tämä arvo on liian lyhyt. Sen pitäisi sisältää vähintään yksi sana.|Tämä arvo on liian lyhyt. Sen pitäisi sisältää vähintään {{ min }} sanaa. + Tämä arvo on liian lyhyt. Sen pitäisi sisältää vähintään yksi sana.|Tämä arvo on liian lyhyt. Sen pitäisi sisältää vähintään {{ min }} sanaa. This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. - Tämä arvo on liian pitkä. Sen pitäisi sisältää vain yksi sana.|Tämä arvo on liian pitkä. Sen pitäisi sisältää {{ max }} sanaa tai vähemmän. + Tämä arvo on liian pitkä. Sen pitäisi sisältää vain yksi sana.|Tämä arvo on liian pitkä. Sen pitäisi sisältää {{ max }} sanaa tai vähemmän. This value does not represent a valid week in the ISO 8601 format. - Tämä arvo ei esitä kelvollista viikkoa ISO 8601 -muodossa. + Tämä arvo ei esitä kelvollista viikkoa ISO 8601 -muodossa. This value is not a valid week. - Tämä arvo ei ole kelvollinen viikko. + Tämä arvo ei ole kelvollinen viikko. This value should not be before week "{{ min }}". - Tämän arvon ei pitäisi olla ennen viikkoa "{{ min }}". + Tämän arvon ei pitäisi olla ennen viikkoa "{{ min }}". This value should not be after week "{{ max }}". - Tämän arvon ei pitäisi olla viikon "{{ max }}" jälkeen. + Tämän arvon ei pitäisi olla viikon "{{ max }}" jälkeen. This value is not a valid Twig template. - Tämä arvo ei ole kelvollinen Twig-malli. + Tämä arvo ei ole kelvollinen Twig-malli. + + + This file is not a valid video. + Tämä tiedosto ei ole kelvollinen video. + + + The size of the video could not be detected. + Videon kokoa ei voitu tunnistaa. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Videon leveys on liian suuri ({{ width }} px). Leveyden tulee olla enintään {{ max_width }} px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Videon leveys on liian pieni ({{ width }} px). Leveyden tulee olla vähintään {{ min_width }} px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Videon korkeus on liian suuri ({{ height }} px). Korkeuden tulee olla enintään {{ max_height }} px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Videon korkeus on liian pieni ({{ height }} px). Korkeuden tulee olla vähintään {{ min_height }} px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Videossa on liian vähän pikseleitä ({{ pixels }}). Pikseleitä tulee olla vähintään {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Videossa on liikaa pikseleitä ({{ pixels }}). Pikseleitä tulee olla enintään {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Videon kuvasuhde on liian suuri ({{ ratio }}). Suurin sallittu suhde on {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Videon kuvasuhde on liian pieni ({{ ratio }}). Pienin sallittu suhde on {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Video on neliön muotoinen ({{ width }}x{{ height }}px). Neliönmuotoiset videot eivät ole sallittuja. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Video on vaakasuuntainen ({{ width }}x{{ height }} px). Vaakasuuntaiset videot eivät ole sallittuja. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Video on pystysuuntainen ({{ width }}x{{ height }} px). Pystysuuntaiset videot eivät ole sallittuja. + + + The video file is corrupted. + Videotiedosto on vioittunut. + + + The video contains multiple streams. Only one stream is allowed. + Videossa on useita virtoja. Vain yksi virta on sallittu. + + + Unsupported video codec "{{ codec }}". + Videokoodekkia ei tueta ({{ codec }}). + + + Unsupported video container "{{ container }}". + Videon säiliömuotoa ei tueta ({{ container }}). + + + The image file is corrupted. + Kuvatiedosto on vioittunut. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Kuvassa on liian vähän pikseleitä ({{ pixels }}). Pikseleitä tulee olla vähintään {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Kuvassa on liikaa pikseleitä ({{ pixels }}). Pikseleitä tulee olla enintään {{ max_pixels }}. + + + This filename does not match the expected charset. + Tämä tiedostonimi ei vastaa odotettua merkistöä. diff --git a/Resources/translations/validators.fr.xlf b/Resources/translations/validators.fr.xlf index 13033c019..e682e16a4 100644 --- a/Resources/translations/validators.fr.xlf +++ b/Resources/translations/validators.fr.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Cette valeur n'est pas un modèle Twig valide. + + This file is not a valid video. + Ce fichier n’est pas une vidéo valide. + + + The size of the video could not be detected. + La taille de la vidéo n’a pas pu être détectée. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + La largeur de la vidéo est trop grande ({{ width }}px). La largeur maximale autorisée est de {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + La largeur de la vidéo est trop petite ({{ width }}px). La largeur minimale attendue est de {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + La hauteur de la vidéo est trop grande ({{ height }}px). La hauteur maximale autorisée est de {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + La hauteur de la vidéo est trop petite ({{ height }}px). La hauteur minimale attendue est de {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + La vidéo a trop peu de pixels ({{ pixels }}). La quantité minimale attendue est de {{ min_pixels }} pixels. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + La vidéo contient trop de pixels ({{ pixels }}). La quantité maximale attendue est de {{ max_pixels }} pixels. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Le ratio de la vidéo est trop élevé ({{ ratio }}). Le ratio maximal autorisé est de {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Le ratio de la vidéo est trop petit ({{ ratio }}). Le ratio minimum attendu est de {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + La vidéo est carrée ({{ width }}x{{ height }}px). Les vidéos carrées ne sont pas autorisées. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + La vidéo est au format paysage ({{ width }}x{{ height }} px). Les vidéos au format paysage ne sont pas autorisées. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + La vidéo est orientée en portrait ({{ width }}x{{ height }} px). Les vidéos en orientation portrait ne sont pas autorisées. + + + The video file is corrupted. + Le fichier vidéo est corrompu. + + + The video contains multiple streams. Only one stream is allowed. + La vidéo contient plusieurs flux. Un seul flux est autorisé. + + + Unsupported video codec "{{ codec }}". + Le codec vidéo «{{ codec }}» est non pris en charge. + + + Unsupported video container "{{ container }}". + Le conteneur vidéo «{{ container }}» est non pris en charge. + + + The image file is corrupted. + Le fichier image est corrompu. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + L’image comporte trop peu de pixels ({{ pixels }}). La quantité minimale attendue est de {{ min_pixels }} pixels. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + L’image contient trop de pixels ({{ pixels }}). La quantité maximale attendue est de {{ max_pixels }} pixels. + + + This filename does not match the expected charset. + Le nom de fichier ne correspond pas au jeu de caractères attendu. + diff --git a/Resources/translations/validators.gl.xlf b/Resources/translations/validators.gl.xlf index 391d741e9..489457d54 100644 --- a/Resources/translations/validators.gl.xlf +++ b/Resources/translations/validators.gl.xlf @@ -136,7 +136,7 @@ This value is not a valid IP address. - Este valor non é un enderezo IP válido. + Este valor non é un enderezo IP válido. This value is not a valid language. @@ -224,7 +224,7 @@ This value is not a valid International Bank Account Number (IBAN). - Este valor non é un Número de Conta Bancaria Internacional (IBAN) válido. + Este valor non é un Número de Conta Bancaria Internacional (IBAN) válido. This value is not a valid ISBN-10. @@ -312,7 +312,7 @@ This value is not a valid Business Identifier Code (BIC). - Este valor non é un Código de Identificación de Negocios (BIC) válido. + Este valor non é un Código de Identificación de Negocios (BIC) válido. Error @@ -320,7 +320,7 @@ This value is not a valid UUID. - Este valor non é un UUID válido. + Este valor non é un UUID válido. This value should be a multiple of {{ compared_value }}. @@ -404,71 +404,155 @@ 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. - O nome do ficheiro é demasiado longo. Debe ter {{ filename_max_length }} caracteres ou menos. + O nome do ficheiro é demasiado longo. Debe ter {{ filename_max_length }} caracteres ou menos. The password strength is too low. Please use a stronger password. - A forza do contrasinal é demasiado baixa. Utilice un contrasinal máis forte. + O contrasinal é demasiado débil. Utilice un contrasinal máis seguro. This value contains characters that are not allowed by the current restriction-level. - Este valor contén caracteres que non están permitidos polo nivel de restrición actual. + Este valor contén caracteres que non están permitidos polo nivel de restrición actual. Using invisible characters is not allowed. - Non se permite usar caracteres invisibles. + Non se permite usar caracteres invisíbeis. Mixing numbers from different scripts is not allowed. - Non se permite mesturar números de diferentes scripts. + Non se permite mesturar números de diferentes scripts. Using hidden overlay characters is not allowed. - Non se permite usar caracteres de superposición ocultos. + Non se permite usar caracteres de superposición ocultos. The extension of the file is invalid ({{ extension }}). Allowed extensions are {{ extensions }}. - A extensión do ficheiro non é válida ({{ extension }}). As extensións permitidas son {{ extensions }}. + A extensión do ficheiro non é válida ({{ extension }}). As extensións permitidas son {{ extensions }}. The detected character encoding is invalid ({{ detected }}). Allowed encodings are {{ encodings }}. - A codificación de caracteres detectada non é válida ({{ detected }}). As codificacións permitidas son {{ encodings }}. + A codificación de caracteres detectada non é válida ({{ detected }}). As codificacións permitidas son {{ encodings }}. This value is not a valid MAC address. - Este valor non é un enderezo MAC válido. + Este valor non é un enderezo MAC válido. This URL is missing a top-level domain. - Esta URL non contén un dominio de nivel superior. + A esta URL fáltalle un dominio de nivel superior. This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. - Este valor é demasiado curto. Debe conter polo menos unha palabra.|Este valor é demasiado curto. Debe conter polo menos {{ min }} palabras. + Este valor é curto de máis. Debe conter polo menos unha palabra.|Este valor é curto de máis. Debe conter polo menos {{ min }} palabras. This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. - Este valor é demasiado longo. Debe conter só unha palabra.|Este valor é demasiado longo. Debe conter {{ max }} palabras ou menos. + Este valor é longo de máis. Debe conter só unha palabra.|Este valor é longo de máis. Debe conter {{ max }} palabras ou menos. This value does not represent a valid week in the ISO 8601 format. - Este valor non representa unha semana válida no formato ISO 8601. + Este valor non representa unha semana válida no formato ISO 8601. This value is not a valid week. - Este valor non é unha semana válida. + Este valor non é unha semana válida. This value should not be before week "{{ min }}". - Este valor non debe ser anterior á semana "{{ min }}". + Este valor non debe ser anterior á semana "{{ min }}". This value should not be after week "{{ max }}". - Este valor non debe estar despois da semana "{{ max }}". + Este valor non debe estar despois da semana "{{ max }}". This value is not a valid Twig template. - Este valor non é un modelo Twig válido. + Este valor non é un modelo Twig válido. + + + This file is not a valid video. + Este ficheiro non é un vídeo válido. + + + The size of the video could not be detected. + Non se puido detectar o tamaño do vídeo. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + A anchura do vídeo é demasiado grande ({{ width }}px). A anchura máxima permitida é {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + A anchura do vídeo é demasiado pequena ({{ width }}px). A anchura mínima agardada é {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + A altura do vídeo é demasiado grande ({{ height }}px). A altura máxima permitida é {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + A altura do vídeo é demasiado pequena ({{ height }}px). A altura mínima agardada é {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + O vídeo ten moi poucos píxeles ({{ pixels }}). A cantidade mínima agardada é {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + O vídeo ten demasiados píxeles ({{ pixels }}). A cantidade máxima agardada é {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + A relación do vídeo é demasiado grande ({{ ratio }}). A relación máxima permitida é {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + A relación do vídeo é demasiado pequena ({{ ratio }}). A relación mínima agardada é {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + O vídeo é cadrado ({{ width }}x{{ height }}px). Non se permiten vídeos cadrados. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + O vídeo está en orientación horizontal ({{ width }}x{{ height }} px). Non se permiten vídeos en horizontal. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + O vídeo está en orientación vertical ({{ width }}x{{ height }} px). Non se permiten vídeos en orientación vertical. + + + The video file is corrupted. + O ficheiro de vídeo está danado. + + + The video contains multiple streams. Only one stream is allowed. + O vídeo contén múltiples fluxos. Só se permite un fluxo. + + + Unsupported video codec "{{ codec }}". + Códec de vídeo non compatible «{{ codec }}». + + + Unsupported video container "{{ container }}". + Contedor de vídeo non compatible "{{ container }}". + + + The image file is corrupted. + O ficheiro de imaxe está danado. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + A imaxe ten moi poucos píxeles ({{ pixels }}). A cantidade mínima esperada é {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + A imaxe ten demasiados píxeles ({{ pixels }}). A cantidade máxima esperada é {{ max_pixels }}. + + + This filename does not match the expected charset. + Este nome de ficheiro non coincide co charset agardado. diff --git a/Resources/translations/validators.he.xlf b/Resources/translations/validators.he.xlf index 671a98881..e19c438e4 100644 --- a/Resources/translations/validators.he.xlf +++ b/Resources/translations/validators.he.xlf @@ -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 }} פיקסלים. + + + 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. + שם הקובץ הזה אינו תואם את מערך התווים הצפוי. + diff --git a/Resources/translations/validators.hr.xlf b/Resources/translations/validators.hr.xlf index 0951d4192..2be0ff60c 100644 --- a/Resources/translations/validators.hr.xlf +++ b/Resources/translations/validators.hr.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Ova vrijednost nije valjani Twig predložak. + + This file is not a valid video. + Ova datoteka nije valjani videozapis. + + + The size of the video could not be detected. + Veličina videozapisa nije mogla biti određena. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Širina videozapisa je prevelika ({{ width }}px). Dopuštenа maksimalna širina je {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Širina videozapisa je premala ({{ width }}px). Očekivana minimalna širina je {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Visina videozapisa je prevelika ({{ height }}px). Dopuštena maksimalna visina je {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Visina videozapisa je premala ({{ height }}px). Očekivana minimalna visina je {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Video ima premalo piksela ({{ pixels }}). Očekivani minimalni broj je {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Video ima previše piksela ({{ pixels }}). Očekivani maksimalni broj je {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Omjer videa je prevelik ({{ ratio }}). Dopušteni maksimalni omjer je {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Omjer videa je premalen ({{ ratio }}). Minimalni očekivani omjer je {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Video je kvadratan ({{ width }}x{{ height }}px). Kvadratni videozapisi nisu dopušteni. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Video je vodoravne orijentacije ({{ width }}x{{ height }} px). Vodoravni videozapisi nisu dopušteni. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Video je okomite orijentacije ({{ width }}x{{ height }} px). Videozapisi okomite orijentacije nisu dopušteni. + + + The video file is corrupted. + Videodatoteka je oštećena. + + + The video contains multiple streams. Only one stream is allowed. + Video sadrži više tokova. Dopušten je samo jedan tok. + + + Unsupported video codec "{{ codec }}". + Nepodržani video kodek "{{ codec }}". + + + Unsupported video container "{{ container }}". + Nepodržani video spremnik "{{ container }}". + + + The image file is corrupted. + Datoteka slike je oštećena. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Slika ima premalo piksela ({{ pixels }}). Očekivani minimalni broj je {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Slika ima previše piksela ({{ pixels }}). Očekivani maksimalni broj je {{ max_pixels }}. + + + This filename does not match the expected charset. + Naziv ove datoteke ne odgovara očekivanom skupu znakova. + diff --git a/Resources/translations/validators.hu.xlf b/Resources/translations/validators.hu.xlf index dffab0ccb..05bd279ae 100644 --- a/Resources/translations/validators.hu.xlf +++ b/Resources/translations/validators.hu.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Ez az érték nem érvényes Twig sablon. + + This file is not a valid video. + Ez a fájl nem érvényes videó. + + + The size of the video could not be detected. + A videó méretét nem sikerült megállapítani. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + A videó szélessége túl nagy ({{ width }}px). A megengedett maximális szélesség {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + A videó szélessége túl kicsi ({{ width }}px). A várható minimális szélesség {{ min_width }} px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + A videó magassága túl nagy ({{ height }}px). A megengedett maximális magasság {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + A videó magassága túl kicsi ({{ height }}px). A minimálisan elvárt magasság {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + A videóban túl kevés a képpont ({{ pixels }}). Az elvárt minimális mennyiség {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + A videóban túl sok a képpont ({{ pixels }}). A várható maximális mennyiség {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + A videó aránya túl nagy ({{ ratio }}). A megengedett maximális arány {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + A videó képaránya túl kicsi ({{ ratio }}). A minimálisan elvárt arány {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + A videó négyzetes ({{ width }}x{{ height }}px). A négyzetes videók nem engedélyezettek. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + A videó fekvő tájolású ({{ width }}x{{ height }} px). Fekvő tájolású videók nem engedélyezettek. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + A videó álló tájolású ({{ width }}x{{ height }} px). Álló tájolású videók nem engedélyezettek. + + + The video file is corrupted. + A videófájl sérült. + + + The video contains multiple streams. Only one stream is allowed. + A videó több adatfolyamot tartalmaz. Csak egy adatfolyam engedélyezett. + + + Unsupported video codec "{{ codec }}". + Nem támogatott videokodek „{{ codec }}”. + + + Unsupported video container "{{ container }}". + Nem támogatott videokonténer "{{ container }}". + + + The image file is corrupted. + A képfájl sérült. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + A képen túl kevés pixel van ({{ pixels }}). Az elvárt minimum {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + A kép túl sok pixelt tartalmaz ({{ pixels }}). A várható maximális mennyiség {{ max_pixels }}. + + + This filename does not match the expected charset. + Ez a fájlnév nem felel meg a várt karakterkészletnek. + diff --git a/Resources/translations/validators.hy.xlf b/Resources/translations/validators.hy.xlf index 856babbd5..e537733c7 100644 --- a/Resources/translations/validators.hy.xlf +++ b/Resources/translations/validators.hy.xlf @@ -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. + Տեսանյութը պարունակում է բազմաթիվ հոսքեր։ Թույլատրվում է միայն մեկ հոսք։ + + + 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. + Այս ֆայլի անունը չի համապատասխանում սպասվող նիշքերի հավաքածուին. + diff --git a/Resources/translations/validators.id.xlf b/Resources/translations/validators.id.xlf index b9796f888..b303d50e1 100644 --- a/Resources/translations/validators.id.xlf +++ b/Resources/translations/validators.id.xlf @@ -468,7 +468,91 @@ This value is not a valid Twig template. - Nilai ini bukan templat Twig yang valid. + Nilai ini bukan templat Twig yang valid. + + + This file is not a valid video. + Berkas ini bukan video yang valid. + + + The size of the video could not be detected. + Ukuran video tidak dapat dideteksi. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Lebar video terlalu besar ({{ width }}px). Lebar maksimum yang diizinkan adalah {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Lebar video terlalu kecil ({{ width }}px). Lebar minimum yang diharapkan adalah {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Tinggi video terlalu besar ({{ height }}px). Tinggi maksimum yang diizinkan adalah {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Tinggi video terlalu kecil ({{ height }}px). Tinggi minimum yang diharapkan adalah {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Video memiliki terlalu sedikit piksel ({{ pixels }}). Jumlah minimum yang diharapkan adalah {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Video memiliki terlalu banyak piksel ({{ pixels }}). Jumlah maksimum yang diharapkan adalah {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Rasio video terlalu besar ({{ ratio }}). Rasio maksimum yang diizinkan adalah {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Rasio video terlalu kecil ({{ ratio }}). Rasio minimum yang diharapkan adalah {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Video berbentuk persegi ({{ width }}x{{ height }}px). Video persegi tidak diizinkan. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Video berorientasi lanskap ({{ width }}x{{ height }}px). Video berorientasi lanskap tidak diizinkan. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Video berorientasi potret ({{ width }}x{{ height }}px). Video berorientasi potret tidak diizinkan. + + + The video file is corrupted. + Berkas video rusak. + + + The video contains multiple streams. Only one stream is allowed. + Video berisi beberapa aliran. Hanya satu aliran yang diizinkan. + + + Unsupported video codec "{{ codec }}". + Kodek video tidak didukung "{{ codec }}". + + + Unsupported video container "{{ container }}". + Kontainer video tidak didukung "{{ container }}". + + + The image file is corrupted. + Berkas gambar rusak. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Gambar memiliki terlalu sedikit piksel ({{ pixels }}). Jumlah minimum yang diharapkan adalah {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Gambar memiliki terlalu banyak piksel ({{ pixels }}). Jumlah maksimum yang diharapkan adalah {{ max_pixels }}. + + + This filename does not match the expected charset. + Nama berkas ini tidak sesuai dengan set karakter yang diharapkan. diff --git a/Resources/translations/validators.it.xlf b/Resources/translations/validators.it.xlf index 34ef61ed5..e22713e8d 100644 --- a/Resources/translations/validators.it.xlf +++ b/Resources/translations/validators.it.xlf @@ -468,7 +468,91 @@ This value is not a valid Twig template. - Questo valore non è un template Twig valido. + Questo valore non è un template Twig valido. + + + This file is not a valid video. + Questo file non è un video valido. + + + The size of the video could not be detected. + Non è stato possibile rilevare la dimensione del video. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + La larghezza del video è troppo grande ({{ width }}px). La larghezza massima consentita è {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + La larghezza del video è troppo piccola ({{ width }}px). La larghezza minima prevista è {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + L'altezza del video è troppo grande ({{ height }}px). L'altezza massima consentita è {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + L'altezza del video è troppo piccola ({{ height }}px). L'altezza minima prevista è {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Il video ha troppo pochi pixel ({{ pixels }}). La quantità minima prevista è {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Il video ha troppi pixel ({{ pixels }}). La quantità massima prevista è {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Il rapporto del video è troppo alto ({{ ratio }}). Il rapporto massimo consentito è {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Il rapporto del video è troppo piccolo ({{ ratio }}). Il rapporto minimo previsto è {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Il video è quadrato ({{ width }}x{{ height }}px). I video quadrati non sono consentiti. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Il video è in orientamento orizzontale ({{ width }}x{{ height }}px). I video orizzontali non sono consentiti. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Il video è in orientamento verticale ({{ width }}x{{ height }}px). I video in orientamento verticale non sono consentiti. + + + The video file is corrupted. + Il file video è danneggiato. + + + The video contains multiple streams. Only one stream is allowed. + Il video contiene più flussi. È consentito un solo flusso. + + + Unsupported video codec "{{ codec }}". + Codec video non supportato «{{ codec }}». + + + Unsupported video container "{{ container }}". + Container video non supportato "{{ container }}". + + + The image file is corrupted. + Il file immagine è danneggiato. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + L’immagine ha troppo pochi pixel ({{ pixels }}). La quantità minima prevista è {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + L’immagine ha troppi pixel ({{ pixels }}). La quantità massima prevista è {{ max_pixels }}. + + + This filename does not match the expected charset. + Questo nome file non corrisponde al set di caratteri previsto. diff --git a/Resources/translations/validators.ja.xlf b/Resources/translations/validators.ja.xlf index 42e51903c..419b77e09 100644 --- a/Resources/translations/validators.ja.xlf +++ b/Resources/translations/validators.ja.xlf @@ -4,19 +4,19 @@ 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. + このファイル名は期待される文字セットと一致しません。 + diff --git a/Resources/translations/validators.lb.xlf b/Resources/translations/validators.lb.xlf index d1b5cef57..dd4ac75a1 100644 --- a/Resources/translations/validators.lb.xlf +++ b/Resources/translations/validators.lb.xlf @@ -136,7 +136,7 @@ This value is not a valid IP address. - Dëse Wäert ass keng gülteg IP-Adress. + Dëse Wäert ass keng gülteg IP-Adress. This value is not a valid language. @@ -224,7 +224,7 @@ This value is not a valid International Bank Account Number (IBAN). - Dëse Wäert ass keng gülteg International Bankkontonummer (IBAN). + Dëse Wäert ass keng gülteg International Bankkontonummer (IBAN). This value is not a valid ISBN-10. @@ -312,7 +312,7 @@ This value is not a valid Business Identifier Code (BIC). - Dëse Wäert ass kee gültege Business Identifier Code (BIC). + Dëse Wäert ass kee gültege Business Identifier Code (BIC). Error @@ -320,7 +320,7 @@ This value is not a valid UUID. - Dëse Wäert ass keng gülteg UUID. + Dëse Wäert ass keng gülteg UUID. This value should be a multiple of {{ compared_value }}. @@ -436,39 +436,123 @@ This value is not a valid MAC address. - Dëse Wäert ass keng gülteg MAC-Adress. + Dëse Wäert ass keng gülteg MAC-Adress. This URL is missing a top-level domain. - Dësen URL feelt eng Top-Level-Domain. + Dësen URL feelt eng Top-Level-Domain. This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. - Dëse Wäert ass ze kuerz. Et sollt op d'mannst ee Wuert enthalen.|Dëse Wäert ass ze kuerz. Et sollt op d'mannst {{ min }} Wierder enthalen. + Dëse Wäert ass ze kuerz. Et sollt op d'mannst ee Wuert enthalen.|Dëse Wäert ass ze kuerz. Et sollt op d'mannst {{ min }} Wierder enthalen. This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. - Dëse Wäert ass ze laang. Et sollt nëmmen ee Wuert enthalen.|Dëse Wäert ass ze laang. Et sollt {{ max }} Wierder oder manner enthalen. + Dëse Wäert ass ze laang. Et sollt nëmmen ee Wuert enthalen.|Dëse Wäert ass ze laang. Et sollt {{ max }} Wierder oder manner enthalen. This value does not represent a valid week in the ISO 8601 format. - Dëse Wäert stellt keng valabel Woch am ISO 8601-Format duer. + Dëse Wäert stellt keng valabel Woch am ISO 8601-Format duer. This value is not a valid week. - Dëse Wäert ass keng valabel Woch. + Dëse Wäert ass keng valabel Woch. This value should not be before week "{{ min }}". - Dëse Wäert sollt net virun der Woch "{{ min }}" sinn. + Dëse Wäert sollt net virun der Woch "{{ min }}" sinn. This value should not be after week "{{ max }}". - Dëse Wäert sollt net no Woch "{{ max }}" sinn. + Dëse Wäert sollt net no Woch "{{ max }}" sinn. This value is not a valid Twig template. - Dëse Wäert ass kee valabelen Twig-Template. + Dëse Wäert ass kee valabelen Twig-Template. + + + This file is not a valid video. + Dës Datei ass kee gëltegen Video. + + + The size of the video could not be detected. + D'Gréisst vum Video konnt net erkannt ginn. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + D'Videobreed ass ze grouss ({{ width }}px). Erlaabt maximal Breed ass {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + D'Videobreed ass ze kleng ({{ width }}px). Minimal erwaart Breed ass {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + D'Videohéicht ass ze grouss ({{ height }}px). Erlaabt maximal Héicht ass {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + D'Videohéicht ass ze kleng ({{ height }}px). Erwaart Mindesthéicht ass {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + De Video huet ze wéineg Pixel ({{ pixels }}). Erwaart Minimum ass {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + De Video huet ze vill Pixel ({{ pixels }}). Déi erwaart maximal Zuel ass {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + D'Videoproportioun ass ze grouss ({{ ratio }}). Erlaabt maximal Proportioun ass {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + D'Videoratio ass ze kleng ({{ ratio }}). Minimal erwaart Ratio ass {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + De Video ass quadratesch ({{ width }}x{{ height }}px). Quadratesch Videoe sinn net erlaabt. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + De Video ass am Landschaftsformat ({{ width }}x{{ height }} px). Landschafts-Videoe sinn net erlaabt. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + De Video ass am Portraitformat ({{ width }}x{{ height }}px). Portrait-Videoe sinn net erlaabt. + + + The video file is corrupted. + D'Videodatei ass beschiedegt. + + + The video contains multiple streams. Only one stream is allowed. + De Video enthält verschidde Stréimen. Nëmmen ee Stroum ass erlaabt. + + + Unsupported video codec "{{ codec }}". + Net ënnerstëtzte Videocodec „{{ codec }}“. + + + Unsupported video container "{{ container }}". + Net ënnerstëtzte Video-Container "{{ container }}". + + + The image file is corrupted. + D'Bilddatei ass beschiedegt. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + D'Bild huet ze wéineg Pixel ({{ pixels }}). Déi erwaart Mindestzuel ass {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + D'Bild huet ze vill Pixel ({{ pixels }}). Déi erwaart maximal Zuel ass {{ max_pixels }}. + + + This filename does not match the expected charset. + Dësen Dateinumm entsprécht net dem erwaarten Zeechesaz. diff --git a/Resources/translations/validators.lt.xlf b/Resources/translations/validators.lt.xlf index 46abd9503..ab4bdc57e 100644 --- a/Resources/translations/validators.lt.xlf +++ b/Resources/translations/validators.lt.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Ši reikšmė nėra tinkamas „Twig“ šablonas. + + This file is not a valid video. + Šis failas nėra galiojantis vaizdo įrašas. + + + The size of the video could not be detected. + Nepavyko nustatyti vaizdo įrašo dydžio. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Vaizdo įrašo plotis per didelis ({{ width }}px). Leidžiamas didžiausias plotis yra {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Vaizdo įrašo plotis per mažas ({{ width }}px). Tikėtinas mažiausias plotis yra {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Vaizdo aukštis per didelis ({{ height }}px). Leidžiamas maksimalus aukštis yra {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Vaizdo aukštis per mažas ({{ height }}px). Tikėtinas minimalus aukštis yra {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Vaizdo įraše per mažai pikselių ({{ pixels }}). Tikimasi mažiausiai {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Vaizdo įraše per daug pikselių ({{ pixels }}). Tikimasi, kad didžiausias kiekis yra {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Vaizdo santykis per didelis ({{ ratio }}). Leidžiamas didžiausias santykis yra {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Vaizdo santykis per mažas ({{ ratio }}). Tikimasi mažiausias santykis yra {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Vaizdo įrašas yra kvadratinis ({{ width }}x{{ height }}px). Kvadratiniai vaizdo įrašai neleidžiami. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Vaizdo įrašas yra gulsčio formato ({{ width }}x{{ height }} px). Gulsčio formato vaizdo įrašai neleidžiami. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Vaizdo įrašas yra portreto orientacijos ({{ width }}x{{ height }}px). Portreto orientacijos vaizdo įrašai neleidžiami. + + + The video file is corrupted. + Vaizdo failas sugadintas. + + + The video contains multiple streams. Only one stream is allowed. + Vaizdo įraše yra keli srautai. Leidžiamas tik vienas srautas. + + + Unsupported video codec "{{ codec }}". + Nepalaikomas vaizdo kodekas „{{ codec }}“. + + + Unsupported video container "{{ container }}". + Nepalaikomas vaizdo konteineris "{{ container }}". + + + The image file is corrupted. + Paveikslėlio failas sugadintas. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Paveikslėlyje per mažai pikselių ({{ pixels }}). Tikimasi mažiausiai {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Paveikslėlis turi per daug pikselių ({{ pixels }}). Tikėtinas didžiausias kiekis yra {{ max_pixels }}. + + + This filename does not match the expected charset. + Šis failo pavadinimas neatitinka laukiamo ženklų rinkinio. + diff --git a/Resources/translations/validators.lv.xlf b/Resources/translations/validators.lv.xlf index 3e2d51a30..2d78bfd3e 100644 --- a/Resources/translations/validators.lv.xlf +++ b/Resources/translations/validators.lv.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Šī vērtība nav derīgs Twig šablons. + + This file is not a valid video. + Šī datne nav derīgs video fails. + + + The size of the video could not be detected. + Neizdevās noteikt video izmēru. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Video platums ir pārāk liels ({{ width }}px). Atļautais maksimālais platums ir {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Video platums ir pārāk mazs ({{ width }}px). Sagaidāmais minimālais platums ir {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Video augstums ir pārāk liels ({{ height }}px). Atļautais maksimālais augstums ir {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Video augstums ir pārāk mazs ({{ height }}px). Sagaidāmais minimālais augstums ir {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Video ir pārāk maz pikseļu ({{ pixels }}). Sagaidāmais minimālais daudzums ir {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Video ir pārāk daudz pikseļu ({{ pixels }}). Paredzētais maksimālais daudzums ir {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Video attiecība ir pārāk liela ({{ ratio }}). Atļautā maksimālā attiecība ir {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Video attiecība ir pārāk maza ({{ ratio }}). Sagaidāmā minimālā attiecība ir {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Video ir kvadrātveida ({{ width }}x{{ height }}px). Kvadrātveida video nav atļauti. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Video ir ainavas orientācijā ({{ width }}x{{ height }} px). Ainavas formāta video nav atļauti. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Video ir portreta orientācijā ({{ width }}x{{ height }}px). Portreta orientācijas video nav atļauti. + + + The video file is corrupted. + Video fails ir bojāts. + + + The video contains multiple streams. Only one stream is allowed. + Video satur vairākus straumējumus. Atļauta ir tikai viena straume. + + + Unsupported video codec "{{ codec }}". + Neatbalstīts video kodeks “{{ codec }}”. + + + Unsupported video container "{{ container }}". + Neatbalstīts video konteiners "{{ container }}". + + + The image file is corrupted. + Attēla fails ir bojāts. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Attēlam ir par maz pikseļu ({{ pixels }}). Sagaidāmais minimālais daudzums ir {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Attēlam ir pārāk daudz pikseļu ({{ pixels }}). Sagaidāmais maksimālais daudzums ir {{ max_pixels }}. + + + This filename does not match the expected charset. + Šis faila nosaukums neatbilst paredzētajam rakstzīmju kopumam. + diff --git a/Resources/translations/validators.mk.xlf b/Resources/translations/validators.mk.xlf index 99b1a191b..a21621b17 100644 --- a/Resources/translations/validators.mk.xlf +++ b/Resources/translations/validators.mk.xlf @@ -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. + Видеото содржи повеќе струи. Дозволена е само една струја. + + + 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. + Името на датотеката не одговара на очекуваниот збир на знаци. + diff --git a/Resources/translations/validators.mn.xlf b/Resources/translations/validators.mn.xlf index 3344675d9..42a841f7d 100644 --- a/Resources/translations/validators.mn.xlf +++ b/Resources/translations/validators.mn.xlf @@ -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. + Видео нь олон урсгал агуулсан байна. Зөвхөн нэг урсгалыг зөвшөөрнө. + + + 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. + Энэ файлын нэр хүлээгдэж буй тэмдэгтийн багцтай нийцэхгүй байна. + diff --git a/Resources/translations/validators.my.xlf b/Resources/translations/validators.my.xlf index 04c955f75..bf23d6363 100644 --- a/Resources/translations/validators.my.xlf +++ b/Resources/translations/validators.my.xlf @@ -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. + ဗီဒီယိုတွင် pixel များ အလွန်များနေသည် ({{ 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. + ဗီဒီယိုတွင် စီးဆင်းမှုများ များစွာ ပါရှိသည်။ စီးဆင်းမှုတစ်ခုသာ ခွင့်ပြုထားသည်။ + + + 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. + ဤဖိုင်နာမည်သည် မျှော်မှန်းထားသော အက္ခရာစုနှင့် ကိုက်ညီမှုမရှိပါ။ + diff --git a/Resources/translations/validators.nb.xlf b/Resources/translations/validators.nb.xlf index 58696f671..11ce9777b 100644 --- a/Resources/translations/validators.nb.xlf +++ b/Resources/translations/validators.nb.xlf @@ -136,7 +136,7 @@ This value is not a valid IP address. - Denne verdien er ikke en gyldig IP-adresse. + Denne verdien er ikke en gyldig IP-adresse. This value is not a valid language. @@ -192,7 +192,7 @@ No temporary folder was configured in php.ini, or the configured folder does not exist. - Ingen midlertidig mappe ble konfigurert i php.ini, eller den konfigurerte mappen eksisterer ikke. + Ingen midlertidig mappe ble konfigurert i php.ini, eller den konfigurerte mappen eksisterer ikke. Cannot write temporary file to disk. @@ -224,7 +224,7 @@ This value is not a valid International Bank Account Number (IBAN). - Denne verdien er ikke et gyldig internasjonalt bankkontonummer (IBAN). + Denne verdien er ikke et gyldig internasjonalt bankkontonummer (IBAN). This value is not a valid ISBN-10. @@ -312,7 +312,7 @@ This value is not a valid Business Identifier Code (BIC). - Denne verdien er ikke en gyldig forretningsidentifikasjonskode (BIC). + Denne verdien er ikke en gyldig forretningsidentifikasjonskode (BIC). Error @@ -320,7 +320,7 @@ This value is not a valid UUID. - Denne verdien er ikke en gyldig UUID. + Denne verdien er ikke en gyldig UUID. This value should be a multiple of {{ compared_value }}. @@ -404,71 +404,155 @@ 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. - Filnavnet er for langt. Det bør ha {{ filename_max_length }} tegn eller mindre.|Filnavnet er for langt. Det bør ha {{ filename_max_length }} tegn eller mindre. + Filnavnet er for langt. Det bør ha {{ filename_max_length }} tegn eller mindre.|Filnavnet er for langt. Det bør ha {{ filename_max_length }} tegn eller mindre. The password strength is too low. Please use a stronger password. - Passordstyrken er for lav. Vennligst bruk et sterkere passord. + Passordstyrken er for lav. Vennligst bruk et sterkere passord. This value contains characters that are not allowed by the current restriction-level. - Denne verdien inneholder tegn som ikke er tillatt av gjeldende restriksjonsnivå. + Denne verdien inneholder tegn som ikke er tillatt av gjeldende restriksjonsnivå. Using invisible characters is not allowed. - Det er ikke tillatt å bruke usynlige tegn. + Det er ikke tillatt å bruke usynlige tegn. Mixing numbers from different scripts is not allowed. - Det er ikke tillatt å blande tall fra forskjellige skript. + Det er ikke tillatt å blande tall fra forskjellige skript. Using hidden overlay characters is not allowed. - Det er ikke tillatt å bruke skjulte overleggskarakterer. + Det er ikke tillatt å bruke skjulte overleggskarakterer. The extension of the file is invalid ({{ extension }}). Allowed extensions are {{ extensions }}. - Filutvidelsen er ugyldig ({{ extension }}). Tillatte utvidelser er {{ extensions }}. + Filutvidelsen er ugyldig ({{ extension }}). Tillatte utvidelser er {{ extensions }}. The detected character encoding is invalid ({{ detected }}). Allowed encodings are {{ encodings }}. - Den oppdagede tegnkodingen er ugyldig ({{ detected }}). Tillatte kodinger er {{ encodings }}. + Den oppdagede tegnkodingen er ugyldig ({{ detected }}). Tillatte kodinger er {{ encodings }}. This value is not a valid MAC address. - Denne verdien er ikke en gyldig MAC-adresse. + Denne verdien er ikke en gyldig MAC-adresse. This URL is missing a top-level domain. - Denne URL-en mangler et toppnivådomene. + Denne URL-en mangler et toppnivådomene. This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. - Denne verdien er for kort. Den bør inneholde minst ett ord.|Denne verdien er for kort. Den bør inneholde minst {{ min }} ord. + Denne verdien er for kort. Den bør inneholde minst ett ord.|Denne verdien er for kort. Den bør inneholde minst {{ min }} ord. This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. - Denne verdien er for lang. Den bør inneholde kun ett ord.|Denne verdien er for lang. Den bør inneholde {{ max }} ord eller færre. + Denne verdien er for lang. Den bør inneholde kun ett ord.|Denne verdien er for lang. Den bør inneholde {{ max }} ord eller færre. This value does not represent a valid week in the ISO 8601 format. - Denne verdien representerer ikke en gyldig uke i ISO 8601-formatet. + Denne verdien representerer ikke en gyldig uke i ISO 8601-formatet. This value is not a valid week. - Denne verdien er ikke en gyldig uke. + Denne verdien er ikke en gyldig uke. This value should not be before week "{{ min }}". - Denne verdien bør ikke være før uke "{{ min }}". + Denne verdien bør ikke være før uke "{{ min }}". This value should not be after week "{{ max }}". - Denne verdien bør ikke være etter uke "{{ max }}". + Denne verdien bør ikke være etter uke "{{ max }}". This value is not a valid Twig template. - Denne verdien er ikke en gyldig Twig-mal. + Denne verdien er ikke en gyldig Twig-mal. + + + This file is not a valid video. + Denne filen er ikke en gyldig video. + + + The size of the video could not be detected. + Videostørrelsen kunne ikke oppdages. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Videobredden er for stor ({{ width }}px). Tillatt maksimal bredde er {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Videobredden er for liten ({{ width }}px). Forventet minimumsbredde er {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Videohøyden er for stor ({{ height }}px). Tillatt maksimal høyde er {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Videoens høyde er for liten ({{ height }}px). Forventet minstehøyde er {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Videoen har for få piksler ({{ pixels }}). Forventet minimum er {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Videoen har for mange piksler ({{ pixels }}). Forventet maksimalt antall er {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Video-forholdet er for stort ({{ ratio }}). Tillatt maksimalt forhold er {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Videoforholdet er for lite ({{ ratio }}). Forventet minimumsforhold er {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Videoen er kvadratisk ({{ width }}x{{ height }}px). Kvadratiske videoer er ikke tillatt. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Videoen er i liggende format ({{ width }}x{{ height }} px). Liggende videoer er ikke tillatt. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Videoen er i portrettformat ({{ width }}x{{ height }}px). Portrettvideoer er ikke tillatt. + + + The video file is corrupted. + Videofilen er ødelagt. + + + The video contains multiple streams. Only one stream is allowed. + Videoen inneholder flere strømmer. Kun én strøm er tillatt. + + + Unsupported video codec "{{ codec }}". + Ikke støttet videokodek «{{ codec }}». + + + Unsupported video container "{{ container }}". + Ikke-støttet videokontainer "{{ container }}". + + + The image file is corrupted. + Bildefilen er ødelagt. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Bildet har for få piksler ({{ pixels }}). Forventet minimum er {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Bildet har for mange piksler ({{ pixels }}). Forventet maksimalt antall er {{ max_pixels }}. + + + This filename does not match the expected charset. + Dette filnavnet samsvarer ikke med forventet tegnsett. diff --git a/Resources/translations/validators.nl.xlf b/Resources/translations/validators.nl.xlf index 1781b1f29..74bea6f48 100644 --- a/Resources/translations/validators.nl.xlf +++ b/Resources/translations/validators.nl.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Deze waarde is geen geldige Twig-template. + + This file is not a valid video. + Dit bestand is geen geldige video. + + + The size of the video could not be detected. + De grootte van de video kon niet worden gedetecteerd. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + De videobreedte is te groot ({{ width }}px). Toegestane maximale breedte is {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + De videobreedte is te klein ({{ width }}px). Verwachte minimum breedte is {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + De videohoogte is te groot ({{ height }}px). Toegestane maximale hoogte is {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + De videohoogte is te klein ({{ height }}px). Verwachte minimale hoogte is {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + De video heeft te weinig pixels ({{ pixels }}). Verwachte minimumaantal is {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + De video heeft te veel pixels ({{ pixels }}). Het verwachte maximum is {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + De videoratio is te groot ({{ ratio }}). Toegestane maximale ratio is {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + De videoratio is te klein ({{ ratio }}). Verwachte minimumverhouding is {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + De video is vierkant ({{ width }}x{{ height }}px). Vierkante video's zijn niet toegestaan. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + De video is in liggende oriëntatie ({{ width }}x{{ height }} px). Liggende video's zijn niet toegestaan. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + De video is in portretstand ({{ width }}x{{ height }}px). Video's in portretstand zijn niet toegestaan. + + + The video file is corrupted. + Het videobestand is beschadigd. + + + The video contains multiple streams. Only one stream is allowed. + De video bevat meerdere streams. Slechts één stream is toegestaan. + + + Unsupported video codec "{{ codec }}". + Niet-ondersteunde videocodec ‘{{ codec }}’. + + + Unsupported video container "{{ container }}". + Niet-ondersteunde videocontainer "{{ container }}". + + + The image file is corrupted. + Het afbeeldingsbestand is beschadigd. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + De afbeelding heeft te weinig pixels ({{ pixels }}). Verwachte minimumhoeveelheid is {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + De afbeelding heeft te veel pixels ({{ pixels }}). Het verwachte maximum is {{ max_pixels }}. + + + This filename does not match the expected charset. + Deze bestandsnaam komt niet overeen met de verwachte tekencodering. + diff --git a/Resources/translations/validators.nn.xlf b/Resources/translations/validators.nn.xlf index 74d332c06..16dbe2727 100644 --- a/Resources/translations/validators.nn.xlf +++ b/Resources/translations/validators.nn.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Denne verdien er ikkje ein gyldig Twig-mal. + + This file is not a valid video. + Denne fila er ikkje ein gyldig video. + + + The size of the video could not be detected. + Storleiken på videoen kunne ikkje oppdagast. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Videobreidda er for stor ({{ width }}px). Tillaten maksimal breidde er {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Videobreidda er for lita ({{ width }}px). Forventa minimumsbreidde er {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Videoen si høgd er for stor ({{ height }}px). Tillaten maksimal høgd er {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Videohøgda er for lita ({{ height }}px). Forventa minstehøgd er {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Videoen har for få pikslar ({{ pixels }}). Forventa minimum er {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Videoen har for mange pikslar ({{ pixels }}). Forventa maksimalt tal er {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Videoforholdet er for stort ({{ ratio }}). Tillaten maksimal forhold er {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Videoforholdet er for lite ({{ ratio }}). Forventa minimumsforhold er {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Videoen er kvadratisk ({{ width }}x{{ height }}px). Kvadratiske videoar er ikkje tillatne. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Videoen er i liggjande format ({{ width }}x{{ height }} px). Liggjande videoar er ikkje tillatne. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Videoen er i portrettformat ({{ width }}x{{ height }}px). Portrettvideoar er ikkje tillatne. + + + The video file is corrupted. + Videofila er skadd. + + + The video contains multiple streams. Only one stream is allowed. + Videoen inneheld fleire straumar. Berre éin straum er tillaten. + + + Unsupported video codec "{{ codec }}". + Ikkje støtta videokodek «{{ codec }}». + + + Unsupported video container "{{ container }}". + Ikkje-støtta videokontainer "{{ container }}". + + + The image file is corrupted. + Bildefila er skadd. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Biletet har for få pikslar ({{ pixels }}). Forventa minimum er {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Biletet har for mange pikslar ({{ pixels }}). Forventa maksimalt tal er {{ max_pixels }}. + + + This filename does not match the expected charset. + Dette filnamnet samsvarar ikkje med forventa teiknsett. + diff --git a/Resources/translations/validators.no.xlf b/Resources/translations/validators.no.xlf index 58696f671..11ce9777b 100644 --- a/Resources/translations/validators.no.xlf +++ b/Resources/translations/validators.no.xlf @@ -136,7 +136,7 @@ This value is not a valid IP address. - Denne verdien er ikke en gyldig IP-adresse. + Denne verdien er ikke en gyldig IP-adresse. This value is not a valid language. @@ -192,7 +192,7 @@ No temporary folder was configured in php.ini, or the configured folder does not exist. - Ingen midlertidig mappe ble konfigurert i php.ini, eller den konfigurerte mappen eksisterer ikke. + Ingen midlertidig mappe ble konfigurert i php.ini, eller den konfigurerte mappen eksisterer ikke. Cannot write temporary file to disk. @@ -224,7 +224,7 @@ This value is not a valid International Bank Account Number (IBAN). - Denne verdien er ikke et gyldig internasjonalt bankkontonummer (IBAN). + Denne verdien er ikke et gyldig internasjonalt bankkontonummer (IBAN). This value is not a valid ISBN-10. @@ -312,7 +312,7 @@ This value is not a valid Business Identifier Code (BIC). - Denne verdien er ikke en gyldig forretningsidentifikasjonskode (BIC). + Denne verdien er ikke en gyldig forretningsidentifikasjonskode (BIC). Error @@ -320,7 +320,7 @@ This value is not a valid UUID. - Denne verdien er ikke en gyldig UUID. + Denne verdien er ikke en gyldig UUID. This value should be a multiple of {{ compared_value }}. @@ -404,71 +404,155 @@ 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. - Filnavnet er for langt. Det bør ha {{ filename_max_length }} tegn eller mindre.|Filnavnet er for langt. Det bør ha {{ filename_max_length }} tegn eller mindre. + Filnavnet er for langt. Det bør ha {{ filename_max_length }} tegn eller mindre.|Filnavnet er for langt. Det bør ha {{ filename_max_length }} tegn eller mindre. The password strength is too low. Please use a stronger password. - Passordstyrken er for lav. Vennligst bruk et sterkere passord. + Passordstyrken er for lav. Vennligst bruk et sterkere passord. This value contains characters that are not allowed by the current restriction-level. - Denne verdien inneholder tegn som ikke er tillatt av gjeldende restriksjonsnivå. + Denne verdien inneholder tegn som ikke er tillatt av gjeldende restriksjonsnivå. Using invisible characters is not allowed. - Det er ikke tillatt å bruke usynlige tegn. + Det er ikke tillatt å bruke usynlige tegn. Mixing numbers from different scripts is not allowed. - Det er ikke tillatt å blande tall fra forskjellige skript. + Det er ikke tillatt å blande tall fra forskjellige skript. Using hidden overlay characters is not allowed. - Det er ikke tillatt å bruke skjulte overleggskarakterer. + Det er ikke tillatt å bruke skjulte overleggskarakterer. The extension of the file is invalid ({{ extension }}). Allowed extensions are {{ extensions }}. - Filutvidelsen er ugyldig ({{ extension }}). Tillatte utvidelser er {{ extensions }}. + Filutvidelsen er ugyldig ({{ extension }}). Tillatte utvidelser er {{ extensions }}. The detected character encoding is invalid ({{ detected }}). Allowed encodings are {{ encodings }}. - Den oppdagede tegnkodingen er ugyldig ({{ detected }}). Tillatte kodinger er {{ encodings }}. + Den oppdagede tegnkodingen er ugyldig ({{ detected }}). Tillatte kodinger er {{ encodings }}. This value is not a valid MAC address. - Denne verdien er ikke en gyldig MAC-adresse. + Denne verdien er ikke en gyldig MAC-adresse. This URL is missing a top-level domain. - Denne URL-en mangler et toppnivådomene. + Denne URL-en mangler et toppnivådomene. This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. - Denne verdien er for kort. Den bør inneholde minst ett ord.|Denne verdien er for kort. Den bør inneholde minst {{ min }} ord. + Denne verdien er for kort. Den bør inneholde minst ett ord.|Denne verdien er for kort. Den bør inneholde minst {{ min }} ord. This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. - Denne verdien er for lang. Den bør inneholde kun ett ord.|Denne verdien er for lang. Den bør inneholde {{ max }} ord eller færre. + Denne verdien er for lang. Den bør inneholde kun ett ord.|Denne verdien er for lang. Den bør inneholde {{ max }} ord eller færre. This value does not represent a valid week in the ISO 8601 format. - Denne verdien representerer ikke en gyldig uke i ISO 8601-formatet. + Denne verdien representerer ikke en gyldig uke i ISO 8601-formatet. This value is not a valid week. - Denne verdien er ikke en gyldig uke. + Denne verdien er ikke en gyldig uke. This value should not be before week "{{ min }}". - Denne verdien bør ikke være før uke "{{ min }}". + Denne verdien bør ikke være før uke "{{ min }}". This value should not be after week "{{ max }}". - Denne verdien bør ikke være etter uke "{{ max }}". + Denne verdien bør ikke være etter uke "{{ max }}". This value is not a valid Twig template. - Denne verdien er ikke en gyldig Twig-mal. + Denne verdien er ikke en gyldig Twig-mal. + + + This file is not a valid video. + Denne filen er ikke en gyldig video. + + + The size of the video could not be detected. + Videostørrelsen kunne ikke oppdages. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Videobredden er for stor ({{ width }}px). Tillatt maksimal bredde er {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Videobredden er for liten ({{ width }}px). Forventet minimumsbredde er {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Videohøyden er for stor ({{ height }}px). Tillatt maksimal høyde er {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Videoens høyde er for liten ({{ height }}px). Forventet minstehøyde er {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Videoen har for få piksler ({{ pixels }}). Forventet minimum er {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Videoen har for mange piksler ({{ pixels }}). Forventet maksimalt antall er {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Video-forholdet er for stort ({{ ratio }}). Tillatt maksimalt forhold er {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Videoforholdet er for lite ({{ ratio }}). Forventet minimumsforhold er {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Videoen er kvadratisk ({{ width }}x{{ height }}px). Kvadratiske videoer er ikke tillatt. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Videoen er i liggende format ({{ width }}x{{ height }} px). Liggende videoer er ikke tillatt. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Videoen er i portrettformat ({{ width }}x{{ height }}px). Portrettvideoer er ikke tillatt. + + + The video file is corrupted. + Videofilen er ødelagt. + + + The video contains multiple streams. Only one stream is allowed. + Videoen inneholder flere strømmer. Kun én strøm er tillatt. + + + Unsupported video codec "{{ codec }}". + Ikke støttet videokodek «{{ codec }}». + + + Unsupported video container "{{ container }}". + Ikke-støttet videokontainer "{{ container }}". + + + The image file is corrupted. + Bildefilen er ødelagt. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Bildet har for få piksler ({{ pixels }}). Forventet minimum er {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Bildet har for mange piksler ({{ pixels }}). Forventet maksimalt antall er {{ max_pixels }}. + + + This filename does not match the expected charset. + Dette filnavnet samsvarer ikke med forventet tegnsett. diff --git a/Resources/translations/validators.pl.xlf b/Resources/translations/validators.pl.xlf index 04fe2fc1f..8f329dcd4 100644 --- a/Resources/translations/validators.pl.xlf +++ b/Resources/translations/validators.pl.xlf @@ -448,7 +448,7 @@ This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. - Ta wartość jest zbyt długa. Powinna zawierać jedno słowo.|Ta wartość jest zbyt długa. Powinna zawierać {{ max }} słów lub mniej. + Ta wartość jest zbyt długa. Powinna zawierać jedno słowo.|Ta wartość jest zbyt długa. Powinna zawierać {{ max }} słowa lub mniej.|Ta wartość jest zbyt długa. Powinna zawierać {{ max }} słów lub mniej. This value does not represent a valid week in the ISO 8601 format. @@ -470,6 +470,90 @@ This value is not a valid Twig template. Ta wartość nie jest prawidłowym szablonem Twig. + + This file is not a valid video. + Ten plik nie jest prawidłowym plikiem wideo. + + + The size of the video could not be detected. + Nie można wykryć rozmiaru wideo. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Szerokość wideo jest zbyt duża ({{ width }}px). Maksymalna dopuszczalna szerokość to {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Szerokość wideo jest zbyt mała ({{ width }}px). Oczekiwana minimalna szerokość to {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Wysokość wideo jest zbyt duża ({{ height }}px). Maksymalna dopuszczalna wysokość to {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Wysokość wideo jest zbyt mała ({{ height }}px). Oczekiwana minimalna wysokość to {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Wideo ma zbyt mało ({{ pixels }} pikseli). Oczekiwana minimalna liczba to {{ min_pixels }} pikseli. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Wideo ma zbyt wiele ({{ pixels }} pikseli). Oczekiwana maksymalna liczba to {{ max_pixels }} pikseli. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Współczynnik proporcji wideo jest zbyt duży ({{ ratio }}). Maksymalny dopuszczalny współczynnik to {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Współczynnik proporcji wideo jest zbyt mały ({{ ratio }}). Oczekiwany minimalny współczynnik to {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Wideo jest w formacie kwadratowym ({{ width }}x{{ height }}px). Filmy w tym formacie są niedozwolone. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Wideo ma orientację poziomą ({{ width }}x{{ height }}px). Filmy w orientacji poziomej są niedozwolone. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Wideo ma orientację pionową ({{ width }}x{{ height }}px). Filmy w orientacji pionowej są niedozwolone. + + + The video file is corrupted. + Plik wideo jest uszkodzony. + + + The video contains multiple streams. Only one stream is allowed. + Wideo zawiera wiele strumieni. Dozwolony jest tylko jeden strumień. + + + Unsupported video codec "{{ codec }}". + Nieobsługiwany kodek wideo "{{ codec }}". + + + Unsupported video container "{{ container }}". + Nieobsługiwany kontener wideo "{{ container }}". + + + The image file is corrupted. + Plik obrazu jest uszkodzony. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Obraz ma zbyt mało ({{ pixels }} pikseli). Oczekiwana minimalna liczba to {{ min_pixels }} pikseli. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Obraz ma zbyt wiele ({{ pixels }} pikseli). Oczekiwana maksymalna liczba to {{ max_pixels }} pikseli. + + + This filename does not match the expected charset. + Ta nazwa pliku nie odpowiada oczekiwanemu zestawowi znaków. + diff --git a/Resources/translations/validators.pt.xlf b/Resources/translations/validators.pt.xlf index b6562dbfe..62c3c5fc2 100644 --- a/Resources/translations/validators.pt.xlf +++ b/Resources/translations/validators.pt.xlf @@ -468,7 +468,91 @@ This value is not a valid Twig template. - Este valor não é um modelo Twig válido. + Este valor não é um modelo Twig válido. + + + This file is not a valid video. + Este ficheiro não é um vídeo válido. + + + The size of the video could not be detected. + Não foi possível detetar o tamanho do vídeo. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + A largura do vídeo é demasiado grande ({{ width }}px). A largura máxima permitida é {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + A largura do vídeo é muito pequena ({{ width }}px). A largura mínima esperada é {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + A altura do vídeo é demasiado grande ({{ height }}px). A altura máxima permitida é {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + A altura do vídeo é muito pequena ({{ height }}px). A altura mínima esperada é {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + O vídeo tem poucos píxeis ({{ pixels }}). A quantidade mínima esperada é {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + O vídeo tem píxeis a mais ({{ pixels }}). A quantidade máxima esperada é {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + A proporção do vídeo é muito grande ({{ ratio }}). A proporção máxima permitida é {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + A proporção do vídeo é muito pequena ({{ ratio }}). A proporção mínima esperada é {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + O vídeo é quadrado ({{ width }}x{{ height }}px). Vídeos quadrados não são permitidos. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + O vídeo está em modo paisagem ({{ width }}x{{ height }} px). Vídeos em paisagem não são permitidos. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + O vídeo está em orientação vertical ({{ width }}x{{ height }}px). Vídeos em orientação vertical não são permitidos. + + + The video file is corrupted. + O ficheiro de vídeo está corrompido. + + + The video contains multiple streams. Only one stream is allowed. + O vídeo contém vários fluxos. É permitido apenas um fluxo. + + + Unsupported video codec "{{ codec }}". + Codec de vídeo não suportado «{{ codec }}». + + + Unsupported video container "{{ container }}". + Contentor de vídeo não suportado "{{ container }}". + + + The image file is corrupted. + O ficheiro de imagem está corrompido. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + A imagem tem píxeis a menos ({{ pixels }}). A quantidade mínima esperada é {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + A imagem tem píxeis a mais ({{ pixels }}). A quantidade máxima esperada é {{ max_pixels }}. + + + This filename does not match the expected charset. + Este nome de ficheiro não corresponde ao conjunto de caracteres esperado. diff --git a/Resources/translations/validators.pt_BR.xlf b/Resources/translations/validators.pt_BR.xlf index 0acf6dbf2..0d3a30c6c 100644 --- a/Resources/translations/validators.pt_BR.xlf +++ b/Resources/translations/validators.pt_BR.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Este valor não é um modelo Twig válido. + + This file is not a valid video. + Este arquivo não é um vídeo válido. + + + The size of the video could not be detected. + Não foi possível detectar o tamanho do vídeo. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + A largura do vídeo é muito grande ({{ width }}px). A largura máxima permitida é {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + A largura do vídeo é muito pequena ({{ width }}px). A largura mínima esperada é {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + A altura do vídeo é muito grande ({{ height }}px). A altura máxima permitida é {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + A altura do vídeo é muito pequena ({{ height }}px). A altura mínima esperada é {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + O vídeo tem poucos pixels ({{ pixels }}). A quantidade mínima esperada é {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + O vídeo tem pixels demais ({{ pixels }}). A quantidade máxima esperada é {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + A proporção do vídeo é muito grande ({{ ratio }}). A proporção máxima permitida é {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + A proporção do vídeo é muito pequena ({{ ratio }}). A proporção mínima esperada é {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + O vídeo é quadrado ({{ width }}x{{ height }}px). Vídeos quadrados não são permitidos. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + O vídeo está no modo paisagem ({{ width }}x{{ height }} px). Vídeos em paisagem não são permitidos. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + O vídeo está em orientação vertical ({{ width }}x{{ height }}px). Vídeos em orientação vertical não são permitidos. + + + The video file is corrupted. + O arquivo de vídeo está corrompido. + + + The video contains multiple streams. Only one stream is allowed. + O vídeo contém múltiplos fluxos. Apenas um fluxo é permitido. + + + Unsupported video codec "{{ codec }}". + Codec de vídeo não suportado «{{ codec }}». + + + Unsupported video container "{{ container }}". + Contêiner de vídeo não suportado "{{ container }}". + + + The image file is corrupted. + O arquivo de imagem está corrompido. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + A imagem tem pixels de menos ({{ pixels }}). A quantidade mínima esperada é {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + A imagem tem pixels demais ({{ pixels }}). A quantidade máxima esperada é {{ max_pixels }}. + + + This filename does not match the expected charset. + Este nome de arquivo não corresponde ao conjunto de caracteres esperado. + diff --git a/Resources/translations/validators.ro.xlf b/Resources/translations/validators.ro.xlf index d6c3b4fb8..e4e27570a 100644 --- a/Resources/translations/validators.ro.xlf +++ b/Resources/translations/validators.ro.xlf @@ -4,11 +4,11 @@ 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. diff --git a/Resources/translations/validators.ru.xlf b/Resources/translations/validators.ru.xlf index 727ae0aef..5392515de 100644 --- a/Resources/translations/validators.ru.xlf +++ b/Resources/translations/validators.ru.xlf @@ -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. + Видео содержит несколько потоков. Разрешён только один поток. + + + 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. + Это имя файла не соответствует ожидаемой кодировке. + diff --git a/Resources/translations/validators.sk.xlf b/Resources/translations/validators.sk.xlf index bba3c291a..e79521321 100644 --- a/Resources/translations/validators.sk.xlf +++ b/Resources/translations/validators.sk.xlf @@ -136,7 +136,7 @@ This value is not a valid IP address. - Táto hodnota nie je platná IP adresa. + Táto hodnota nie je platná IP adresa. This value is not a valid language. @@ -468,7 +468,91 @@ This value is not a valid Twig template. - Táto hodnota nie je platná šablóna Twig. + Táto hodnota nie je platnou Twig šablónou. + + + This file is not a valid video. + Tento súbor nie je platné video. + + + The size of the video could not be detected. + Veľkosť videa sa nepodarilo zistiť. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Šírka videa je príliš veľká ({{ width }}px). Povolená maximálna šírka je {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Šírka videa je príliš malá ({{ width }}px). Očakávaná minimálna šírka je {{ min_width }} px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Výška videa je príliš veľká ({{ height }}px). Povolená maximálna výška je {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Výška videa je príliš malá ({{ height }}px). Očakávaná minimálna výška je {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Video má príliš málo pixelov ({{ pixels }}). Očakávané minimálne množstvo je {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Video má príliš veľa pixelov ({{ pixels }}). Očakávané maximálne množstvo je {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Pomer strán videa je príliš veľký ({{ ratio }}). Povolený maximálny pomer strán je {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Pomer strán videa je príliš malý ({{ ratio }}). Očakávaný minimálny pomer strán je {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Video je štvorcové ({{ width }}x{{ height }}px). Štvorcové videá nie sú povolené. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Video je orientované na šírku ({{ width }}x{{ height }} px). Videá orientované na šírku nie sú povolené. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Video je orientované na výšku ({{ width }}x{{ height }}px). Videá orientované na výšku nie sú povolené. + + + The video file is corrupted. + Videosúbor je poškodený. + + + The video contains multiple streams. Only one stream is allowed. + Video obsahuje viacero tokov. Povolený je len jeden tok. + + + Unsupported video codec "{{ codec }}". + Nepodporovaný videokodek "{{ codec }}". + + + Unsupported video container "{{ container }}". + Nepodporovaný kontajner videa "{{ container }}". + + + The image file is corrupted. + Súbor obrázka je poškodený. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Obrázok má príliš málo pixelov ({{ pixels }}). Očakávané minimálne množstvo je {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Obrázok má príliš veľa pixelov ({{ pixels }}). Očakávané maximálne množstvo je {{ max_pixels }}. + + + This filename does not match the expected charset. + Tento názov súboru nezodpovedá očakávanej znakovej sade. diff --git a/Resources/translations/validators.sl.xlf b/Resources/translations/validators.sl.xlf index 28c370e09..515e5d0aa 100644 --- a/Resources/translations/validators.sl.xlf +++ b/Resources/translations/validators.sl.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Ta vrednost ni veljavna predloga Twig. + + This file is not a valid video. + Ta datoteka ni veljaven video. + + + The size of the video could not be detected. + Velikosti videoposnetka ni bilo mogoče zaznati. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Širina videoposnetka je prevelika ({{ width }}px). Dovoljena največja širina je {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Širina videa je premajhna ({{ width }}px). Pričakovana minimalna širina je {{ min_width }} px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Višina videa je prevelika ({{ height }}px). Dovoljena največja višina je {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Višina videa je premajhna ({{ height }}px). Pričakovana najmanjša višina je {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Video ima premalo slikovnih pik ({{ pixels }}). Pričakovana minimalna količina je {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Video ima preveč slikovnih pik ({{ pixels }}). Pričakovano največje število je {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Razmerje videa je preveliko ({{ ratio }}). Dovoljeno največje razmerje je {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Razmerje videa je premajhno ({{ ratio }}). Pričakovano minimalno razmerje je {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Video je kvadratno ({{ width }}x{{ height }}px). Kvadratni videoposnetki niso dovoljeni. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Video je vodoravno orientiran ({{ width }}x{{ height }} px). Vodoravni videi niso dovoljeni. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Video je usmerjeno pokonci ({{ width }}x{{ height }}px). Videi v pokončni usmeritvi niso dovoljeni. + + + The video file is corrupted. + Videodatoteka je poškodovana. + + + The video contains multiple streams. Only one stream is allowed. + Video vsebuje več tokov. Dovoljen je le en tok. + + + Unsupported video codec "{{ codec }}". + Nepodprti video kodek »{{ codec }}«. + + + Unsupported video container "{{ container }}". + Nepodprt videokontejner "{{ container }}". + + + The image file is corrupted. + Slikovna datoteka je poškodovana. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Slika ima premalo slikovnih točk ({{ pixels }}). Pričakovana minimalna količina je {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Slika ima preveč slikovnih pik ({{ pixels }}). Pričakovano največje število je {{ max_pixels }}. + + + This filename does not match the expected charset. + To ime datoteke ne ustreza pričakovanemu naboru znakov. + diff --git a/Resources/translations/validators.sq.xlf b/Resources/translations/validators.sq.xlf index 7d044b8fc..0561705a6 100644 --- a/Resources/translations/validators.sq.xlf +++ b/Resources/translations/validators.sq.xlf @@ -61,23 +61,23 @@ This value is not a valid email address. - Kjo vlerë nuk është adresë email-i e vlefshme. + Kjo vlerë nuk është email adresë e vlefshme. The file could not be found. - Skeda nuk u gjet. + Fajli nuk u gjet. The file is not readable. - Skeda nuk është e lexueshme. + Fajli nuk është e lexueshme. The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. - Skeda është shumë e madhe ({{ size }} {{ suffix }}). Madhësia maksimale e lejuar është {{ limit }} {{ suffix }}. + Fajli është shumë e madhe ({{ size }} {{ suffix }}). Madhësia maksimale e lejuar është {{ limit }} {{ suffix }}. The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. - Lloji “mime” i skedës është i pavlefshëm ({{ type }}). Llojet “mime” të lejuara janë {{ types }}. + Lloji “mime” i fajlit është i pavlefshëm ({{ type }}). Llojet “mime” të lejuara janë {{ types }}. This value should be {{ limit }} or less. @@ -125,15 +125,15 @@ The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. - Kjo skedë është shumë e madhe. Madhësia maksimale e lejuar është {{ limit }} {{ suffix }}. + Ky fajl është shumë i madhë. Madhësia maksimale e lejuar është {{ limit }} {{ suffix }}. The file is too large. - Kjo skedë është shumë e madhe. + Ky fajl është shumë i madhë. The file could not be uploaded. - Kjo skedë nuk mund të ngarkohet. + Ky fajl nuk mund të ngarkohet. This value should be a valid number. @@ -141,7 +141,7 @@ This file is not a valid image. - Kjo skedë nuk është një imazh i vlefshëm. + Ky fajl nuk është një imazh i vlefshëm. This value is not a valid IP address. @@ -193,19 +193,19 @@ The file was only partially uploaded. - Kjo skedë është ngarkuar pjesërisht. + Ky fajl është ngarkuar pjesërisht. No file was uploaded. - Nuk është ngarkuar ndonjë skedë. + Nuk është ngarkuar ndonjë fajl. No temporary folder was configured in php.ini, or the configured folder does not exist. - Nuk është konfiguruar asnjë skedar i përkohshëm në php.ini, ose skedari i konfiguruar nuk ekziston. + Nuk është konfiguruar asnjë dosje e përkohshëm në php.ini, ose dosja e konfiguruar nuk ekziston. Cannot write temporary file to disk. - Nuk mund të shkruhet skeda e përkohshme në disk. + Nuk mund të shkruhet fajli e përkohshme në disk. A PHP extension caused the upload to fail. @@ -229,7 +229,7 @@ Unsupported card type or invalid card number. - Lloj karte i papranuar ose numër karte i pavlefshëm. + Lloji i kartës i papërkrahur ose numër kartës i pavlefshëm. This value is not a valid International Bank Account Number (IBAN). @@ -309,7 +309,7 @@ An empty file is not allowed. - Një skedë e zbrazët nuk lejohet. + Një fajl i zbrazët nuk lejohet. The host could not be resolved. @@ -413,7 +413,7 @@ 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. - Emri i skedës është shumë i gjatë. Duhet të ketë maksimumi {{ filename_max_length }} karakter ose më pak.|Emri i skedës është shumë i gjatë. Duhet të ketë maksimumi {{ filename_max_length }} karaktere ose më pak. + Emri i fajlit është shumë i gjatë. Duhet të ketë maksimumi {{ filename_max_length }} karakter ose më pak.|Emri i fajlit është shumë i gjatë. Duhet të ketë maksimumi {{ filename_max_length }} karaktere ose më pak. The password strength is too low. Please use a stronger password. @@ -437,7 +437,7 @@ The extension of the file is invalid ({{ extension }}). Allowed extensions are {{ extensions }}. - Shtesa e skedarit është e pavlefshme ({{ extension }}). Shtesat e lejuara janë {{ extensions }}. + Shtesa e fajlit është e pavlefshme ({{ extension }}). Shtesat e lejuara janë {{ extensions }}. The detected character encoding is invalid ({{ detected }}). Allowed encodings are {{ encodings }}. @@ -479,6 +479,90 @@ This value is not a valid Twig template. Kjo vlerë nuk është një shabllon Twig i vlefshëm. + + This file is not a valid video. + Ky fajl nuk është video e vlefshme. + + + The size of the video could not be detected. + Madhësia e videos nuk mund të zbulohej. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Gjerësia e videos është shumë e madhe ({{ width }}px). Gjerësia maksimale e lejuar është {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Gjerësia e videos është shumë e vogël ({{ width }}px). Gjerësia minimale e pritur është {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Lartësia e videos është shumë e madhe ({{ height }}px). Lartësia maksimale e lejuar është {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Lartësia e videos është shumë e vogël ({{ height }}px). Lartësia minimale e pritur është {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Video ka shumë pak pikselë ({{ pixels }}). Sasia minimale e pritur është {{ min_pixels }}px. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Videoja ka tepër piksele ({{ pixels }}). Sasia maksimale e pritur është {{ max_pixels }}px. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Raporti i videos është shumë i madh ({{ ratio }}). Raporti maksimal i lejuar është {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Raporti i videos është shumë i vogël ({{ ratio }}). Raporti minimal i pritur është {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Videoja është katrore ({{ width }}x{{ height }}px). Videot katrore nuk lejohen. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Videoja është me orientim horizontal ({{ width }}x{{ height }}px). Videot horizontale nuk lejohen. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Videoja është me orientim portret ({{ width }}x{{ height }}px). Videot me orientim portret nuk lejohen. + + + The video file is corrupted. + Fajli i videos është i korruptuar. + + + The video contains multiple streams. Only one stream is allowed. + Videoja përmban disa rrjedha. Lejohet vetëm një rrjedhë. + + + Unsupported video codec "{{ codec }}". + Kodeku videos është i pambështetur „{{ codec }}“. + + + Unsupported video container "{{ container }}". + Kontejneri videos është i pambështetur "{{ container }}". + + + The image file is corrupted. + Fajli i imazhit është korruptuar. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Imazhi ka shumë pak pikselë ({{ pixels }}). Sasia minimale e pritur është {{ min_pixels }}px. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Imazhi ka shumë pikselë ({{ pixels }}). Shuma maksimale e pritur është {{ max_pixels }}px. + + + This filename does not match the expected charset. + Ky emër fajlit nuk përputhet me grupin e pritur të karaktereve. + diff --git a/Resources/translations/validators.sr_Cyrl.xlf b/Resources/translations/validators.sr_Cyrl.xlf index 61040270a..987474063 100644 --- a/Resources/translations/validators.sr_Cyrl.xlf +++ b/Resources/translations/validators.sr_Cyrl.xlf @@ -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. + Видео садржи више токова. Дозвољен је само један ток. + + + 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. + Ово име датотеке не одговара очекиваном скупу знакова. + diff --git a/Resources/translations/validators.sr_Latn.xlf b/Resources/translations/validators.sr_Latn.xlf index be7ede713..9fac3a261 100644 --- a/Resources/translations/validators.sr_Latn.xlf +++ b/Resources/translations/validators.sr_Latn.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Ova vrednost nije važeći Twig šablon. + + This file is not a valid video. + Ova datoteka nije važeći video. + + + The size of the video could not be detected. + Nije bilo moguće utvrditi veličinu video snimka. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Širina videa je prevelika ({{ width }}px). Dozvoljena maksimalna širina je {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Širina videa je previše mala ({{ width }}px). Očekivana minimalna širina je {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Visina videa je prevelika ({{ height }}px). Dozvoljena maksimalna visina je {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Visina videa je premala ({{ height }}px). Očekivana minimalna visina je {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Video ima premalo piksela ({{ pixels }}). Očekivana minimalna količina je {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Video ima previše piksela ({{ pixels }}). Očekivana maksimalna količina je {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Odnos slike videa je prevelik ({{ ratio }}). Dozvoljeni maksimalni odnos je {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Odnos stranica videa je previše mali ({{ ratio }}). Očekivani minimalni odnos je {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Video je kvadratnog oblika ({{ width }}x{{ height }}px). Kvadratni video zapisi nisu dozvoljeni. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Video je u vodoravnoj orijentaciji ({{ width }}x{{ height }} px). Vodoravni video zapisi nisu dozvoljeni. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Video je u portret orijentaciji ({{ width }}x{{ height }}px). Video zapisi u portret orijentaciji nisu dozvoljeni. + + + The video file is corrupted. + Video datoteka je oštećena. + + + The video contains multiple streams. Only one stream is allowed. + Video sadrži više tokova. Dozvoljen je samo jedan tok. + + + Unsupported video codec "{{ codec }}". + Nepodržan video kodek „{{ codec }}“. + + + Unsupported video container "{{ container }}". + Nepodržan video kontejner "{{ container }}". + + + The image file is corrupted. + Datoteka slike je oštećena. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Slika ima premalo piksela ({{ pixels }}). Očekivani minimalni broj je {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Slika ima previše piksela ({{ pixels }}). Očekivani maksimalni broj je {{ max_pixels }}. + + + This filename does not match the expected charset. + Ovo ime datoteke ne odgovara očekivanom skupu znakova. + diff --git a/Resources/translations/validators.sv.xlf b/Resources/translations/validators.sv.xlf index 692ac7f52..1c18cf108 100644 --- a/Resources/translations/validators.sv.xlf +++ b/Resources/translations/validators.sv.xlf @@ -440,35 +440,119 @@ This URL is missing a top-level domain. - Denna URL saknar en toppdomän. + Denna URL saknar en toppdomän. This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. - Det här värdet är för kort. Det ska innehålla minst ett ord.|Det här värdet är för kort. Det ska innehålla minst {{ min }} ord. + Det här värdet är för kort. Det ska innehålla minst ett ord.|Det här värdet är för kort. Det ska innehålla minst {{ min }} ord. This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. - Det här värdet är för långt. Det ska innehålla endast ett ord.|Det här värdet är för långt. Det ska innehålla {{ max }} ord eller färre. + Det här värdet är för långt. Det ska innehålla endast ett ord.|Det här värdet är för långt. Det ska innehålla {{ max }} ord eller färre. This value does not represent a valid week in the ISO 8601 format. - Det här värdet representerar inte en giltig vecka i ISO 8601-formatet. + Det här värdet representerar inte en giltig vecka i ISO 8601-formatet. This value is not a valid week. - Det här värdet är inte en giltig vecka. + Det här värdet är inte en giltig vecka. This value should not be before week "{{ min }}". - Det här värdet bör inte vara före vecka "{{ min }}". + Det här värdet bör inte vara före vecka "{{ min }}". This value should not be after week "{{ max }}". - Det här värdet bör inte vara efter vecka "{{ max }}". + Det här värdet bör inte vara efter vecka "{{ max }}". This value is not a valid Twig template. - Det här värdet är inte en giltig Twig-mall. + Det här värdet är inte en giltig Twig-mall. + + + This file is not a valid video. + Den här filen är inte en giltig video. + + + The size of the video could not be detected. + Videons storlek kunde inte upptäckas. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Videobredden är för stor ({{ width }}px). Tillåten maximal bredd är {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Videobredden är för liten ({{ width }}px). Förväntad minsta bredd är {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Videons höjd är för stor ({{ height }}px). Tillåten maximal höjd är {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Videohöjden är för liten ({{ height }}px). Förväntad minimihöjd är {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Videon har för få pixlar ({{ pixels }}). Förväntad miniminivå är {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Videon har för många pixlar ({{ pixels }}). Förväntat maxantal är {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Videons förhållande är för stort ({{ ratio }}). Tillåtet maxförhållande är {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Videoförhållandet är för litet ({{ ratio }}). Förväntat minimiförhållande är {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Videon är kvadratisk ({{ width }}x{{ height }}px). Kvadratiska videor är inte tillåtna. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Videon är i liggande läge ({{ width }}x{{ height }}px). Liggande videor är inte tillåtna. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Videon är i porträttläge ({{ width }}x{{ height }}px). Videor i porträttläge är inte tillåtna. + + + The video file is corrupted. + Videofilen är skadad. + + + The video contains multiple streams. Only one stream is allowed. + Videon innehåller flera strömmar. Endast en ström är tillåten. + + + Unsupported video codec "{{ codec }}". + Videokodek stöds inte "{{ codec }}". + + + Unsupported video container "{{ container }}". + Videokontainer stöds inte "{{ container }}". + + + The image file is corrupted. + Bildfilen är skadad. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Bilden har för få pixlar ({{ pixels }}). Förväntat minimiantal är {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Bilden har för många pixlar ({{ pixels }}). Förväntat maxantal är {{ max_pixels }}. + + + This filename does not match the expected charset. + Detta filnamn stämmer inte med förväntad teckenuppsättning. diff --git a/Resources/translations/validators.th.xlf b/Resources/translations/validators.th.xlf index 75398a0b8..f9db27cb7 100644 --- a/Resources/translations/validators.th.xlf +++ b/Resources/translations/validators.th.xlf @@ -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 }} พิกเซล). ไม่อนุญาตวิดีโอแนวนอน + + + 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. + ชื่อไฟล์นี้ไม่ตรงกับชุดอักขระที่คาดไว้. + diff --git a/Resources/translations/validators.tl.xlf b/Resources/translations/validators.tl.xlf index 729ebc9da..7a25e79ea 100644 --- a/Resources/translations/validators.tl.xlf +++ b/Resources/translations/validators.tl.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Ang halagang ito ay hindi isang balidong Twig template. + + This file is not a valid video. + Ang file na ito ay hindi isang wastong video. + + + The size of the video could not be detected. + Hindi matukoy ang laki ng video. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Masyadong malaki ang lapad ng video ({{ width }}px). Ang pinahihintulutang pinakamaksimum na lapad ay {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Masyadong maliit ang lapad ng video ({{ width }}px). Inaasahang minimum na lapad ay {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Sobrang taas ng video ({{ height }}px). Ang pinapahintulutang pinakamataas na taas ay {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Masyadong maliit ang taas ng video ({{ height }}px). Inaasahang pinakamababang taas ay {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Ang video ay may masyadong kaunting pixel ({{ pixels }}). Ang inaasahang pinakamababang dami ay {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Ang video ay may masyadong maraming pixel ({{ pixels }}). Ang inaasahang pinakamataas na bilang ay {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Masyadong malaki ang ratio ng video ({{ ratio }}). Ang pinahihintulutang pinakamataas na ratio ay {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Masyadong maliit ang ratio ng video ({{ ratio }}). Ang inaasahang minimum na ratio ay {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Ang video ay parisukat ({{ width }}x{{ height }}px). Hindi pinapayagan ang mga parisukat na video. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Ang video ay nasa landscape na oryentasyon ({{ width }}x{{ height }} px). Hindi pinapayagan ang mga landscape na video. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Ang video ay naka-portrait ({{ width }}x{{ height }}px). Hindi pinapayagan ang mga video na naka-portrait. + + + The video file is corrupted. + Sira ang file ng video. + + + The video contains multiple streams. Only one stream is allowed. + May ilang stream ang video. Isa lamang na stream ang pinapayagan. + + + Unsupported video codec "{{ codec }}". + Hindi suportadong video codec "{{ codec }}". + + + Unsupported video container "{{ container }}". + Hindi suportadong lalagyan ng video "{{ container }}". + + + The image file is corrupted. + Ang file ng larawan ay sira. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Masyadong kaunti ang pixel ng larawan ({{ pixels }}). Ang inaasahang pinakamababang dami ay {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Ang larawan ay may sobrang daming pixel ({{ pixels }}). Ang inaasahang pinakamataas na dami ay {{ max_pixels }}. + + + This filename does not match the expected charset. + Ang pangalan ng file na ito ay hindi tumutugma sa inaasahang hanay ng mga character. + diff --git a/Resources/translations/validators.tr.xlf b/Resources/translations/validators.tr.xlf index 42c4bbd91..95c1bbbea 100644 --- a/Resources/translations/validators.tr.xlf +++ b/Resources/translations/validators.tr.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Bu değer geçerli bir Twig şablonu olarak kabul edilmiyor. + + This file is not a valid video. + Bu dosya geçerli bir video dosyası değil. + + + The size of the video could not be detected. + Videonun boyutu tespit edilemedi. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Video genişliği çok büyük ({{ width }}px). İzin verilen maksimum genişlik {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Video genişliği çok küçük ({{ width }}px). Beklenen minimum genişlik {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Video yüksekliği çok büyük ({{ height }}px). İzin verilen maksimum yükseklik {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Video yüksekliği çok küçük ({{ height }}px). Beklenen minimum yükseklik {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Videodaki piksel sayısı çok az ({{ pixels }} piksel). Beklenen minimum miktar {{ min_pixels }} pikseldir. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Videodaki piksel sayısı çok fazla ({{ pixels }} piksel). Beklenen maksimum miktar {{ max_pixels }} pikseldir. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Video oranı çok büyük ({{ ratio }}). İzin verilen maksimum oran {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Video oranı çok küçük ({{ ratio }}). Beklenen minimum oran {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Video kare biçimde ({{ width }}x{{ height }}px). Kare videolara izin verilmez. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Video yatay biçimde ({{ width }}x{{ height }}px). Yatay videolara izin verilmez. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Video dikey biçimde ({{ width }}x{{ height }}px). Dikey videolara izin verilmez. + + + The video file is corrupted. + Video dosyası bozuk. + + + The video contains multiple streams. Only one stream is allowed. + Video birden fazla akış içeriyor. Yalnızca tek akışa izin verilir. + + + Unsupported video codec "{{ codec }}". + Desteklenmeyen video codec'i "{{ codec }}". + + + Unsupported video container "{{ container }}". + Desteklenmeyen video kapsayıcısı "{{ container }}". + + + The image file is corrupted. + Görüntü dosyası bozulmuş. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Görüntüdeki piksel sayısı çok az ({{ pixels }}). Beklenen minimum miktar {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Görüntüdeki piksel sayısı çok fazla ({{ pixels }}). Beklenen maksimum miktar {{ max_pixels }}. + + + This filename does not match the expected charset. + Bu dosya adı beklenen karakter kümesiyle eşleşmiyor. + diff --git a/Resources/translations/validators.uk.xlf b/Resources/translations/validators.uk.xlf index 5f132bc77..587301575 100644 --- a/Resources/translations/validators.uk.xlf +++ b/Resources/translations/validators.uk.xlf @@ -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 }}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. + Відеофайл містить кілька потоків. Дозволено лише один потік. + + + 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. + Назва файлу не відповідає очікуваному набору символів. diff --git a/Resources/translations/validators.ur.xlf b/Resources/translations/validators.ur.xlf index f13aafb43..18e5a0efd 100644 --- a/Resources/translations/validators.ur.xlf +++ b/Resources/translations/validators.ur.xlf @@ -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 }} پکسل ہے۔ + + + 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. + اس فائل کا نام متوقع حرفوں کے مجموعے سے مطابقت نہیں رکھتا۔ + diff --git a/Resources/translations/validators.uz.xlf b/Resources/translations/validators.uz.xlf index fe0b49f71..f86216abb 100644 --- a/Resources/translations/validators.uz.xlf +++ b/Resources/translations/validators.uz.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Bu qiymat yaroqli Twig shabloni emas. + + This file is not a valid video. + Ushbu fayl yaroqli video emas. + + + The size of the video could not be detected. + Videoning hajmini aniqlab bo‘lmadi. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Video kengligi juda katta ({{ width }}px). Ruxsat etilgan maksimal kenglik {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Video kengligi juda kichik ({{ width }}px). Kutilayotgan minimal kenglik {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Video balandligi juda katta ({{ height }}px). Ruxsat etilgan maksimal balandlik {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Video balandligi juda kichik ({{ height }}px). Kutilayotgan minimal balandlik {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Videoda piksellar soni juda kam ({{ pixels }}). Kutilgan minimal miqdor {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Videoda juda ko‘p piksellar bor ({{ pixels }}). Kutilayotgan maksimal miqdor {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Video nisbati juda katta ({{ ratio }}). Ruxsat etilgan maksimal nisbat {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Video nisbati juda kichik ({{ ratio }}). Kutilayotgan minimal nisbat {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Video kvadrat ({{ width }}x{{ height }}px). Kvadrat videolarga ruxsat berilmaydi. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Video gorizontal yo‘nalishda ({{ width }}x{{ height }} px). Gorizontal videolarga ruxsat berilmaydi. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Video portret yoʻnalishda ({{ width }}x{{ height }}px). Portret yoʻnalishidagi videolarga ruxsat berilmaydi. + + + The video file is corrupted. + Video fayli buzilgan. + + + The video contains multiple streams. Only one stream is allowed. + Videoda bir nechta oqim mavjud. Faqat bitta oqimga ruxsat beriladi. + + + Unsupported video codec "{{ codec }}". + Qo‘llab-quvvatlanmaydigan video kodek "{{ codec }}". + + + Unsupported video container "{{ container }}". + Qo'llab-quvvatlanmaydigan video konteyner "{{ container }}". + + + The image file is corrupted. + Rasm fayli buzilgan. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Tasvirda piksellar juda kam ({{ pixels }}). Kutilayotgan minimal miqdor {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Tasvirda juda ko‘p piksel bor ({{ pixels }}). Kutilayotgan maksimal miqdor {{ max_pixels }}. + + + This filename does not match the expected charset. + Bu fayl nomi kutilgan belgi to‘plamiga mos kelmaydi. + diff --git a/Resources/translations/validators.vi.xlf b/Resources/translations/validators.vi.xlf index 9daa4fe8a..a7ac211a7 100644 --- a/Resources/translations/validators.vi.xlf +++ b/Resources/translations/validators.vi.xlf @@ -470,6 +470,90 @@ This value is not a valid Twig template. Giá trị này không phải là một mẫu Twig hợp lệ. + + This file is not a valid video. + Tệp này không phải là video hợp lệ. + + + The size of the video could not be detected. + Không thể phát hiện kích thước của video. + + + The video width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Chiều rộng video quá lớn ({{ width }}px). Chiều rộng tối đa cho phép là {{ max_width }}px. + + + The video width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Chiều rộng video quá nhỏ ({{ width }}px). Chiều rộng tối thiểu mong đợi là {{ min_width }}px. + + + The video height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Chiều cao video quá lớn ({{ height }}px). Chiều cao tối đa cho phép là {{ max_height }}px. + + + The video height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Chiều cao video quá nhỏ ({{ height }}px). Chiều cao tối thiểu dự kiến là {{ min_height }}px. + + + The video has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Video có quá ít điểm ảnh ({{ pixels }}). Lượng tối thiểu mong đợi là {{ min_pixels }}. + + + The video has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Video có quá nhiều điểm ảnh ({{ pixels }}). Số lượng tối đa dự kiến là {{ max_pixels }}. + + + The video ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Tỉ lệ video quá lớn ({{ ratio }}). Tỉ lệ tối đa được phép là {{ max_ratio }}. + + + The video ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Tỉ lệ video quá nhỏ ({{ ratio }}). Tỉ lệ tối thiểu dự kiến là {{ min_ratio }}. + + + The video is square ({{ width }}x{{ height }}px). Square videos are not allowed. + Video có dạng hình vuông ({{ width }}x{{ height }}px). Không cho phép video hình vuông. + + + The video is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented videos are not allowed. + Video có hướng ngang ({{ width }}x{{ height }} px). Không cho phép video ngang. + + + The video is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented videos are not allowed. + Video có hướng dọc ({{ width }}x{{ height }}px). Không cho phép video hướng dọc. + + + The video file is corrupted. + Tệp video bị hỏng. + + + The video contains multiple streams. Only one stream is allowed. + Video chứa nhiều luồng. Chỉ cho phép một luồng. + + + Unsupported video codec "{{ codec }}". + Bộ mã hóa video không được hỗ trợ "{{ codec }}". + + + Unsupported video container "{{ container }}". + Bộ chứa video không được hỗ trợ "{{ container }}". + + + The image file is corrupted. + Tệp hình ảnh bị hỏng. + + + The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels. + Hình ảnh có quá ít điểm ảnh ({{ pixels }}). Số lượng tối thiểu dự kiến là {{ min_pixels }}. + + + The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels. + Hình ảnh có quá nhiều điểm ảnh ({{ pixels }}). Lượng tối đa dự kiến là {{ max_pixels }}. + + + This filename does not match the expected charset. + Tên tệp này không khớp với bộ ký tự mong đợi. + diff --git a/Resources/translations/validators.zh_CN.xlf b/Resources/translations/validators.zh_CN.xlf index c570d936f..70f2a34c0 100644 --- a/Resources/translations/validators.zh_CN.xlf +++ b/Resources/translations/validators.zh_CN.xlf @@ -4,23 +4,23 @@ 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. + 该文件名与预期的字符集不匹配。 diff --git a/Resources/translations/validators.zh_TW.xlf b/Resources/translations/validators.zh_TW.xlf index a60283b28..63103187c 100644 --- a/Resources/translations/validators.zh_TW.xlf +++ b/Resources/translations/validators.zh_TW.xlf @@ -132,7 +132,7 @@ This file is not a valid image. - 這個檔案不是有效的影像。 + 這個檔案不是有效的圖片。 This value is not a valid IP address. @@ -156,23 +156,23 @@ The size of the image could not be detected. - 無法偵測這個影像的大小。 + 無法偵測到圖片的大小。 The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. - 影像過寬({{ width }}px)。允許的寬度上限是 {{ max_width }}px。 + 圖片寬度過大 ({{ width }}px)。允許的最大寬度為 {{ max_width }}px。 The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. - 影像過窄({{ width }}px)。允許的寬度下限是 {{ max_width }}px。 + 圖片寬度過小 ({{ width }}px)。允許的最小寬度為 {{ max_width }}px。 The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. - 影像過長({{ height }}px)。允許的長度上限是 {{ max_height }}px。 + 圖片高度過大 ({{ height }}px)。允許的最大長度為 {{ max_height }}px。 The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. - 影像過短({{ height }}px)。允許的長度下限是 {{ max_height }}px。 + 圖片高度過小 ({{ height }}px)。允許的最小高度為 {{ max_height }}px。 This value should be the user's current password. @@ -280,23 +280,23 @@ 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 }}px)。不允許使用正方形影像。 + 圖片為正方形 ({{ width }}x{{ height }}px)。不允許使用正方形圖片。 The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. - 影像為橫向({{ width }}x{{ height }}px)。不允許使用橫向影像。 + 圖片為橫向 ({{ width }}x{{ height }}px)。不允許使用橫向圖片。 The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. - 影像為縱向({{ width }}x{{ height }}px)。不允許使用縱向影像。 + 圖片為縱向 ({{ width }}x{{ height }}px)。不允許使用縱向圖片。 An empty file is not allowed. @@ -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 }}p)。允許的最小寬度為 {{ 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. + 影片包含多個串流。只允許單個串流。 + + + 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. + 這個檔名與預期的字元集不相符。 + diff --git a/Test/CompoundConstraintTestCase.php b/Test/CompoundConstraintTestCase.php index 462d966be..2282645f2 100644 --- a/Test/CompoundConstraintTestCase.php +++ b/Test/CompoundConstraintTestCase.php @@ -102,7 +102,8 @@ protected function getConstraints(array $options): array next($expectedViolations); } - $this->assertEmpty( + $this->assertSame( + [], $failedToAssertViolations, \sprintf('Expected violation(s) for constraint(s) %s to be raised by compound.', implode(', ', array_map(fn ($violation) => ($violation->getConstraint())::class, $failedToAssertViolations)) diff --git a/Tests/Constraints/AllValidatorTest.php b/Tests/Constraints/AllValidatorTest.php index 65dae6275..ee6a29174 100644 --- a/Tests/Constraints/AllValidatorTest.php +++ b/Tests/Constraints/AllValidatorTest.php @@ -27,7 +27,7 @@ protected function createValidator(): AllValidator public function testNullIsValid() { - $this->validator->validate(null, new All(new Range(['min' => 4]))); + $this->validator->validate(null, new All(new Range(min: 4))); $this->assertNoViolation(); } @@ -35,7 +35,7 @@ public function testNullIsValid() public function testThrowsExceptionIfNotTraversable() { $this->expectException(UnexpectedValueException::class); - $this->validator->validate('foo.barbar', new All(new Range(['min' => 4]))); + $this->validator->validate('foo.barbar', new All(new Range(min: 4))); } /** @@ -43,7 +43,7 @@ public function testThrowsExceptionIfNotTraversable() */ public function testWalkSingleConstraint($array) { - $constraint = new Range(['min' => 4]); + $constraint = new Range(min: 4); $i = 0; @@ -61,7 +61,7 @@ public function testWalkSingleConstraint($array) */ public function testWalkMultipleConstraints($array) { - $constraint1 = new Range(['min' => 4]); + $constraint1 = new Range(min: 4); $constraint2 = new NotNull(); $constraints = [$constraint1, $constraint2]; diff --git a/Tests/Constraints/AtLeastOneOfValidatorTest.php b/Tests/Constraints/AtLeastOneOfValidatorTest.php index 8bda680b2..22b53dd13 100644 --- a/Tests/Constraints/AtLeastOneOfValidatorTest.php +++ b/Tests/Constraints/AtLeastOneOfValidatorTest.php @@ -66,31 +66,31 @@ public static function getValidCombinations() { return [ ['symfony', [ - new Length(['min' => 10]), - new EqualTo(['value' => 'symfony']), + new Length(min: 10), + new EqualTo(value: 'symfony'), ]], [150, [ - new Range(['min' => 10, 'max' => 20]), - new GreaterThanOrEqual(['value' => 100]), + new Range(min: 10, max: 20), + new GreaterThanOrEqual(value: 100), ]], [7, [ - new LessThan(['value' => 5]), - new IdenticalTo(['value' => 7]), + new LessThan(value: 5), + new IdenticalTo(value: 7), ]], [-3, [ - new DivisibleBy(['value' => 4]), + new DivisibleBy(value: 4), new Negative(), ]], ['FOO', [ - new Choice(['choices' => ['bar', 'BAR']]), - new Regex(['pattern' => '/foo/i']), + new Choice(choices: ['bar', 'BAR']), + new Regex(pattern: '/foo/i'), ]], ['fr', [ new Country(), new Language(), ]], [[1, 3, 5], [ - new Count(['min' => 5]), + new Count(min: 5), new Unique(), ]], ]; @@ -101,7 +101,7 @@ public static function getValidCombinations() */ public function testInvalidCombinationsWithDefaultMessage($value, $constraints) { - $atLeastOneOf = new AtLeastOneOf(['constraints' => $constraints]); + $atLeastOneOf = new AtLeastOneOf(constraints: $constraints); $validator = Validation::createValidator(); $message = [$atLeastOneOf->message]; @@ -123,7 +123,11 @@ public function testInvalidCombinationsWithDefaultMessage($value, $constraints) */ public function testInvalidCombinationsWithCustomMessage($value, $constraints) { - $atLeastOneOf = new AtLeastOneOf(['constraints' => $constraints, 'message' => 'foo', 'includeInternalMessages' => false]); + $atLeastOneOf = new AtLeastOneOf( + constraints: $constraints, + message: 'foo', + includeInternalMessages: false, + ); $violations = Validation::createValidator()->validate($value, $atLeastOneOf); @@ -135,31 +139,31 @@ public static function getInvalidCombinations() { return [ ['symphony', [ - new Length(['min' => 10]), - new EqualTo(['value' => 'symfony']), + new Length(min: 10), + new EqualTo(value: 'symfony'), ]], [70, [ - new Range(['min' => 10, 'max' => 20]), - new GreaterThanOrEqual(['value' => 100]), + new Range(min: 10, max: 20), + new GreaterThanOrEqual(value: 100), ]], [8, [ - new LessThan(['value' => 5]), - new IdenticalTo(['value' => 7]), + new LessThan(value: 5), + new IdenticalTo(value: 7), ]], [3, [ - new DivisibleBy(['value' => 4]), + new DivisibleBy(value: 4), new Negative(), ]], ['F_O_O', [ - new Choice(['choices' => ['bar', 'BAR']]), - new Regex(['pattern' => '/foo/i']), + new Choice(choices: ['bar', 'BAR']), + new Regex(pattern: '/foo/i'), ]], ['f_r', [ new Country(), new Language(), ]], [[1, 3, 3], [ - new Count(['min' => 5]), + new Count(min: 5), new Unique(), ]], ]; @@ -169,21 +173,21 @@ public function testGroupsArePropagatedToNestedConstraints() { $validator = Validation::createValidator(); - $violations = $validator->validate(50, new AtLeastOneOf([ - 'constraints' => [ - new Range([ - 'groups' => 'non_default_group', - 'min' => 10, - 'max' => 20, - ]), - new Range([ - 'groups' => 'non_default_group', - 'min' => 30, - 'max' => 40, - ]), + $violations = $validator->validate(50, new AtLeastOneOf( + constraints: [ + new Range( + groups: ['non_default_group'], + min: 10, + max: 20, + ), + new Range( + groups: ['non_default_group'], + min: 30, + max: 40, + ), ], - 'groups' => 'non_default_group', - ]), 'non_default_group'); + groups: ['non_default_group'], + ), ['non_default_group']); $this->assertCount(1, $violations); } @@ -221,9 +225,9 @@ public function testEmbeddedMessageTakenFromFailingConstraint() public function getMetadataFor($classOrObject): MetadataInterface { return (new ClassMetadata(Data::class)) - ->addPropertyConstraint('foo', new NotNull(['message' => 'custom message foo'])) + ->addPropertyConstraint('foo', new NotNull(message: 'custom message foo')) ->addPropertyConstraint('bar', new AtLeastOneOf([ - new NotNull(['message' => 'custom message bar']), + new NotNull(message: 'custom message bar'), ])) ; } @@ -247,20 +251,20 @@ public function testNestedConstraintsAreNotExecutedWhenGroupDoesNotMatch() { $validator = Validation::createValidator(); - $violations = $validator->validate(50, new AtLeastOneOf([ - 'constraints' => [ - new Range([ - 'groups' => 'adult', - 'min' => 18, - 'max' => 55, - ]), - new GreaterThan([ - 'groups' => 'senior', - 'value' => 55, - ]), + $violations = $validator->validate(50, new AtLeastOneOf( + constraints: [ + new Range( + groups: ['adult'], + min: 18, + max: 55, + ), + new GreaterThan( + groups: ['senior'], + value: 55, + ), ], - 'groups' => ['adult', 'senior'], - ]), 'senior'); + groups: ['adult', 'senior'], + ), 'senior'); $this->assertCount(1, $violations); } diff --git a/Tests/Constraints/BicValidatorTest.php b/Tests/Constraints/BicValidatorTest.php index 348613d00..315cb859e 100644 --- a/Tests/Constraints/BicValidatorTest.php +++ b/Tests/Constraints/BicValidatorTest.php @@ -44,7 +44,7 @@ public function testEmptyStringIsValid() public function testValidComparisonToPropertyPath() { - $constraint = new Bic(['ibanPropertyPath' => 'value']); + $constraint = new Bic(ibanPropertyPath: 'value'); $object = new BicComparisonTestClass('FR14 2004 1010 0505 0001 3M02 606'); @@ -57,7 +57,7 @@ public function testValidComparisonToPropertyPath() public function testInvalidComparisonToPropertyPath() { - $constraint = new Bic(['ibanPropertyPath' => 'value']); + $constraint = new Bic(ibanPropertyPath: 'value'); $constraint->ibanMessage = 'Constraint Message'; $object = new BicComparisonTestClass('FR14 2004 1010 0505 0001 3M02 606'); @@ -95,14 +95,14 @@ public function testPropertyPathReferencingUninitializedProperty() { $this->setObject(new BicTypedDummy()); - $this->validator->validate('UNCRIT2B912', new Bic(['ibanPropertyPath' => 'iban'])); + $this->validator->validate('UNCRIT2B912', new Bic(ibanPropertyPath: 'iban')); $this->assertNoViolation(); } public function testValidComparisonToValue() { - $constraint = new Bic(['iban' => 'FR14 2004 1010 0505 0001 3M02 606']); + $constraint = new Bic(iban: 'FR14 2004 1010 0505 0001 3M02 606'); $constraint->ibanMessage = 'Constraint Message'; $this->validator->validate('SOGEFRPP', $constraint); @@ -112,7 +112,7 @@ public function testValidComparisonToValue() public function testInvalidComparisonToValue() { - $constraint = new Bic(['iban' => 'FR14 2004 1010 0505 0001 3M02 606']); + $constraint = new Bic(iban: 'FR14 2004 1010 0505 0001 3M02 606'); $constraint->ibanMessage = 'Constraint Message'; $this->validator->validate('UNCRIT2B912', $constraint); @@ -142,7 +142,7 @@ public function testInvalidComparisonToValueFromAttribute() public function testNoViolationOnNullObjectWithPropertyPath() { - $constraint = new Bic(['ibanPropertyPath' => 'propertyPath']); + $constraint = new Bic(ibanPropertyPath: 'propertyPath'); $this->setObject(null); @@ -155,10 +155,10 @@ public function testThrowsConstraintExceptionIfBothValueAndPropertyPath() { $this->expectException(ConstraintDefinitionException::class); $this->expectExceptionMessage('The "iban" and "ibanPropertyPath" options of the Iban constraint cannot be used at the same time'); - new Bic([ - 'iban' => 'value', - 'ibanPropertyPath' => 'propertyPath', - ]); + new Bic( + iban: 'value', + ibanPropertyPath: 'propertyPath', + ); } public function testThrowsConstraintExceptionIfBothValueAndPropertyPathNamed() @@ -171,7 +171,7 @@ public function testThrowsConstraintExceptionIfBothValueAndPropertyPathNamed() public function testInvalidValuePath() { - $constraint = new Bic(['ibanPropertyPath' => 'foo']); + $constraint = new Bic(ibanPropertyPath: 'foo'); $this->expectException(ConstraintDefinitionException::class); $this->expectExceptionMessage(\sprintf('Invalid property path "foo" provided to "%s" constraint', $constraint::class)); @@ -217,9 +217,9 @@ public static function getValidBics() */ public function testInvalidBics($bic, $code) { - $constraint = new Bic([ - 'message' => 'myMessage', - ]); + $constraint = new Bic( + message: 'myMessage', + ); $this->validator->validate($bic, $constraint); @@ -277,7 +277,7 @@ public static function getInvalidBics() */ public function testValidBicSpecialCases(string $bic, string $iban) { - $constraint = new Bic(['iban' => $iban]); + $constraint = new Bic(iban: $iban); $this->validator->validate($bic, $constraint); $this->assertNoViolation(); diff --git a/Tests/Constraints/BlankValidatorTest.php b/Tests/Constraints/BlankValidatorTest.php index 9643c6793..21d3fc83e 100644 --- a/Tests/Constraints/BlankValidatorTest.php +++ b/Tests/Constraints/BlankValidatorTest.php @@ -41,9 +41,9 @@ public function testBlankIsValid() */ public function testInvalidValues($value, $valueAsString) { - $constraint = new Blank([ - 'message' => 'myMessage', - ]); + $constraint = new Blank( + message: 'myMessage', + ); $this->validator->validate($value, $constraint); diff --git a/Tests/Constraints/CallbackValidatorTest.php b/Tests/Constraints/CallbackValidatorTest.php index ef92d3072..7fbcd2714 100644 --- a/Tests/Constraints/CallbackValidatorTest.php +++ b/Tests/Constraints/CallbackValidatorTest.php @@ -74,7 +74,7 @@ public function testSingleMethod() public function testSingleMethodExplicitName() { $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(['callback' => 'validate']); + $constraint = new Callback(callback: 'validate'); $this->validator->validate($object, $constraint); @@ -129,13 +129,11 @@ public function testClosureNullObject() public function testClosureExplicitName() { $object = new CallbackValidatorTest_Object(); - $constraint = new Callback([ - 'callback' => function ($object, ExecutionContextInterface $context) { - $context->addViolation('My message', ['{{ value }}' => 'foobar']); + $constraint = new Callback(callback: function ($object, ExecutionContextInterface $context) { + $context->addViolation('My message', ['{{ value }}' => 'foobar']); - return false; - }, - ]); + return false; + }); $this->validator->validate($object, $constraint); @@ -170,9 +168,7 @@ public function testArrayCallableNullObject() public function testArrayCallableExplicitName() { $object = new CallbackValidatorTest_Object(); - $constraint = new Callback([ - 'callback' => [__CLASS__.'_Class', 'validateCallback'], - ]); + $constraint = new Callback(callback: [__CLASS__.'_Class', 'validateCallback']); $this->validator->validate($object, $constraint); @@ -186,7 +182,7 @@ public function testExpectValidMethods() $this->expectException(ConstraintDefinitionException::class); $object = new CallbackValidatorTest_Object(); - $this->validator->validate($object, new Callback(['callback' => ['foobar']])); + $this->validator->validate($object, new Callback(callback: ['foobar'])); } public function testExpectValidCallbacks() @@ -194,12 +190,12 @@ public function testExpectValidCallbacks() $this->expectException(ConstraintDefinitionException::class); $object = new CallbackValidatorTest_Object(); - $this->validator->validate($object, new Callback(['callback' => ['foo', 'bar']])); + $this->validator->validate($object, new Callback(callback: ['foo', 'bar'])); } public function testConstraintGetTargets() { - $constraint = new Callback([]); + $constraint = new Callback(callback: []); $targets = [Constraint::CLASS_CONSTRAINT, Constraint::PROPERTY_CONSTRAINT]; $this->assertEquals($targets, $constraint->getTargets()); @@ -215,16 +211,16 @@ public function testNoConstructorArguments() public function testAttributeInvocationSingleValued() { - $constraint = new Callback(['value' => 'validateStatic']); + $constraint = new Callback(callback: 'validateStatic'); - $this->assertEquals(new Callback('validateStatic'), $constraint); + $this->assertEquals(new Callback(callback: 'validateStatic'), $constraint); } public function testAttributeInvocationMultiValued() { - $constraint = new Callback(['value' => [__CLASS__.'_Class', 'validateCallback']]); + $constraint = new Callback(callback: [__CLASS__.'_Class', 'validateCallback']); - $this->assertEquals(new Callback([__CLASS__.'_Class', 'validateCallback']), $constraint); + $this->assertEquals(new Callback(callback: [__CLASS__.'_Class', 'validateCallback']), $constraint); } public function testPayloadIsPassedToCallback() @@ -235,10 +231,10 @@ public function testPayloadIsPassedToCallback() $payloadCopy = $payload; }; - $constraint = new Callback([ - 'callback' => $callback, - 'payload' => 'Hello world!', - ]); + $constraint = new Callback( + callback: $callback, + payload: 'Hello world!', + ); $this->validator->validate($object, $constraint); $this->assertEquals('Hello world!', $payloadCopy); @@ -248,9 +244,7 @@ public function testPayloadIsPassedToCallback() $this->assertEquals('Hello world!', $payloadCopy); $payloadCopy = 'Replace me!'; - $constraint = new Callback([ - 'callback' => $callback, - ]); + $constraint = new Callback(callback: $callback); $this->validator->validate($object, $constraint); $this->assertNull($payloadCopy); } diff --git a/Tests/Constraints/CardSchemeValidatorTest.php b/Tests/Constraints/CardSchemeValidatorTest.php index 15f4fa634..d70457833 100644 --- a/Tests/Constraints/CardSchemeValidatorTest.php +++ b/Tests/Constraints/CardSchemeValidatorTest.php @@ -24,14 +24,14 @@ protected function createValidator(): CardSchemeValidator public function testNullIsValid() { - $this->validator->validate(null, new CardScheme(['schemes' => []])); + $this->validator->validate(null, new CardScheme(schemes: [])); $this->assertNoViolation(); } public function testEmptyStringIsValid() { - $this->validator->validate('', new CardScheme(['schemes' => []])); + $this->validator->validate('', new CardScheme(schemes: [])); $this->assertNoViolation(); } @@ -41,7 +41,7 @@ public function testEmptyStringIsValid() */ public function testValidNumbers($scheme, $number) { - $this->validator->validate($number, new CardScheme(['schemes' => $scheme])); + $this->validator->validate($number, new CardScheme(schemes: $scheme)); $this->assertNoViolation(); } @@ -51,7 +51,7 @@ public function testValidNumbers($scheme, $number) */ public function testValidNumbersWithNewLine($scheme, $number) { - $this->validator->validate($number."\n", new CardScheme(['schemes' => $scheme, 'message' => 'myMessage'])); + $this->validator->validate($number."\n", new CardScheme(schemes: $scheme, message: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"'.$number."\n\"") @@ -74,10 +74,10 @@ public function testValidNumberWithOrderedArguments() */ public function testInvalidNumbers($scheme, $number, $code) { - $constraint = new CardScheme([ - 'schemes' => $scheme, - 'message' => 'myMessage', - ]); + $constraint = new CardScheme( + schemes: $scheme, + message: 'myMessage', + ); $this->validator->validate($number, $constraint); diff --git a/Tests/Constraints/CascadeTest.php b/Tests/Constraints/CascadeTest.php index 2ef4c9c83..fc4d7ce0f 100644 --- a/Tests/Constraints/CascadeTest.php +++ b/Tests/Constraints/CascadeTest.php @@ -35,6 +35,9 @@ public function testExcludeProperties() self::assertSame(['foo' => 0, 'bar' => 1], $constraint->exclude); } + /** + * @group legacy + */ public function testExcludePropertiesDoctrineStyle() { $constraint = new Cascade(['exclude' => ['foo', 'bar']]); diff --git a/Tests/Constraints/ChoiceValidatorTest.php b/Tests/Constraints/ChoiceValidatorTest.php index a78a2bfa5..39affe442 100644 --- a/Tests/Constraints/ChoiceValidatorTest.php +++ b/Tests/Constraints/ChoiceValidatorTest.php @@ -47,22 +47,17 @@ public static function staticCallbackInvalid() public function testExpectArrayIfMultipleIsTrue() { $this->expectException(UnexpectedValueException::class); - $constraint = new Choice([ - 'choices' => ['foo', 'bar'], - 'multiple' => true, - ]); + $constraint = new Choice( + choices: ['foo', 'bar'], + multiple: true, + ); $this->validator->validate('asdf', $constraint); } public function testNullIsValid() { - $this->validator->validate( - null, - new Choice([ - 'choices' => ['foo', 'bar'], - ]) - ); + $this->validator->validate(null, new Choice(choices: ['foo', 'bar'])); $this->assertNoViolation(); } @@ -76,7 +71,7 @@ public function testChoicesOrCallbackExpected() public function testValidCallbackExpected() { $this->expectException(ConstraintDefinitionException::class); - $this->validator->validate('foobar', new Choice(['callback' => 'abcd'])); + $this->validator->validate('foobar', new Choice(callback: 'abcd')); } /** @@ -91,12 +86,28 @@ public function testValidChoiceArray(Choice $constraint) public static function provideConstraintsWithChoicesArray(): iterable { - yield 'Doctrine style' => [new Choice(['choices' => ['foo', 'bar']])]; - yield 'Doctrine default option' => [new Choice(['value' => ['foo', 'bar']])]; yield 'first argument' => [new Choice(['foo', 'bar'])]; yield 'named arguments' => [new Choice(choices: ['foo', 'bar'])]; } + /** + * @group legacy + * + * @dataProvider provideLegacyConstraintsWithChoicesArrayDoctrineStyle + */ + public function testValidChoiceArrayDoctrineStyle(Choice $constraint) + { + $this->validator->validate('bar', $constraint); + + $this->assertNoViolation(); + } + + public static function provideLegacyConstraintsWithChoicesArrayDoctrineStyle(): iterable + { + yield 'Doctrine style' => [new Choice(['choices' => ['foo', 'bar']])]; + yield 'Doctrine default option' => [new Choice(['value' => ['foo', 'bar']])]; + } + /** * @dataProvider provideConstraintsWithCallbackFunction */ @@ -108,15 +119,31 @@ public function testValidChoiceCallbackFunction(Choice $constraint) } public static function provideConstraintsWithCallbackFunction(): iterable + { + yield 'named arguments, namespaced function' => [new Choice(callback: __NAMESPACE__.'\choice_callback')]; + yield 'named arguments, closure' => [new Choice(callback: fn () => ['foo', 'bar'])]; + yield 'named arguments, static method' => [new Choice(callback: [__CLASS__, 'staticCallback'])]; + } + + /** + * @group legacy + * + * @dataProvider provideLegacyConstraintsWithCallbackFunctionDoctrineStyle + */ + public function testValidChoiceCallbackFunctionDoctrineStyle(Choice $constraint) + { + $this->validator->validate('bar', $constraint); + + $this->assertNoViolation(); + } + + public static function provideLegacyConstraintsWithCallbackFunctionDoctrineStyle(): iterable { yield 'doctrine style, namespaced function' => [new Choice(['callback' => __NAMESPACE__.'\choice_callback'])]; yield 'doctrine style, closure' => [new Choice([ 'callback' => fn () => ['foo', 'bar'], ])]; yield 'doctrine style, static method' => [new Choice(['callback' => [__CLASS__, 'staticCallback']])]; - yield 'named arguments, namespaced function' => [new Choice(callback: __NAMESPACE__.'\choice_callback')]; - yield 'named arguments, closure' => [new Choice(callback: fn () => ['foo', 'bar'])]; - yield 'named arguments, static method' => [new Choice(callback: [__CLASS__, 'staticCallback'])]; } public function testValidChoiceCallbackContextMethod() @@ -124,7 +151,7 @@ public function testValidChoiceCallbackContextMethod() // search $this for "staticCallback" $this->setObject($this); - $constraint = new Choice(['callback' => 'staticCallback']); + $constraint = new Choice(callback: 'staticCallback'); $this->validator->validate('bar', $constraint); @@ -139,7 +166,7 @@ public function testInvalidChoiceCallbackContextMethod() // search $this for "staticCallbackInvalid" $this->setObject($this); - $constraint = new Choice(['callback' => 'staticCallbackInvalid']); + $constraint = new Choice(callback: 'staticCallbackInvalid'); $this->validator->validate('bar', $constraint); } @@ -149,41 +176,39 @@ public function testValidChoiceCallbackContextObjectMethod() // search $this for "objectMethodCallback" $this->setObject($this); - $constraint = new Choice(['callback' => 'objectMethodCallback']); + $constraint = new Choice(callback: 'objectMethodCallback'); $this->validator->validate('bar', $constraint); $this->assertNoViolation(); } - /** - * @dataProvider provideConstraintsWithMultipleTrue - */ - public function testMultipleChoices(Choice $constraint) + public function testMultipleChoices() { - $this->validator->validate(['baz', 'bar'], $constraint); + $this->validator->validate(['baz', 'bar'], new Choice( + choices: ['foo', 'bar', 'baz'], + multiple: true, + )); $this->assertNoViolation(); } - public static function provideConstraintsWithMultipleTrue(): iterable + /** + * @group legacy + */ + public function testMultipleChoicesDoctrineStyle() { - yield 'Doctrine style' => [new Choice([ + $this->validator->validate(['baz', 'bar'], new Choice([ 'choices' => ['foo', 'bar', 'baz'], 'multiple' => true, - ])]; - yield 'named arguments' => [new Choice( - choices: ['foo', 'bar', 'baz'], - multiple: true, - )]; + ])); + + $this->assertNoViolation(); } - /** - * @dataProvider provideConstraintsWithMessage - */ - public function testInvalidChoice(Choice $constraint) + public function testInvalidChoice() { - $this->validator->validate('baz', $constraint); + $this->validator->validate('baz', new Choice(choices: ['foo', 'bar'], message: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"baz"') @@ -192,20 +217,28 @@ public function testInvalidChoice(Choice $constraint) ->assertRaised(); } - public static function provideConstraintsWithMessage(): iterable + /** + * @group legacy + */ + public function testInvalidChoiceDoctrineStyle() { - yield 'Doctrine style' => [new Choice(['choices' => ['foo', 'bar'], 'message' => 'myMessage'])]; - yield 'named arguments' => [new Choice(choices: ['foo', 'bar'], message: 'myMessage')]; + $this->validator->validate('baz', new Choice(['choices' => ['foo', 'bar'], 'message' => 'myMessage'])); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"baz"') + ->setParameter('{{ choices }}', '"foo", "bar"') + ->setCode(Choice::NO_SUCH_CHOICE_ERROR) + ->assertRaised(); } public function testInvalidChoiceEmptyChoices() { - $constraint = new Choice([ + $constraint = new Choice( // May happen when the choices are provided dynamically, e.g. from // the DB or the model - 'choices' => [], - 'message' => 'myMessage', - ]); + choices: [], + message: 'myMessage', + ); $this->validator->validate('baz', $constraint); @@ -216,12 +249,13 @@ public function testInvalidChoiceEmptyChoices() ->assertRaised(); } - /** - * @dataProvider provideConstraintsWithMultipleMessage - */ - public function testInvalidChoiceMultiple(Choice $constraint) + public function testInvalidChoiceMultiple() { - $this->validator->validate(['foo', 'baz'], $constraint); + $this->validator->validate(['foo', 'baz'], new Choice( + choices: ['foo', 'bar'], + multipleMessage: 'myMessage', + multiple: true, + )); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"baz"') @@ -231,30 +265,37 @@ public function testInvalidChoiceMultiple(Choice $constraint) ->assertRaised(); } - public static function provideConstraintsWithMultipleMessage(): iterable + /** + * @group legacy + */ + public function testInvalidChoiceMultipleDoctrineStyle() { - yield 'Doctrine style' => [new Choice([ + $this->validator->validate(['foo', 'baz'], new Choice([ 'choices' => ['foo', 'bar'], 'multipleMessage' => 'myMessage', 'multiple' => true, - ])]; - yield 'named arguments' => [new Choice( - choices: ['foo', 'bar'], - multipleMessage: 'myMessage', - multiple: true, - )]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"baz"') + ->setParameter('{{ choices }}', '"foo", "bar"') + ->setInvalidValue('baz') + ->setCode(Choice::NO_SUCH_CHOICE_ERROR) + ->assertRaised(); } - /** - * @dataProvider provideConstraintsWithMin - */ - public function testTooFewChoices(Choice $constraint) + public function testTooFewChoices() { $value = ['foo']; $this->setValue($value); - $this->validator->validate($value, $constraint); + $this->validator->validate($value, new Choice( + choices: ['foo', 'bar', 'moo', 'maa'], + multiple: true, + min: 2, + minMessage: 'myMessage', + )); $this->buildViolation('myMessage') ->setParameter('{{ limit }}', 2) @@ -264,32 +305,42 @@ public function testTooFewChoices(Choice $constraint) ->assertRaised(); } - public static function provideConstraintsWithMin(): iterable + /** + * @group legacy + */ + public function testTooFewChoicesDoctrineStyle() { - yield 'Doctrine style' => [new Choice([ + $value = ['foo']; + + $this->setValue($value); + + $this->validator->validate($value, new Choice([ 'choices' => ['foo', 'bar', 'moo', 'maa'], 'multiple' => true, 'min' => 2, 'minMessage' => 'myMessage', - ])]; - yield 'named arguments' => [new Choice( - choices: ['foo', 'bar', 'moo', 'maa'], - multiple: true, - min: 2, - minMessage: 'myMessage', - )]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ limit }}', 2) + ->setInvalidValue($value) + ->setPlural(2) + ->setCode(Choice::TOO_FEW_ERROR) + ->assertRaised(); } - /** - * @dataProvider provideConstraintsWithMax - */ - public function testTooManyChoices(Choice $constraint) + public function testTooManyChoices() { $value = ['foo', 'bar', 'moo']; $this->setValue($value); - $this->validator->validate($value, $constraint); + $this->validator->validate($value, new Choice( + choices: ['foo', 'bar', 'moo', 'maa'], + multiple: true, + max: 2, + maxMessage: 'myMessage', + )); $this->buildViolation('myMessage') ->setParameter('{{ limit }}', 2) @@ -299,27 +350,33 @@ public function testTooManyChoices(Choice $constraint) ->assertRaised(); } - public static function provideConstraintsWithMax(): iterable + /** + * @group legacy + */ + public function testTooManyChoicesDoctrineStyle() { - yield 'Doctrine style' => [new Choice([ + $value = ['foo', 'bar', 'moo']; + + $this->setValue($value); + + $this->validator->validate($value, new Choice([ 'choices' => ['foo', 'bar', 'moo', 'maa'], 'multiple' => true, 'max' => 2, 'maxMessage' => 'myMessage', - ])]; - yield 'named arguments' => [new Choice( - choices: ['foo', 'bar', 'moo', 'maa'], - multiple: true, - max: 2, - maxMessage: 'myMessage', - )]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ limit }}', 2) + ->setInvalidValue($value) + ->setPlural(2) + ->setCode(Choice::TOO_MANY_ERROR) + ->assertRaised(); } public function testStrictAllowsExactValue() { - $constraint = new Choice([ - 'choices' => [1, 2], - ]); + $constraint = new Choice(choices: [1, 2]); $this->validator->validate(2, $constraint); @@ -328,10 +385,10 @@ public function testStrictAllowsExactValue() public function testStrictDisallowsDifferentType() { - $constraint = new Choice([ - 'choices' => [1, 2], - 'message' => 'myMessage', - ]); + $constraint = new Choice( + choices: [1, 2], + message: 'myMessage', + ); $this->validator->validate('2', $constraint); @@ -344,11 +401,11 @@ public function testStrictDisallowsDifferentType() public function testStrictWithMultipleChoices() { - $constraint = new Choice([ - 'choices' => [1, 2, 3], - 'multiple' => true, - 'multipleMessage' => 'myMessage', - ]); + $constraint = new Choice( + choices: [1, 2, 3], + multiple: true, + multipleMessage: 'myMessage', + ); $this->validator->validate([2, '3'], $constraint); @@ -362,10 +419,10 @@ public function testStrictWithMultipleChoices() public function testMatchFalse() { - $this->validator->validate('foo', new Choice([ - 'choices' => ['foo', 'bar'], - 'match' => false, - ])); + $this->validator->validate('foo', new Choice( + choices: ['foo', 'bar'], + match: false, + )); $this->buildViolation('The value you selected is not a valid choice.') ->setParameter('{{ value }}', '"foo"') @@ -376,11 +433,11 @@ public function testMatchFalse() public function testMatchFalseWithMultiple() { - $this->validator->validate(['ccc', 'bar', 'zzz'], new Choice([ - 'choices' => ['foo', 'bar'], - 'multiple' => true, - 'match' => false, - ])); + $this->validator->validate(['ccc', 'bar', 'zzz'], new Choice( + choices: ['foo', 'bar'], + multiple: true, + match: false, + )); $this->buildViolation('One or more of the given values is invalid.') ->setParameter('{{ value }}', '"bar"') diff --git a/Tests/Constraints/CidrTest.php b/Tests/Constraints/CidrTest.php index 142783ec0..25059104d 100644 --- a/Tests/Constraints/CidrTest.php +++ b/Tests/Constraints/CidrTest.php @@ -31,7 +31,7 @@ public function testForAll() public function testForV4() { - $cidrConstraint = new Cidr(['version' => Ip::V4]); + $cidrConstraint = new Cidr(version: Ip::V4); self::assertEquals(Ip::V4, $cidrConstraint->version); self::assertEquals(0, $cidrConstraint->netmaskMin); @@ -40,7 +40,7 @@ public function testForV4() public function testForV6() { - $cidrConstraint = new Cidr(['version' => Ip::V6]); + $cidrConstraint = new Cidr(version: Ip::V6); self::assertEquals(Ip::V6, $cidrConstraint->version); self::assertEquals(0, $cidrConstraint->netmaskMin); @@ -62,7 +62,7 @@ public function testWithInvalidVersion() self::expectException(ConstraintDefinitionException::class); self::expectExceptionMessage(\sprintf('The option "version" must be one of "%s".', implode('", "', $availableVersions))); - new Cidr(['version' => '8']); + new Cidr(version: '8'); } /** @@ -70,11 +70,11 @@ public function testWithInvalidVersion() */ public function testWithValidMinMaxValues(string $ipVersion, int $netmaskMin, int $netmaskMax) { - $cidrConstraint = new Cidr([ - 'version' => $ipVersion, - 'netmaskMin' => $netmaskMin, - 'netmaskMax' => $netmaskMax, - ]); + $cidrConstraint = new Cidr( + version: $ipVersion, + netmaskMin: $netmaskMin, + netmaskMax: $netmaskMax, + ); self::assertEquals($ipVersion, $cidrConstraint->version); self::assertEquals($netmaskMin, $cidrConstraint->netmaskMin); @@ -91,11 +91,11 @@ public function testWithInvalidMinMaxValues(string $ipVersion, int $netmaskMin, self::expectException(ConstraintDefinitionException::class); self::expectExceptionMessage(\sprintf('The netmask range must be between 0 and %d.', $expectedMax)); - new Cidr([ - 'version' => $ipVersion, - 'netmaskMin' => $netmaskMin, - 'netmaskMax' => $netmaskMax, - ]); + new Cidr( + version: $ipVersion, + netmaskMin: $netmaskMin, + netmaskMax: $netmaskMax, + ); } public static function getInvalidMinMaxValues(): array diff --git a/Tests/Constraints/CidrValidatorTest.php b/Tests/Constraints/CidrValidatorTest.php index 04d0b8999..6dfdc4931 100644 --- a/Tests/Constraints/CidrValidatorTest.php +++ b/Tests/Constraints/CidrValidatorTest.php @@ -86,7 +86,7 @@ public function testInvalidIpValue(string $cidr) */ public function testValidCidr(string|\Stringable $cidr, string $version) { - $this->validator->validate($cidr, new Cidr(['version' => $version])); + $this->validator->validate($cidr, new Cidr(version: $version)); $this->assertNoViolation(); } @@ -108,11 +108,11 @@ public function testInvalidIpAddressAndNetmask(string|\Stringable $cidr) */ public function testOutOfRangeNetmask(string $cidr, int $maxExpected, ?string $version = null, ?int $min = null, ?int $max = null) { - $cidrConstraint = new Cidr([ - 'version' => $version, - 'netmaskMin' => $min, - 'netmaskMax' => $max, - ]); + $cidrConstraint = new Cidr( + version: $version, + netmaskMin: $min, + netmaskMax: $max, + ); $this->validator->validate($cidr, $cidrConstraint); $this @@ -128,7 +128,7 @@ public function testOutOfRangeNetmask(string $cidr, int $maxExpected, ?string $v */ public function testWrongVersion(string $cidr, string $version) { - $this->validator->validate($cidr, new Cidr(['version' => $version])); + $this->validator->validate($cidr, new Cidr(version: $version)); $this ->buildViolation('This value is not a valid CIDR notation.') diff --git a/Tests/Constraints/CollectionTest.php b/Tests/Constraints/CollectionTest.php index e8d72b0f6..c1c32f90a 100644 --- a/Tests/Constraints/CollectionTest.php +++ b/Tests/Constraints/CollectionTest.php @@ -26,6 +26,9 @@ */ class CollectionTest extends TestCase { + /** + * @group legacy + */ public function testRejectNonConstraints() { $this->expectException(InvalidOptionsException::class); @@ -60,18 +63,14 @@ public function testRejectValidConstraintWithinRequired() public function testAcceptOptionalConstraintAsOneElementArray() { - $collection1 = new Collection([ - 'fields' => [ - 'alternate_email' => [ - new Optional(new Email()), - ], + $collection1 = new Collection(fields: [ + 'alternate_email' => [ + new Optional(new Email()), ], ]); - $collection2 = new Collection([ - 'fields' => [ - 'alternate_email' => new Optional(new Email()), - ], + $collection2 = new Collection(fields: [ + 'alternate_email' => new Optional(new Email()), ]); $this->assertEquals($collection1, $collection2); @@ -79,18 +78,14 @@ public function testAcceptOptionalConstraintAsOneElementArray() public function testAcceptRequiredConstraintAsOneElementArray() { - $collection1 = new Collection([ - 'fields' => [ - 'alternate_email' => [ - new Required(new Email()), - ], + $collection1 = new Collection(fields: [ + 'alternate_email' => [ + new Required(new Email()), ], ]); - $collection2 = new Collection([ - 'fields' => [ - 'alternate_email' => new Required(new Email()), - ], + $collection2 = new Collection(fields: [ + 'alternate_email' => new Required(new Email()), ]); $this->assertEquals($collection1, $collection2); @@ -108,6 +103,9 @@ public function testConstraintHasDefaultGroupWithOptionalValues() $this->assertEquals(['Default'], $constraint->fields['bar']->groups); } + /** + * @group legacy + */ public function testOnlySomeKeysAreKnowOptions() { $constraint = new Collection([ @@ -126,15 +124,15 @@ public function testOnlySomeKeysAreKnowOptions() public function testAllKeysAreKnowOptions() { - $constraint = new Collection([ - 'fields' => [ + $constraint = new Collection( + fields: [ 'fields' => [new Required()], 'properties' => [new Required()], 'catalog' => [new Optional()], ], - 'allowExtraFields' => true, - 'extraFieldsMessage' => 'foo bar baz', - ]); + allowExtraFields: true, + extraFieldsMessage: 'foo bar baz', + ); $this->assertArrayHasKey('fields', $constraint->fields); $this->assertInstanceOf(Required::class, $constraint->fields['fields']); @@ -157,11 +155,11 @@ public function testEmptyFields() public function testEmptyFieldsInOptions() { - $constraint = new Collection([ - 'fields' => [], - 'allowExtraFields' => true, - 'extraFieldsMessage' => 'foo bar baz', - ]); + $constraint = new Collection( + fields: [], + allowExtraFields: true, + extraFieldsMessage: 'foo bar baz', + ); $this->assertSame([], $constraint->fields); $this->assertTrue($constraint->allowExtraFields); @@ -197,13 +195,13 @@ public function testEmptyConstraintListForField(?array $fieldConstraint) */ public function testEmptyConstraintListForFieldInOptions(?array $fieldConstraint) { - $constraint = new Collection([ - 'fields' => [ + $constraint = new Collection( + fields: [ 'foo' => $fieldConstraint, ], - 'allowExtraFields' => true, - 'extraFieldsMessage' => 'foo bar baz', - ]); + allowExtraFields: true, + extraFieldsMessage: 'foo bar baz', + ); $this->assertArrayHasKey('foo', $constraint->fields); $this->assertInstanceOf(Required::class, $constraint->fields['foo']); diff --git a/Tests/Constraints/CollectionValidatorTestCase.php b/Tests/Constraints/CollectionValidatorTestCase.php index 92260e966..8e03a9add 100644 --- a/Tests/Constraints/CollectionValidatorTestCase.php +++ b/Tests/Constraints/CollectionValidatorTestCase.php @@ -31,16 +31,16 @@ abstract protected function prepareTestData(array $contents); public function testNullIsValid() { - $this->validator->validate(null, new Collection(['fields' => [ - 'foo' => new Range(['min' => 4]), - ]])); + $this->validator->validate(null, new Collection(fields: [ + 'foo' => new Range(min: 4), + ])); $this->assertNoViolation(); } public function testFieldsAsDefaultOption() { - $constraint = new Range(['min' => 4]); + $constraint = new Range(min: 4); $data = $this->prepareTestData(['foo' => 'foobar']); @@ -56,14 +56,14 @@ public function testFieldsAsDefaultOption() public function testThrowsExceptionIfNotTraversable() { $this->expectException(UnexpectedValueException::class); - $this->validator->validate('foobar', new Collection(['fields' => [ - 'foo' => new Range(['min' => 4]), - ]])); + $this->validator->validate('foobar', new Collection(fields: [ + 'foo' => new Range(min: 4), + ])); } public function testWalkSingleConstraint() { - $constraint = new Range(['min' => 4]); + $constraint = new Range(min: 4); $array = [ 'foo' => 3, @@ -78,12 +78,12 @@ public function testWalkSingleConstraint() $data = $this->prepareTestData($array); - $this->validator->validate($data, new Collection([ - 'fields' => [ + $this->validator->validate($data, new Collection( + fields: [ 'foo' => $constraint, 'bar' => $constraint, ], - ])); + )); $this->assertNoViolation(); } @@ -91,7 +91,7 @@ public function testWalkSingleConstraint() public function testWalkMultipleConstraints() { $constraints = [ - new Range(['min' => 4]), + new Range(min: 4), new NotNull(), ]; @@ -108,19 +108,19 @@ public function testWalkMultipleConstraints() $data = $this->prepareTestData($array); - $this->validator->validate($data, new Collection([ - 'fields' => [ + $this->validator->validate($data, new Collection( + fields: [ 'foo' => $constraints, 'bar' => $constraints, ], - ])); + )); $this->assertNoViolation(); } public function testExtraFieldsDisallowed() { - $constraint = new Range(['min' => 4]); + $constraint = new Range(min: 4); $data = $this->prepareTestData([ 'foo' => 5, @@ -129,12 +129,12 @@ public function testExtraFieldsDisallowed() $this->expectValidateValueAt(0, '[foo]', $data['foo'], [$constraint]); - $this->validator->validate($data, new Collection([ - 'fields' => [ + $this->validator->validate($data, new Collection( + fields: [ 'foo' => $constraint, ], - 'extraFieldsMessage' => 'myMessage', - ])); + extraFieldsMessage: 'myMessage', + )); $this->buildViolation('myMessage') ->setParameter('{{ field }}', '"baz"') @@ -152,12 +152,12 @@ public function testExtraFieldsDisallowedWithOptionalValues() 'baz' => 6, ]); - $this->validator->validate($data, new Collection([ - 'fields' => [ + $this->validator->validate($data, new Collection( + fields: [ 'foo' => $constraint, ], - 'extraFieldsMessage' => 'myMessage', - ])); + extraFieldsMessage: 'myMessage', + )); $this->buildViolation('myMessage') ->setParameter('{{ field }}', '"baz"') @@ -174,15 +174,15 @@ public function testNullNotConsideredExtraField() 'foo' => null, ]); - $constraint = new Range(['min' => 4]); + $constraint = new Range(min: 4); $this->expectValidateValueAt(0, '[foo]', $data['foo'], [$constraint]); - $this->validator->validate($data, new Collection([ - 'fields' => [ + $this->validator->validate($data, new Collection( + fields: [ 'foo' => $constraint, ], - ])); + )); $this->assertNoViolation(); } @@ -194,16 +194,16 @@ public function testExtraFieldsAllowed() 'bar' => 6, ]); - $constraint = new Range(['min' => 4]); + $constraint = new Range(min: 4); $this->expectValidateValueAt(0, '[foo]', $data['foo'], [$constraint]); - $this->validator->validate($data, new Collection([ - 'fields' => [ + $this->validator->validate($data, new Collection( + fields: [ 'foo' => $constraint, ], - 'allowExtraFields' => true, - ])); + allowExtraFields: true, + )); $this->assertNoViolation(); } @@ -212,14 +212,14 @@ public function testMissingFieldsDisallowed() { $data = $this->prepareTestData([]); - $constraint = new Range(['min' => 4]); + $constraint = new Range(min: 4); - $this->validator->validate($data, new Collection([ - 'fields' => [ + $this->validator->validate($data, new Collection( + fields: [ 'foo' => $constraint, ], - 'missingFieldsMessage' => 'myMessage', - ])); + missingFieldsMessage: 'myMessage', + )); $this->buildViolation('myMessage') ->setParameter('{{ field }}', '"foo"') @@ -233,14 +233,14 @@ public function testMissingFieldsAllowed() { $data = $this->prepareTestData([]); - $constraint = new Range(['min' => 4]); + $constraint = new Range(min: 4); - $this->validator->validate($data, new Collection([ - 'fields' => [ + $this->validator->validate($data, new Collection( + fields: [ 'foo' => $constraint, ], - 'allowMissingFields' => true, - ])); + allowMissingFields: true, + )); $this->assertNoViolation(); } @@ -275,7 +275,7 @@ public function testOptionalFieldSingleConstraint() 'foo' => 5, ]; - $constraint = new Range(['min' => 4]); + $constraint = new Range(min: 4); $this->expectValidateValueAt(0, '[foo]', $array['foo'], [$constraint]); @@ -296,7 +296,7 @@ public function testOptionalFieldMultipleConstraints() $constraints = [ new NotNull(), - new Range(['min' => 4]), + new Range(min: 4), ]; $this->expectValidateValueAt(0, '[foo]', $array['foo'], $constraints); @@ -327,12 +327,12 @@ public function testRequiredFieldNotPresent() { $data = $this->prepareTestData([]); - $this->validator->validate($data, new Collection([ - 'fields' => [ + $this->validator->validate($data, new Collection( + fields: [ 'foo' => new Required(), ], - 'missingFieldsMessage' => 'myMessage', - ])); + missingFieldsMessage: 'myMessage', + )); $this->buildViolation('myMessage') ->setParameter('{{ field }}', '"foo"') @@ -348,7 +348,7 @@ public function testRequiredFieldSingleConstraint() 'foo' => 5, ]; - $constraint = new Range(['min' => 4]); + $constraint = new Range(min: 4); $this->expectValidateValueAt(0, '[foo]', $array['foo'], [$constraint]); @@ -369,7 +369,7 @@ public function testRequiredFieldMultipleConstraints() $constraints = [ new NotNull(), - new Range(['min' => 4]), + new Range(min: 4), ]; $this->expectValidateValueAt(0, '[foo]', $array['foo'], $constraints); @@ -389,15 +389,15 @@ public function testObjectShouldBeLeftUnchanged() 'foo' => 3, ]); - $constraint = new Range(['min' => 2]); + $constraint = new Range(min: 2); $this->expectValidateValueAt(0, '[foo]', $value['foo'], [$constraint]); - $this->validator->validate($value, new Collection([ - 'fields' => [ + $this->validator->validate($value, new Collection( + fields: [ 'foo' => $constraint, ], - ])); + )); $this->assertEquals([ 'foo' => 3, diff --git a/Tests/Constraints/CompositeTest.php b/Tests/Constraints/CompositeTest.php index 127ad21dd..9329ef1a2 100644 --- a/Tests/Constraints/CompositeTest.php +++ b/Tests/Constraints/CompositeTest.php @@ -14,6 +14,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\Composite; +use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Component\Validator\Constraints\Valid; @@ -23,9 +24,14 @@ class ConcreteComposite extends Composite { public array|Constraint $constraints = []; - protected function getCompositeOption(): string + public function __construct(mixed $options = null, public array|Constraint $otherNested = []) { - return 'constraints'; + parent::__construct($options); + } + + protected function getCompositeOption(): array + { + return ['constraints', 'otherNested']; } public function getDefaultOption(): ?string @@ -44,11 +50,14 @@ public function testConstraintHasDefaultGroup() $constraint = new ConcreteComposite([ new NotNull(), new NotBlank(), + ], [ + new Length(exactly: 10), ]); $this->assertEquals(['Default'], $constraint->groups); $this->assertEquals(['Default'], $constraint->constraints[0]->groups); $this->assertEquals(['Default'], $constraint->constraints[1]->groups); + $this->assertEquals(['Default'], $constraint->otherNested[0]->groups); } public function testNestedCompositeConstraintHasDefaultGroup() @@ -66,13 +75,16 @@ public function testNestedCompositeConstraintHasDefaultGroup() public function testMergeNestedGroupsIfNoExplicitParentGroup() { $constraint = new ConcreteComposite([ - new NotNull(['groups' => 'Default']), - new NotBlank(['groups' => ['Default', 'Strict']]), + new NotNull(groups: ['Default']), + new NotBlank(groups: ['Default', 'Strict']), + ], [ + new Length(exactly: 10, groups: ['Default', 'Strict']), ]); $this->assertEquals(['Default', 'Strict'], $constraint->groups); $this->assertEquals(['Default'], $constraint->constraints[0]->groups); $this->assertEquals(['Default', 'Strict'], $constraint->constraints[1]->groups); + $this->assertEquals(['Default', 'Strict'], $constraint->otherNested[0]->groups); } public function testSetImplicitNestedGroupsIfExplicitParentGroup() @@ -82,20 +94,27 @@ public function testSetImplicitNestedGroupsIfExplicitParentGroup() new NotNull(), new NotBlank(), ], + 'otherNested' => [ + new Length(exactly: 10), + ], 'groups' => ['Default', 'Strict'], ]); $this->assertEquals(['Default', 'Strict'], $constraint->groups); $this->assertEquals(['Default', 'Strict'], $constraint->constraints[0]->groups); $this->assertEquals(['Default', 'Strict'], $constraint->constraints[1]->groups); + $this->assertEquals(['Default', 'Strict'], $constraint->otherNested[0]->groups); } public function testExplicitNestedGroupsMustBeSubsetOfExplicitParentGroups() { $constraint = new ConcreteComposite([ 'constraints' => [ - new NotNull(['groups' => 'Default']), - new NotBlank(['groups' => 'Strict']), + new NotNull(groups: ['Default']), + new NotBlank(groups: ['Strict']), + ], + 'otherNested' => [ + new Length(exactly: 10, groups: ['Strict']), ], 'groups' => ['Default', 'Strict'], ]); @@ -103,6 +122,7 @@ public function testExplicitNestedGroupsMustBeSubsetOfExplicitParentGroups() $this->assertEquals(['Default', 'Strict'], $constraint->groups); $this->assertEquals(['Default'], $constraint->constraints[0]->groups); $this->assertEquals(['Strict'], $constraint->constraints[1]->groups); + $this->assertEquals(['Strict'], $constraint->otherNested[0]->groups); } public function testFailIfExplicitNestedGroupsNotSubsetOfExplicitParentGroups() @@ -110,7 +130,21 @@ public function testFailIfExplicitNestedGroupsNotSubsetOfExplicitParentGroups() $this->expectException(ConstraintDefinitionException::class); new ConcreteComposite([ 'constraints' => [ - new NotNull(['groups' => ['Default', 'Foobar']]), + new NotNull(groups: ['Default', 'Foobar']), + ], + 'groups' => ['Default', 'Strict'], + ]); + } + + public function testFailIfExplicitNestedGroupsNotSubsetOfExplicitParentGroupsInOtherNested() + { + $this->expectException(ConstraintDefinitionException::class); + new ConcreteComposite([ + 'constraints' => [ + new NotNull(groups: ['Default']), + ], + 'otherNested' => [ + new NotNull(groups: ['Default', 'Foobar']), ], 'groups' => ['Default', 'Strict'], ]); @@ -119,8 +153,10 @@ public function testFailIfExplicitNestedGroupsNotSubsetOfExplicitParentGroups() public function testImplicitGroupNamesAreForwarded() { $constraint = new ConcreteComposite([ - new NotNull(['groups' => 'Default']), - new NotBlank(['groups' => 'Strict']), + new NotNull(groups: ['Default']), + new NotBlank(groups: ['Strict']), + ], [ + new Length(exactly: 10, groups: ['Default']), ]); $constraint->addImplicitGroupName('ImplicitGroup'); @@ -128,21 +164,33 @@ public function testImplicitGroupNamesAreForwarded() $this->assertEquals(['Default', 'Strict', 'ImplicitGroup'], $constraint->groups); $this->assertEquals(['Default', 'ImplicitGroup'], $constraint->constraints[0]->groups); $this->assertEquals(['Strict'], $constraint->constraints[1]->groups); + $this->assertEquals(['Default', 'ImplicitGroup'], $constraint->otherNested[0]->groups); } public function testSingleConstraintsAccepted() { $nestedConstraint = new NotNull(); - $constraint = new ConcreteComposite($nestedConstraint); + $otherNestedConstraint = new Length(exactly: 10); + $constraint = new ConcreteComposite($nestedConstraint, $otherNestedConstraint); $this->assertEquals([$nestedConstraint], $constraint->constraints); + $this->assertEquals([$otherNestedConstraint], $constraint->otherNested); } public function testFailIfNoConstraint() { $this->expectException(ConstraintDefinitionException::class); new ConcreteComposite([ - new NotNull(['groups' => 'Default']), + new NotNull(groups: ['Default']), + 'NotBlank', + ]); + } + + public function testFailIfNoConstraintInAnotherNested() + { + $this->expectException(ConstraintDefinitionException::class); + new ConcreteComposite([new NotNull()], [ + new NotNull(groups: ['Default']), 'NotBlank', ]); } @@ -151,7 +199,16 @@ public function testFailIfNoConstraintObject() { $this->expectException(ConstraintDefinitionException::class); new ConcreteComposite([ - new NotNull(['groups' => 'Default']), + new NotNull(groups: ['Default']), + new \ArrayObject(), + ]); + } + + public function testFailIfNoConstraintObjectInAnotherNested() + { + $this->expectException(ConstraintDefinitionException::class); + new ConcreteComposite([new NotNull()], [ + new NotNull(groups: ['Default']), new \ArrayObject(), ]); } @@ -163,4 +220,10 @@ public function testValidCantBeNested() new Valid(), ]); } + + public function testValidCantBeNestedInAnotherNested() + { + $this->expectException(ConstraintDefinitionException::class); + new ConcreteComposite([new NotNull()], [new Valid()]); + } } diff --git a/Tests/Constraints/CompoundTest.php b/Tests/Constraints/CompoundTest.php index 26889a0cc..9b515a48c 100644 --- a/Tests/Constraints/CompoundTest.php +++ b/Tests/Constraints/CompoundTest.php @@ -19,6 +19,9 @@ class CompoundTest extends TestCase { + /** + * @group legacy + */ public function testItCannotRedefineConstraintsOption() { $this->expectException(ConstraintDefinitionException::class); @@ -72,7 +75,7 @@ public function getDefaultOption(): ?string protected function getConstraints(array $options): array { return [ - new Length(['min' => $options['min'] ?? null]), + new Length(min: $options['min'] ?? null), ]; } } diff --git a/Tests/Constraints/CountValidatorTestCase.php b/Tests/Constraints/CountValidatorTestCase.php index c52cd4e69..da319cd8b 100644 --- a/Tests/Constraints/CountValidatorTestCase.php +++ b/Tests/Constraints/CountValidatorTestCase.php @@ -70,6 +70,8 @@ public static function getFiveOrMoreElements() } /** + * @group legacy + * * @dataProvider getThreeOrLessElements */ public function testValidValuesMax($value) @@ -92,6 +94,8 @@ public function testValidValuesMaxNamed($value) } /** + * @group legacy + * * @dataProvider getFiveOrMoreElements */ public function testValidValuesMin($value) @@ -114,6 +118,8 @@ public function testValidValuesMinNamed($value) } /** + * @group legacy + * * @dataProvider getFourElements */ public function testValidValuesExact($value) @@ -136,6 +142,8 @@ public function testValidValuesExactNamed($value) } /** + * @group legacy + * * @dataProvider getFiveOrMoreElements */ public function testTooManyValues($value) @@ -175,6 +183,8 @@ public function testTooManyValuesNamed($value) } /** + * @group legacy + * * @dataProvider getThreeOrLessElements */ public function testTooFewValues($value) @@ -214,6 +224,8 @@ public function testTooFewValuesNamed($value) } /** + * @group legacy + * * @dataProvider getFiveOrMoreElements */ public function testTooManyValuesExact($value) @@ -258,11 +270,11 @@ public function testTooManyValuesExactNamed($value) */ public function testTooFewValuesExact($value) { - $constraint = new Count([ - 'min' => 4, - 'max' => 4, - 'exactMessage' => 'myMessage', - ]); + $constraint = new Count( + min: 4, + max: 4, + exactMessage: 'myMessage', + ); $this->validator->validate($value, $constraint); @@ -285,7 +297,7 @@ public function testDefaultOption() public function testConstraintAttributeDefaultOption() { - $constraint = new Count(['value' => 5, 'exactMessage' => 'message']); + $constraint = new Count(exactly: 5, exactMessage: 'message'); $this->assertEquals(5, $constraint->min); $this->assertEquals(5, $constraint->max); @@ -296,15 +308,15 @@ public function testConstraintAttributeDefaultOption() // is called with the right DivisibleBy constraint. public function testDivisibleBy() { - $constraint = new Count([ - 'divisibleBy' => 123, - 'divisibleByMessage' => 'foo {{ compared_value }}', - ]); - - $this->expectValidateValue(0, 3, [new DivisibleBy([ - 'value' => 123, - 'message' => 'foo {{ compared_value }}', - ])], $this->group); + $constraint = new Count( + divisibleBy: 123, + divisibleByMessage: 'foo {{ compared_value }}', + ); + + $this->expectValidateValue(0, 3, [new DivisibleBy( + value: 123, + message: 'foo {{ compared_value }}', + )], $this->group); $this->validator->validate(['foo', 'bar', 'ccc'], $constraint); diff --git a/Tests/Constraints/CountryValidatorTest.php b/Tests/Constraints/CountryValidatorTest.php index 524d0bc54..d6fa0c35e 100644 --- a/Tests/Constraints/CountryValidatorTest.php +++ b/Tests/Constraints/CountryValidatorTest.php @@ -84,9 +84,7 @@ public static function getValidCountries() */ public function testInvalidCountries($country) { - $constraint = new Country([ - 'message' => 'myMessage', - ]); + $constraint = new Country(message: 'myMessage'); $this->validator->validate($country, $constraint); @@ -109,9 +107,7 @@ public static function getInvalidCountries() */ public function testValidAlpha3Countries($country) { - $this->validator->validate($country, new Country([ - 'alpha3' => true, - ])); + $this->validator->validate($country, new Country(alpha3: true)); $this->assertNoViolation(); } @@ -130,10 +126,10 @@ public static function getValidAlpha3Countries() */ public function testInvalidAlpha3Countries($country) { - $constraint = new Country([ - 'alpha3' => true, - 'message' => 'myMessage', - ]); + $constraint = new Country( + alpha3: true, + message: 'myMessage', + ); $this->validator->validate($country, $constraint); @@ -169,7 +165,7 @@ public function testInvalidAlpha3CountryNamed() public function testValidateUsingCountrySpecificLocale() { // in order to test with "en_GB" - IntlTestHelper::requireFullIntl($this, false); + IntlTestHelper::requireFullIntl($this); \Locale::setDefault('en_GB'); diff --git a/Tests/Constraints/CurrencyValidatorTest.php b/Tests/Constraints/CurrencyValidatorTest.php index a0e16ec14..af4c20f8e 100644 --- a/Tests/Constraints/CurrencyValidatorTest.php +++ b/Tests/Constraints/CurrencyValidatorTest.php @@ -75,7 +75,7 @@ public function testValidCurrencies($currency) **/ public function testValidCurrenciesWithCountrySpecificLocale($currency) { - IntlTestHelper::requireFullIntl($this, false); + IntlTestHelper::requireFullIntl($this); \Locale::setDefault('en_GB'); @@ -100,9 +100,7 @@ public static function getValidCurrencies() */ public function testInvalidCurrencies($currency) { - $constraint = new Currency([ - 'message' => 'myMessage', - ]); + $constraint = new Currency(message: 'myMessage'); $this->validator->validate($currency, $constraint); diff --git a/Tests/Constraints/DateTimeValidatorTest.php b/Tests/Constraints/DateTimeValidatorTest.php index 8da07c424..383f06215 100644 --- a/Tests/Constraints/DateTimeValidatorTest.php +++ b/Tests/Constraints/DateTimeValidatorTest.php @@ -53,6 +53,7 @@ public function testDateTimeWithDefaultFormat() $this->buildViolation('This value is not a valid datetime.') ->setParameter('{{ value }}', '"1995-03-24"') + ->setParameter('{{ format }}', '"Y-m-d H:i:s"') ->setCode(DateTime::INVALID_FORMAT_ERROR) ->assertRaised(); } @@ -62,9 +63,7 @@ public function testDateTimeWithDefaultFormat() */ public function testValidDateTimes($format, $dateTime) { - $constraint = new DateTime([ - 'format' => $format, - ]); + $constraint = new DateTime(format: $format); $this->validator->validate($dateTime, $constraint); @@ -87,15 +86,16 @@ public static function getValidDateTimes() */ public function testInvalidDateTimes($format, $dateTime, $code) { - $constraint = new DateTime([ - 'message' => 'myMessage', - 'format' => $format, - ]); + $constraint = new DateTime( + message: 'myMessage', + format: $format, + ); $this->validator->validate($dateTime, $constraint); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"'.$dateTime.'"') + ->setParameter('{{ format }}', '"'.$format.'"') ->setCode($code) ->assertRaised(); } @@ -124,15 +124,14 @@ public function testInvalidDateTimeNamed() $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"2010-01-01 00:00:00"') + ->setParameter('{{ format }}', '"Y-m-d"') ->setCode(DateTime::INVALID_FORMAT_ERROR) ->assertRaised(); } public function testDateTimeWithTrailingData() { - $this->validator->validate('1995-05-10 00:00:00', new DateTime([ - 'format' => 'Y-m-d+', - ])); + $this->validator->validate('1995-05-10 00:00:00', new DateTime(format: 'Y-m-d+')); $this->assertNoViolation(); } } diff --git a/Tests/Constraints/DateValidatorTest.php b/Tests/Constraints/DateValidatorTest.php index 93dab41f2..65909ef83 100644 --- a/Tests/Constraints/DateValidatorTest.php +++ b/Tests/Constraints/DateValidatorTest.php @@ -58,7 +58,7 @@ public function testValidDates($date) */ public function testValidDatesWithNewLine(string $date) { - $this->validator->validate($date."\n", new Date(['message' => 'myMessage'])); + $this->validator->validate($date."\n", new Date(message: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"'.$date."\n\"") @@ -80,9 +80,7 @@ public static function getValidDates() */ public function testInvalidDates($date, $code) { - $constraint = new Date([ - 'message' => 'myMessage', - ]); + $constraint = new Date(message: 'myMessage'); $this->validator->validate($date, $constraint); diff --git a/Tests/Constraints/DisableAutoMappingTest.php b/Tests/Constraints/DisableAutoMappingTest.php index 709334e36..e7b6a8db7 100644 --- a/Tests/Constraints/DisableAutoMappingTest.php +++ b/Tests/Constraints/DisableAutoMappingTest.php @@ -23,6 +23,9 @@ */ class DisableAutoMappingTest extends TestCase { + /** + * @group legacy + */ public function testGroups() { $this->expectException(ConstraintDefinitionException::class); diff --git a/Tests/Constraints/DivisibleByValidatorTest.php b/Tests/Constraints/DivisibleByValidatorTest.php index 22dc683fb..be96ad2b4 100644 --- a/Tests/Constraints/DivisibleByValidatorTest.php +++ b/Tests/Constraints/DivisibleByValidatorTest.php @@ -32,7 +32,11 @@ protected function createValidator(): DivisibleByValidator protected static function createConstraint(?array $options = null): Constraint { - return new DivisibleBy($options); + if (null !== $options) { + return new DivisibleBy(...$options); + } + + return new DivisibleBy(); } protected function getErrorCode(): ?string diff --git a/Tests/Constraints/EmailTest.php b/Tests/Constraints/EmailTest.php index 8489f9cfe..9436b4bd6 100644 --- a/Tests/Constraints/EmailTest.php +++ b/Tests/Constraints/EmailTest.php @@ -21,14 +21,14 @@ class EmailTest extends TestCase { public function testConstructorStrict() { - $subject = new Email(['mode' => Email::VALIDATION_MODE_STRICT]); + $subject = new Email(mode: Email::VALIDATION_MODE_STRICT); $this->assertEquals(Email::VALIDATION_MODE_STRICT, $subject->mode); } public function testConstructorHtml5AllowNoTld() { - $subject = new Email(['mode' => Email::VALIDATION_MODE_HTML5_ALLOW_NO_TLD]); + $subject = new Email(mode: Email::VALIDATION_MODE_HTML5_ALLOW_NO_TLD); $this->assertEquals(Email::VALIDATION_MODE_HTML5_ALLOW_NO_TLD, $subject->mode); } @@ -37,7 +37,7 @@ public function testUnknownModesTriggerException() { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('The "mode" parameter value is not valid.'); - new Email(['mode' => 'Unknown Mode']); + new Email(mode: 'Unknown Mode'); } public function testUnknownModeArgumentsTriggerException() @@ -49,11 +49,14 @@ public function testUnknownModeArgumentsTriggerException() public function testNormalizerCanBeSet() { - $email = new Email(['normalizer' => 'trim']); + $email = new Email(normalizer: 'trim'); $this->assertEquals('trim', $email->normalizer); } + /** + * @group legacy + */ public function testInvalidNormalizerThrowsException() { $this->expectException(InvalidArgumentException::class); @@ -61,6 +64,9 @@ public function testInvalidNormalizerThrowsException() new Email(['normalizer' => 'Unknown Callable']); } + /** + * @group legacy + */ public function testInvalidNormalizerObjectThrowsException() { $this->expectException(InvalidArgumentException::class); diff --git a/Tests/Constraints/EmailValidatorTest.php b/Tests/Constraints/EmailValidatorTest.php index 197490ce7..483b534e6 100644 --- a/Tests/Constraints/EmailValidatorTest.php +++ b/Tests/Constraints/EmailValidatorTest.php @@ -97,7 +97,7 @@ public static function getValidEmails() */ public function testValidNormalizedEmails($email) { - $this->validator->validate($email, new Email(['normalizer' => 'trim'])); + $this->validator->validate($email, new Email(normalizer: 'trim')); $this->assertNoViolation(); } @@ -115,7 +115,7 @@ public static function getValidEmailsWithWhitespaces() */ public function testValidEmailsHtml5($email) { - $this->validator->validate($email, new Email(['mode' => Email::VALIDATION_MODE_HTML5])); + $this->validator->validate($email, new Email(mode: Email::VALIDATION_MODE_HTML5)); $this->assertNoViolation(); } @@ -135,9 +135,7 @@ public static function getValidEmailsHtml5() */ public function testInvalidEmails($email) { - $constraint = new Email([ - 'message' => 'myMessage', - ]); + $constraint = new Email(message: 'myMessage'); $this->validator->validate($email, $constraint); @@ -162,10 +160,10 @@ public static function getInvalidEmails() */ public function testInvalidHtml5Emails($email) { - $constraint = new Email([ - 'message' => 'myMessage', - 'mode' => Email::VALIDATION_MODE_HTML5, - ]); + $constraint = new Email( + message: 'myMessage', + mode: Email::VALIDATION_MODE_HTML5, + ); $this->validator->validate($email, $constraint); @@ -202,10 +200,10 @@ public static function getInvalidHtml5Emails() */ public function testInvalidAllowNoTldEmails($email) { - $constraint = new Email([ - 'message' => 'myMessage', - 'mode' => Email::VALIDATION_MODE_HTML5_ALLOW_NO_TLD, - ]); + $constraint = new Email( + message: 'myMessage', + mode: Email::VALIDATION_MODE_HTML5_ALLOW_NO_TLD, + ); $this->validator->validate($email, $constraint); @@ -228,7 +226,7 @@ public static function getInvalidAllowNoTldEmails() public function testModeStrict() { - $constraint = new Email(['mode' => Email::VALIDATION_MODE_STRICT]); + $constraint = new Email(mode: Email::VALIDATION_MODE_STRICT); $this->validator->validate('example@mywebsite.tld', $constraint); @@ -237,7 +235,7 @@ public function testModeStrict() public function testModeHtml5() { - $constraint = new Email(['mode' => Email::VALIDATION_MODE_HTML5]); + $constraint = new Email(mode: Email::VALIDATION_MODE_HTML5); $this->validator->validate('example@example..com', $constraint); @@ -249,7 +247,7 @@ public function testModeHtml5() public function testModeHtml5AllowNoTld() { - $constraint = new Email(['mode' => Email::VALIDATION_MODE_HTML5_ALLOW_NO_TLD]); + $constraint = new Email(mode: Email::VALIDATION_MODE_HTML5_ALLOW_NO_TLD); $this->validator->validate('example@example', $constraint); @@ -272,10 +270,10 @@ public function testUnknownModesOnValidateTriggerException() */ public function testStrictWithInvalidEmails($email) { - $constraint = new Email([ - 'message' => 'myMessage', - 'mode' => Email::VALIDATION_MODE_STRICT, - ]); + $constraint = new Email( + message: 'myMessage', + mode: Email::VALIDATION_MODE_STRICT, + ); $this->validator->validate($email, $constraint); diff --git a/Tests/Constraints/EnableAutoMappingTest.php b/Tests/Constraints/EnableAutoMappingTest.php index 66ab42cdf..525a62ed5 100644 --- a/Tests/Constraints/EnableAutoMappingTest.php +++ b/Tests/Constraints/EnableAutoMappingTest.php @@ -23,6 +23,9 @@ */ class EnableAutoMappingTest extends TestCase { + /** + * @group legacy + */ public function testGroups() { $this->expectException(ConstraintDefinitionException::class); diff --git a/Tests/Constraints/EqualToValidatorTest.php b/Tests/Constraints/EqualToValidatorTest.php index b1af4ed18..c9a24ac4d 100644 --- a/Tests/Constraints/EqualToValidatorTest.php +++ b/Tests/Constraints/EqualToValidatorTest.php @@ -34,7 +34,11 @@ protected function createValidator(): EqualToValidator protected static function createConstraint(?array $options = null): Constraint { - return new EqualTo($options); + if (null !== $options) { + return new EqualTo(...$options); + } + + return new EqualTo(); } protected function getErrorCode(): ?string diff --git a/Tests/Constraints/ExpressionSyntaxTest.php b/Tests/Constraints/ExpressionSyntaxTest.php index 3f77cace2..8731a5d85 100644 --- a/Tests/Constraints/ExpressionSyntaxTest.php +++ b/Tests/Constraints/ExpressionSyntaxTest.php @@ -36,8 +36,6 @@ public function testValidatedByService(ExpressionSyntax $constraint) public static function provideServiceValidatedConstraints(): iterable { - yield 'Doctrine style' => [new ExpressionSyntax(['service' => 'my_service'])]; - yield 'named arguments' => [new ExpressionSyntax(service: 'my_service')]; $metadata = new ClassMetadata(ExpressionSyntaxDummy::class); @@ -46,6 +44,16 @@ public static function provideServiceValidatedConstraints(): iterable yield 'attribute' => [$metadata->properties['b']->constraints[0]]; } + /** + * @group legacy + */ + public function testValidatedByServiceDoctrineStyle() + { + $constraint = new ExpressionSyntax(['service' => 'my_service']); + + self::assertSame('my_service', $constraint->validatedBy()); + } + public function testAttributes() { $metadata = new ClassMetadata(ExpressionSyntaxDummy::class); diff --git a/Tests/Constraints/ExpressionSyntaxValidatorTest.php b/Tests/Constraints/ExpressionSyntaxValidatorTest.php index 65be7fb2a..3ca4e655b 100644 --- a/Tests/Constraints/ExpressionSyntaxValidatorTest.php +++ b/Tests/Constraints/ExpressionSyntaxValidatorTest.php @@ -40,49 +40,47 @@ public function testEmptyStringIsValid() public function testExpressionValid() { - $this->validator->validate('1 + 1', new ExpressionSyntax([ - 'message' => 'myMessage', - 'allowedVariables' => [], - ])); + $this->validator->validate('1 + 1', new ExpressionSyntax( + message: 'myMessage', + allowedVariables: [], + )); $this->assertNoViolation(); } public function testStringableExpressionValid() { - $this->validator->validate(new StringableValue('1 + 1'), new ExpressionSyntax([ - 'message' => 'myMessage', - 'allowedVariables' => [], - ])); + $this->validator->validate(new StringableValue('1 + 1'), new ExpressionSyntax( + message: 'myMessage', + allowedVariables: [], + )); $this->assertNoViolation(); } public function testExpressionWithoutNames() { - $this->validator->validate('1 + 1', new ExpressionSyntax([ - 'message' => 'myMessage', - ], null, null, [])); + $this->validator->validate('1 + 1', new ExpressionSyntax(null, 'myMessage', null, [])); $this->assertNoViolation(); } public function testExpressionWithAllowedVariableName() { - $this->validator->validate('a + 1', new ExpressionSyntax([ - 'message' => 'myMessage', - 'allowedVariables' => ['a'], - ])); + $this->validator->validate('a + 1', new ExpressionSyntax( + message: 'myMessage', + allowedVariables: ['a'], + )); $this->assertNoViolation(); } public function testExpressionIsNotValid() { - $this->validator->validate('a + 1', new ExpressionSyntax([ - 'message' => 'myMessage', - 'allowedVariables' => [], - ])); + $this->validator->validate('a + 1', new ExpressionSyntax( + message: 'myMessage', + allowedVariables: [], + )); $this->buildViolation('myMessage') ->setParameter('{{ syntax_error }}', '"Variable "a" is not valid around position 1 for expression `a + 1`."') @@ -93,10 +91,10 @@ public function testExpressionIsNotValid() public function testStringableExpressionIsNotValid() { - $this->validator->validate(new StringableValue('a + 1'), new ExpressionSyntax([ - 'message' => 'myMessage', - 'allowedVariables' => [], - ])); + $this->validator->validate(new StringableValue('a + 1'), new ExpressionSyntax( + message: 'myMessage', + allowedVariables: [], + )); $this->buildViolation('myMessage') ->setParameter('{{ syntax_error }}', '"Variable "a" is not valid around position 1 for expression `a + 1`."') diff --git a/Tests/Constraints/ExpressionTest.php b/Tests/Constraints/ExpressionTest.php index 97fcab838..07abb071d 100644 --- a/Tests/Constraints/ExpressionTest.php +++ b/Tests/Constraints/ExpressionTest.php @@ -51,6 +51,9 @@ public function testMissingPattern() new Expression(null); } + /** + * @group legacy + */ public function testMissingPatternDoctrineStyle() { $this->expectException(MissingOptionsException::class); diff --git a/Tests/Constraints/ExpressionValidatorTest.php b/Tests/Constraints/ExpressionValidatorTest.php index c237c793f..21c9eb630 100644 --- a/Tests/Constraints/ExpressionValidatorTest.php +++ b/Tests/Constraints/ExpressionValidatorTest.php @@ -31,10 +31,10 @@ protected function createValidator(): ExpressionValidator public function testExpressionIsEvaluatedWithNullValue() { - $constraint = new Expression([ - 'expression' => 'false', - 'message' => 'myMessage', - ]); + $constraint = new Expression( + expression: 'false', + message: 'myMessage', + ); $this->validator->validate(null, $constraint); @@ -46,10 +46,10 @@ public function testExpressionIsEvaluatedWithNullValue() public function testExpressionIsEvaluatedWithEmptyStringValue() { - $constraint = new Expression([ - 'expression' => 'false', - 'message' => 'myMessage', - ]); + $constraint = new Expression( + expression: 'false', + message: 'myMessage', + ); $this->validator->validate('', $constraint); @@ -75,10 +75,10 @@ public function testSucceedingExpressionAtObjectLevel() public function testFailingExpressionAtObjectLevel() { - $constraint = new Expression([ - 'expression' => 'this.data == 1', - 'message' => 'myMessage', - ]); + $constraint = new Expression( + expression: 'this.data == 1', + message: 'myMessage', + ); $object = new Entity(); $object->data = '2'; @@ -109,10 +109,10 @@ public function testSucceedingExpressionAtObjectLevelWithToString() public function testFailingExpressionAtObjectLevelWithToString() { - $constraint = new Expression([ - 'expression' => 'this.data == 1', - 'message' => 'myMessage', - ]); + $constraint = new Expression( + expression: 'this.data == 1', + message: 'myMessage', + ); $object = new ToString(); $object->data = '2'; @@ -145,10 +145,10 @@ public function testSucceedingExpressionAtPropertyLevel() public function testFailingExpressionAtPropertyLevel() { - $constraint = new Expression([ - 'expression' => 'value == this.data', - 'message' => 'myMessage', - ]); + $constraint = new Expression( + expression: 'value == this.data', + message: 'myMessage', + ); $object = new Entity(); $object->data = '1'; @@ -187,10 +187,10 @@ public function testSucceedingExpressionAtNestedPropertyLevel() public function testFailingExpressionAtNestedPropertyLevel() { - $constraint = new Expression([ - 'expression' => 'value == this.data', - 'message' => 'myMessage', - ]); + $constraint = new Expression( + expression: 'value == this.data', + message: 'myMessage', + ); $object = new Entity(); $object->data = '1'; @@ -234,10 +234,10 @@ public function testSucceedingExpressionAtPropertyLevelWithoutRoot() */ public function testFailingExpressionAtPropertyLevelWithoutRoot() { - $constraint = new Expression([ - 'expression' => 'value == "1"', - 'message' => 'myMessage', - ]); + $constraint = new Expression( + expression: 'value == "1"', + message: 'myMessage', + ); $this->setRoot('2'); $this->setPropertyPath(''); @@ -254,9 +254,7 @@ public function testFailingExpressionAtPropertyLevelWithoutRoot() public function testExpressionLanguageUsage() { - $constraint = new Expression([ - 'expression' => 'false', - ]); + $constraint = new Expression(expression: 'false'); $expressionLanguage = $this->createMock(ExpressionLanguage::class); @@ -278,12 +276,12 @@ public function testExpressionLanguageUsage() public function testPassingCustomValues() { - $constraint = new Expression([ - 'expression' => 'value + custom == 2', - 'values' => [ + $constraint = new Expression( + expression: 'value + custom == 2', + values: [ 'custom' => 1, ], - ]); + ); $this->validator->validate(1, $constraint); @@ -292,13 +290,13 @@ public function testPassingCustomValues() public function testViolationOnPass() { - $constraint = new Expression([ - 'expression' => 'value + custom != 2', - 'values' => [ + $constraint = new Expression( + expression: 'value + custom != 2', + values: [ 'custom' => 1, ], - 'negate' => false, - ]); + negate: false, + ); $this->validator->validate(2, $constraint); @@ -311,10 +309,11 @@ public function testViolationOnPass() public function testIsValidExpression() { - $constraints = [new NotNull(), new Range(['min' => 2])]; + $constraints = [new NotNull(), new Range(min: 2)]; $constraint = new Expression( - ['expression' => 'is_valid(this.data, a)', 'values' => ['a' => $constraints]] + expression: 'is_valid(this.data, a)', + values: ['a' => $constraints], ); $object = new Entity(); @@ -331,10 +330,11 @@ public function testIsValidExpression() public function testIsValidExpressionInvalid() { - $constraints = [new Range(['min' => 2, 'max' => 5])]; + $constraints = [new Range(min: 2, max: 5)]; $constraint = new Expression( - ['expression' => 'is_valid(this.data, a)', 'values' => ['a' => $constraints]] + expression: 'is_valid(this.data, a)', + values: ['a' => $constraints], ); $object = new Entity(); diff --git a/Tests/Constraints/FileTest.php b/Tests/Constraints/FileTest.php index e8c27b4b1..3e03f7881 100644 --- a/Tests/Constraints/FileTest.php +++ b/Tests/Constraints/FileTest.php @@ -14,6 +14,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints\File; use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\InvalidArgumentException; use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\Validator\Mapping\Loader\AttributeLoader; @@ -24,7 +25,7 @@ class FileTest extends TestCase */ public function testMaxSize($maxSize, $bytes, $binaryFormat) { - $file = new File(['maxSize' => $maxSize]); + $file = new File(maxSize: $maxSize); $this->assertSame($bytes, $file->maxSize); $this->assertSame($binaryFormat, $file->binaryFormat); @@ -33,7 +34,7 @@ public function testMaxSize($maxSize, $bytes, $binaryFormat) public function testMagicIsset() { - $file = new File(['maxSize' => 1]); + $file = new File(maxSize: 1); $this->assertTrue($file->__isset('maxSize')); $this->assertTrue($file->__isset('groups')); @@ -57,7 +58,7 @@ public function testMaxSizeCanBeSetAfterInitialization($maxSize, $bytes, $binary */ public function testInvalidValueForMaxSizeThrowsExceptionAfterInitialization($maxSize) { - $file = new File(['maxSize' => 1000]); + $file = new File(maxSize: 1000); $this->expectException(ConstraintDefinitionException::class); @@ -69,7 +70,7 @@ public function testInvalidValueForMaxSizeThrowsExceptionAfterInitialization($ma */ public function testMaxSizeCannotBeSetToInvalidValueAfterInitialization($maxSize) { - $file = new File(['maxSize' => 1000]); + $file = new File(maxSize: 1000); try { $file->maxSize = $maxSize; @@ -79,13 +80,38 @@ public function testMaxSizeCannotBeSetToInvalidValueAfterInitialization($maxSize $this->assertSame(1000, $file->maxSize); } + public function testFilenameMaxLength() + { + $file = new File(filenameMaxLength: 30); + $this->assertSame(30, $file->filenameMaxLength); + } + + public function testDefaultFilenameCountUnitIsUsed() + { + $file = new File(); + self::assertSame(File::FILENAME_COUNT_BYTES, $file->filenameCountUnit); + } + + public function testFilenameCharsetDefaultsToNull() + { + $file = new File(); + self::assertNull($file->filenameCharset); + } + + public function testInvalidFilenameCountUnitThrowsException() + { + self::expectException(InvalidArgumentException::class); + self::expectExceptionMessage(\sprintf('The "filenameCountUnit" option must be one of the "%s::FILENAME_COUNT_*" constants ("%s" given).', File::class, 'nonExistentCountUnit')); + $file = new File(filenameCountUnit: 'nonExistentCountUnit'); + } + /** * @dataProvider provideInValidSizes */ public function testInvalidMaxSize($maxSize) { $this->expectException(ConstraintDefinitionException::class); - new File(['maxSize' => $maxSize]); + new File(maxSize: $maxSize); } public static function provideValidSizes() @@ -125,7 +151,7 @@ public static function provideInvalidSizes() */ public function testBinaryFormat($maxSize, $guessedFormat, $binaryFormat) { - $file = new File(['maxSize' => $maxSize, 'binaryFormat' => $guessedFormat]); + $file = new File(maxSize: $maxSize, binaryFormat: $guessedFormat); $this->assertSame($binaryFormat, $file->binaryFormat); } @@ -162,6 +188,9 @@ public function testAttributes() self::assertSame(100000, $cConstraint->maxSize); self::assertSame(['my_group'], $cConstraint->groups); self::assertSame('some attached data', $cConstraint->payload); + self::assertSame(30, $cConstraint->filenameMaxLength); + self::assertSame('ISO-8859-15', $cConstraint->filenameCharset); + self::assertSame(File::FILENAME_COUNT_CODEPOINTS, $cConstraint->filenameCountUnit); } } @@ -173,6 +202,6 @@ class FileDummy #[File(maxSize: 100, notFoundMessage: 'myMessage')] private $b; - #[File(maxSize: '100K', groups: ['my_group'], payload: 'some attached data')] + #[File(maxSize: '100K', filenameMaxLength: 30, filenameCharset: 'ISO-8859-15', filenameCountUnit: File::FILENAME_COUNT_CODEPOINTS, groups: ['my_group'], payload: 'some attached data')] private $c; } diff --git a/Tests/Constraints/FileValidatorPathTest.php b/Tests/Constraints/FileValidatorPathTest.php index 9a8968801..37557aa1a 100644 --- a/Tests/Constraints/FileValidatorPathTest.php +++ b/Tests/Constraints/FileValidatorPathTest.php @@ -22,9 +22,9 @@ protected function getFile($filename) public function testFileNotFound() { - $constraint = new File([ - 'notFoundMessage' => 'myMessage', - ]); + $constraint = new File( + notFoundMessage: 'myMessage', + ); $this->validator->validate('foobar', $constraint); diff --git a/Tests/Constraints/FileValidatorTestCase.php b/Tests/Constraints/FileValidatorTestCase.php index b5d05801e..b1ebf530e 100644 --- a/Tests/Constraints/FileValidatorTestCase.php +++ b/Tests/Constraints/FileValidatorTestCase.php @@ -168,10 +168,10 @@ public function testMaxSizeExceeded($bytesWritten, $limit, $sizeAsString, $limit fwrite($this->file, '0'); fclose($this->file); - $constraint = new File([ - 'maxSize' => $limit, - 'maxSizeMessage' => 'myMessage', - ]); + $constraint = new File( + maxSize: $limit, + maxSizeMessage: 'myMessage', + ); $this->validator->validate($this->getFile($this->path), $constraint); @@ -220,10 +220,10 @@ public function testMaxSizeNotExceeded($bytesWritten, $limit) fwrite($this->file, '0'); fclose($this->file); - $constraint = new File([ - 'maxSize' => $limit, - 'maxSizeMessage' => 'myMessage', - ]); + $constraint = new File( + maxSize: $limit, + maxSizeMessage: 'myMessage', + ); $this->validator->validate($this->getFile($this->path), $constraint); @@ -233,9 +233,7 @@ public function testMaxSizeNotExceeded($bytesWritten, $limit) public function testInvalidMaxSize() { $this->expectException(ConstraintDefinitionException::class); - new File([ - 'maxSize' => '1abc', - ]); + new File(maxSize: '1abc'); } public static function provideBinaryFormatTests() @@ -269,11 +267,11 @@ public function testBinaryFormat($bytesWritten, $limit, $binaryFormat, $sizeAsSt fwrite($this->file, '0'); fclose($this->file); - $constraint = new File([ - 'maxSize' => $limit, - 'binaryFormat' => $binaryFormat, - 'maxSizeMessage' => 'myMessage', - ]); + $constraint = new File( + maxSize: $limit, + binaryFormat: $binaryFormat, + maxSizeMessage: 'myMessage', + ); $this->validator->validate($this->getFile($this->path), $constraint); @@ -322,9 +320,7 @@ public function testValidMimeType() ->method('getMimeType') ->willReturn('image/jpg'); - $constraint = new File([ - 'mimeTypes' => ['image/png', 'image/jpg'], - ]); + $constraint = new File(mimeTypes: ['image/png', 'image/jpg']); $this->validator->validate($file, $constraint); @@ -346,19 +342,14 @@ public function testValidWildcardMimeType() ->method('getMimeType') ->willReturn('image/jpg'); - $constraint = new File([ - 'mimeTypes' => ['image/*'], - ]); + $constraint = new File(mimeTypes: ['image/*']); $this->validator->validate($file, $constraint); $this->assertNoViolation(); } - /** - * @dataProvider provideMimeTypeConstraints - */ - public function testInvalidMimeType(File $constraint) + public function testInvalidMimeType() { $file = $this ->getMockBuilder(\Symfony\Component\HttpFoundation\File\File::class) @@ -373,7 +364,7 @@ public function testInvalidMimeType(File $constraint) ->method('getMimeType') ->willReturn('application/pdf'); - $this->validator->validate($file, $constraint); + $this->validator->validate($file, new File(mimeTypes: ['image/png', 'image/jpg'], mimeTypesMessage: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ type }}', '"application/pdf"') @@ -384,15 +375,36 @@ public function testInvalidMimeType(File $constraint) ->assertRaised(); } - public static function provideMimeTypeConstraints(): iterable + /** + * @group legacy + */ + public function testInvalidMimeTypeDoctrineStyle() { - yield 'Doctrine style' => [new File([ + $file = $this + ->getMockBuilder(\Symfony\Component\HttpFoundation\File\File::class) + ->setConstructorArgs([__DIR__.'/Fixtures/foo']) + ->getMock(); + $file + ->expects($this->once()) + ->method('getPathname') + ->willReturn($this->path); + $file + ->expects($this->once()) + ->method('getMimeType') + ->willReturn('application/pdf'); + + $this->validator->validate($file, new File([ 'mimeTypes' => ['image/png', 'image/jpg'], 'mimeTypesMessage' => 'myMessage', - ])]; - yield 'named arguments' => [ - new File(mimeTypes: ['image/png', 'image/jpg'], mimeTypesMessage: 'myMessage'), - ]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ type }}', '"application/pdf"') + ->setParameter('{{ types }}', '"image/png", "image/jpg"') + ->setParameter('{{ file }}', '"'.$this->path.'"') + ->setParameter('{{ name }}', '"'.basename($this->path).'"') + ->setCode(File::INVALID_MIME_TYPE_ERROR) + ->assertRaised(); } public function testInvalidWildcardMimeType() @@ -410,10 +422,10 @@ public function testInvalidWildcardMimeType() ->method('getMimeType') ->willReturn('application/pdf'); - $constraint = new File([ - 'mimeTypes' => ['image/*', 'image/jpg'], - 'mimeTypesMessage' => 'myMessage', - ]); + $constraint = new File( + mimeTypes: ['image/*', 'image/jpg'], + mimeTypesMessage: 'myMessage', + ); $this->validator->validate($file, $constraint); @@ -426,14 +438,11 @@ public function testInvalidWildcardMimeType() ->assertRaised(); } - /** - * @dataProvider provideDisallowEmptyConstraints - */ - public function testDisallowEmpty(File $constraint) + public function testDisallowEmpty() { ftruncate($this->file, 0); - $this->validator->validate($this->getFile($this->path), $constraint); + $this->validator->validate($this->getFile($this->path), new File(disallowEmptyMessage: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ file }}', '"'.$this->path.'"') @@ -442,14 +451,22 @@ public function testDisallowEmpty(File $constraint) ->assertRaised(); } - public static function provideDisallowEmptyConstraints(): iterable + /** + * @group legacy + */ + public function testDisallowEmptyDoctrineStyle() { - yield 'Doctrine style' => [new File([ + ftruncate($this->file, 0); + + $this->validator->validate($this->getFile($this->path), new File([ 'disallowEmptyMessage' => 'myMessage', - ])]; - yield 'named arguments' => [ - new File(disallowEmptyMessage: 'myMessage'), - ]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ file }}', '"'.$this->path.'"') + ->setParameter('{{ name }}', '"'.basename($this->path).'"') + ->setCode(File::EMPTY_ERROR) + ->assertRaised(); } /** @@ -459,7 +476,7 @@ public function testUploadedFileError($error, $message, array $params = [], $max { $file = new UploadedFile(tempnam(sys_get_temp_dir(), 'file-validator-test-'), 'originalName', 'mime', $error); - $constraint = new File([ + $constraint = new File(...[ $message => 'myMessage', 'maxSize' => $maxSize, ]); @@ -658,11 +675,11 @@ public function testUploadedFileExtensions() /** * @dataProvider provideFilenameMaxLengthIsTooLong */ - public function testFilenameMaxLengthIsTooLong(File $constraintFile, string $messageViolation) + public function testFilenameMaxLengthIsTooLong(File $constraintFile, string $filename, string $messageViolation) { file_put_contents($this->path, '1'); - $file = new UploadedFile($this->path, 'myFileWithATooLongOriginalFileName', null, null, true); + $file = new UploadedFile($this->path, $filename, null, null, true); $this->validator->validate($file, $constraintFile); $this->buildViolation($messageViolation) @@ -676,26 +693,83 @@ public function testFilenameMaxLengthIsTooLong(File $constraintFile, string $mes public static function provideFilenameMaxLengthIsTooLong(): \Generator { - yield 'Simple case with only the parameter "filenameMaxLength" ' => [ + yield 'Codepoints and UTF-8 : default' => [ new File(filenameMaxLength: 30), + 'myFileWithATooLongOriginalFileName', '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.', ]; - yield 'Case with the parameter "filenameMaxLength" and a custom error message' => [ - new File(filenameMaxLength: 20, filenameTooLongMessage: 'Your filename is too long. Please use at maximum {{ filename_max_length }} characters'), - 'Your filename is too long. Please use at maximum {{ filename_max_length }} characters', + yield 'Codepoints and UTF-8: custom error message' => [ + new File(filenameMaxLength: 20, filenameTooLongMessage: 'myMessage'), + 'myFileWithATooLongOriginalFileName', + 'myMessage', + ]; + + yield 'Graphemes' => [ + new File(filenameMaxLength: 1, filenameCountUnit: File::FILENAME_COUNT_GRAPHEMES, filenameTooLongMessage: 'myMessage'), + "A\u{0300}A\u{0300}", + 'myMessage', + ]; + + yield 'Bytes' => [ + new File(filenameMaxLength: 5, filenameCountUnit: File::FILENAME_COUNT_BYTES, filenameTooLongMessage: 'myMessage'), + "A\u{0300}A\u{0300}", + 'myMessage', ]; } - public function testFilenameMaxLength() + /** + * @dataProvider provideFilenameCountUnit + */ + public function testValidCountUnitFilenameMaxLength(int $maxLength, string $countUnit) { file_put_contents($this->path, '1'); - $file = new UploadedFile($this->path, 'tinyOriginalFileName', null, null, true); - $this->validator->validate($file, new File(filenameMaxLength: 20)); + $file = new UploadedFile($this->path, "A\u{0300}", null, null, true); + $this->validator->validate($file, new File(filenameMaxLength: $maxLength, filenameCountUnit: $countUnit)); $this->assertNoViolation(); } + /** + * @dataProvider provideFilenameCharset + */ + public function testFilenameCharset(string $filename, string $charset, bool $isValid) + { + file_put_contents($this->path, '1'); + + $file = new UploadedFile($this->path, $filename, null, null, true); + $this->validator->validate($file, new File(filenameCharset: $charset, filenameCharsetMessage: 'myMessage')); + + if ($isValid) { + $this->assertNoViolation(); + } else { + $this->buildViolation('myMessage') + ->setParameter('{{ name }}', '"'.$filename.'"') + ->setParameter('{{ charset }}', $charset) + ->setCode(File::FILENAME_INVALID_CHARACTERS) + ->assertRaised(); + } + } + + public static function provideFilenameCountUnit(): array + { + return [ + 'graphemes' => [1, File::FILENAME_COUNT_GRAPHEMES], + 'codepoints' => [2, File::FILENAME_COUNT_CODEPOINTS], + 'bytes' => [3, File::FILENAME_COUNT_BYTES], + ]; + } + + public static function provideFilenameCharset(): array + { + return [ + ['é', 'utf8', true], + ["\xE9", 'CP1252', true], + ["\xE9", 'XXX', false], + ["\xE9", 'utf8', false], + ]; + } + abstract protected function getFile($filename); } diff --git a/Tests/Constraints/Fixtures/WhenTestWithAttributes.php b/Tests/Constraints/Fixtures/WhenTestWithAttributes.php index a683eb3c6..31258dc0d 100644 --- a/Tests/Constraints/Fixtures/WhenTestWithAttributes.php +++ b/Tests/Constraints/Fixtures/WhenTestWithAttributes.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Tests\Constraints\Fixtures; use Symfony\Component\Validator\Constraints\Callback; +use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Component\Validator\Constraints\When; @@ -36,6 +37,9 @@ class WhenTestWithAttributes #[When(expression: 'true', constraints: new NotNull(), groups: ['foo'])] private $qux; + #[When(expression: 'true', constraints: new NotNull(), otherwise: new Length(exactly: 10), groups: ['foo'])] + private $quux; + #[When(expression: 'true', constraints: [ new NotNull(), new NotBlank(), diff --git a/Tests/Constraints/Fixtures/WhenTestWithClosure.php b/Tests/Constraints/Fixtures/WhenTestWithClosure.php new file mode 100644 index 000000000..de0f07daa --- /dev/null +++ b/Tests/Constraints/Fixtures/WhenTestWithClosure.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints\Fixtures; + +use Symfony\Component\Validator\Constraints\Callback; +use Symfony\Component\Validator\Constraints\NotBlank; +use Symfony\Component\Validator\Constraints\NotNull; +use Symfony\Component\Validator\Constraints\When; + +#[When(expression: static function () { + return true; + }, constraints: new Callback('isValid') +)] +class WhenTestWithClosure +{ + #[When(expression: static function () { + return true; + }, constraints: [ + new NotNull(), + new NotBlank(), + ])] + private $foo; +} diff --git a/Tests/Constraints/Fixtures/test_landscape.svg b/Tests/Constraints/Fixtures/test_landscape.svg new file mode 100644 index 000000000..e1212da08 --- /dev/null +++ b/Tests/Constraints/Fixtures/test_landscape.svg @@ -0,0 +1,2 @@ + + diff --git a/Tests/Constraints/Fixtures/test_landscape_height.svg b/Tests/Constraints/Fixtures/test_landscape_height.svg new file mode 100644 index 000000000..7a54631f1 --- /dev/null +++ b/Tests/Constraints/Fixtures/test_landscape_height.svg @@ -0,0 +1,2 @@ + + diff --git a/Tests/Constraints/Fixtures/test_landscape_width.svg b/Tests/Constraints/Fixtures/test_landscape_width.svg new file mode 100644 index 000000000..a64c0b1e0 --- /dev/null +++ b/Tests/Constraints/Fixtures/test_landscape_width.svg @@ -0,0 +1,2 @@ + + diff --git a/Tests/Constraints/Fixtures/test_landscape_width_height.svg b/Tests/Constraints/Fixtures/test_landscape_width_height.svg new file mode 100644 index 000000000..ec7b52445 --- /dev/null +++ b/Tests/Constraints/Fixtures/test_landscape_width_height.svg @@ -0,0 +1,2 @@ + + diff --git a/Tests/Constraints/Fixtures/test_no_size.svg b/Tests/Constraints/Fixtures/test_no_size.svg new file mode 100644 index 000000000..e0af766e8 --- /dev/null +++ b/Tests/Constraints/Fixtures/test_no_size.svg @@ -0,0 +1,2 @@ + + diff --git a/Tests/Constraints/Fixtures/test_portrait.svg b/Tests/Constraints/Fixtures/test_portrait.svg new file mode 100644 index 000000000..d17c991be --- /dev/null +++ b/Tests/Constraints/Fixtures/test_portrait.svg @@ -0,0 +1,2 @@ + + diff --git a/Tests/Constraints/Fixtures/test_square.svg b/Tests/Constraints/Fixtures/test_square.svg new file mode 100644 index 000000000..ffac7f14a --- /dev/null +++ b/Tests/Constraints/Fixtures/test_square.svg @@ -0,0 +1,2 @@ + + diff --git a/Tests/Constraints/GreaterThanOrEqualValidatorTest.php b/Tests/Constraints/GreaterThanOrEqualValidatorTest.php index 1bd4b6538..ae9f2034c 100644 --- a/Tests/Constraints/GreaterThanOrEqualValidatorTest.php +++ b/Tests/Constraints/GreaterThanOrEqualValidatorTest.php @@ -34,7 +34,11 @@ protected function createValidator(): GreaterThanOrEqualValidator protected static function createConstraint(?array $options = null): Constraint { - return new GreaterThanOrEqual($options); + if (null !== $options) { + return new GreaterThanOrEqual(...$options); + } + + return new GreaterThanOrEqual(); } protected function getErrorCode(): ?string diff --git a/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php b/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php index b05ba53a5..47f190851 100644 --- a/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php +++ b/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php @@ -61,6 +61,9 @@ public static function provideInvalidComparisons(): array ]; } + /** + * @group legacy + */ public function testThrowsConstraintExceptionIfPropertyPath() { $this->expectException(ConstraintDefinitionException::class); @@ -69,6 +72,9 @@ public function testThrowsConstraintExceptionIfPropertyPath() return new PositiveOrZero(['propertyPath' => 'field']); } + /** + * @group legacy + */ public function testThrowsConstraintExceptionIfValue() { $this->expectException(ConstraintDefinitionException::class); diff --git a/Tests/Constraints/GreaterThanValidatorTest.php b/Tests/Constraints/GreaterThanValidatorTest.php index 4cc64396d..0e74da15f 100644 --- a/Tests/Constraints/GreaterThanValidatorTest.php +++ b/Tests/Constraints/GreaterThanValidatorTest.php @@ -34,7 +34,11 @@ protected function createValidator(): GreaterThanValidator protected static function createConstraint(?array $options = null): Constraint { - return new GreaterThan($options); + if (null !== $options) { + return new GreaterThan(...$options); + } + + return new GreaterThan(); } protected function getErrorCode(): ?string diff --git a/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php b/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php index 0aa8aee93..6b58bff85 100644 --- a/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php +++ b/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php @@ -58,6 +58,9 @@ public static function provideInvalidComparisons(): array ]; } + /** + * @group legacy + */ public function testThrowsConstraintExceptionIfPropertyPath() { $this->expectException(ConstraintDefinitionException::class); @@ -66,6 +69,9 @@ public function testThrowsConstraintExceptionIfPropertyPath() return new Positive(['propertyPath' => 'field']); } + /** + * @group legacy + */ public function testThrowsConstraintExceptionIfValue() { $this->expectException(ConstraintDefinitionException::class); diff --git a/Tests/Constraints/HostnameValidatorTest.php b/Tests/Constraints/HostnameValidatorTest.php index f0b03e019..2471fe0b5 100644 --- a/Tests/Constraints/HostnameValidatorTest.php +++ b/Tests/Constraints/HostnameValidatorTest.php @@ -57,7 +57,7 @@ public function testValidTldDomainsPassValidationIfTldRequired($domain) */ public function testValidTldDomainsPassValidationIfTldNotRequired($domain) { - $this->validator->validate($domain, new Hostname(['requireTld' => false])); + $this->validator->validate($domain, new Hostname(requireTld: false)); $this->assertNoViolation(); } @@ -81,9 +81,7 @@ public static function getValidMultilevelDomains() */ public function testInvalidDomainsRaiseViolationIfTldRequired($domain) { - $this->validator->validate($domain, new Hostname([ - 'message' => 'myMessage', - ])); + $this->validator->validate($domain, new Hostname(message: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"'.$domain.'"') @@ -96,10 +94,10 @@ public function testInvalidDomainsRaiseViolationIfTldRequired($domain) */ public function testInvalidDomainsRaiseViolationIfTldNotRequired($domain) { - $this->validator->validate($domain, new Hostname([ - 'message' => 'myMessage', - 'requireTld' => false, - ])); + $this->validator->validate($domain, new Hostname( + message: 'myMessage', + requireTld: false, + )); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"'.$domain.'"') @@ -123,7 +121,7 @@ public static function getInvalidDomains() */ public function testReservedDomainsPassValidationIfTldNotRequired($domain) { - $this->validator->validate($domain, new Hostname(['requireTld' => false])); + $this->validator->validate($domain, new Hostname(requireTld: false)); $this->assertNoViolation(); } @@ -133,10 +131,10 @@ public function testReservedDomainsPassValidationIfTldNotRequired($domain) */ public function testReservedDomainsRaiseViolationIfTldRequired($domain) { - $this->validator->validate($domain, new Hostname([ - 'message' => 'myMessage', - 'requireTld' => true, - ])); + $this->validator->validate($domain, new Hostname( + message: 'myMessage', + requireTld: true, + )); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"'.$domain.'"') @@ -176,7 +174,7 @@ public function testReservedDomainsRaiseViolationIfTldRequiredNamed() */ public function testTopLevelDomainsPassValidationIfTldNotRequired($domain) { - $this->validator->validate($domain, new Hostname(['requireTld' => false])); + $this->validator->validate($domain, new Hostname(requireTld: false)); $this->assertNoViolation(); } @@ -186,10 +184,10 @@ public function testTopLevelDomainsPassValidationIfTldNotRequired($domain) */ public function testTopLevelDomainsRaiseViolationIfTldRequired($domain) { - $this->validator->validate($domain, new Hostname([ - 'message' => 'myMessage', - 'requireTld' => true, - ])); + $this->validator->validate($domain, new Hostname( + message: 'myMessage', + requireTld: true, + )); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"'.$domain.'"') diff --git a/Tests/Constraints/IbanValidatorTest.php b/Tests/Constraints/IbanValidatorTest.php index 2a8156914..184924d5e 100644 --- a/Tests/Constraints/IbanValidatorTest.php +++ b/Tests/Constraints/IbanValidatorTest.php @@ -488,9 +488,7 @@ public static function getIbansWithInvalidCountryCode() private function assertViolationRaised($iban, $code) { - $constraint = new Iban([ - 'message' => 'myMessage', - ]); + $constraint = new Iban(message: 'myMessage'); $this->validator->validate($iban, $constraint); diff --git a/Tests/Constraints/IdenticalToValidatorTest.php b/Tests/Constraints/IdenticalToValidatorTest.php index 66390a6de..97164b74c 100644 --- a/Tests/Constraints/IdenticalToValidatorTest.php +++ b/Tests/Constraints/IdenticalToValidatorTest.php @@ -34,7 +34,11 @@ protected function createValidator(): IdenticalToValidator protected static function createConstraint(?array $options = null): Constraint { - return new IdenticalTo($options); + if (null !== $options) { + return new IdenticalTo(...$options); + } + + return new IdenticalTo(); } protected function getErrorCode(): ?string diff --git a/Tests/Constraints/ImageValidatorTest.php b/Tests/Constraints/ImageValidatorTest.php index 892f346b9..7a7aa9197 100644 --- a/Tests/Constraints/ImageValidatorTest.php +++ b/Tests/Constraints/ImageValidatorTest.php @@ -74,12 +74,10 @@ public function testValidImage() /** * Checks that the logic from FileValidator still works. - * - * @dataProvider provideConstraintsWithNotFoundMessage */ - public function testFileNotFound(Image $constraint) + public function testFileNotFound() { - $this->validator->validate('foobar', $constraint); + $this->validator->validate('foobar', new Image(notFoundMessage: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ file }}', '"foobar"') @@ -87,36 +85,40 @@ public function testFileNotFound(Image $constraint) ->assertRaised(); } - public static function provideConstraintsWithNotFoundMessage(): iterable + /** + * Checks that the logic from FileValidator still works. + * + * @group legacy + */ + public function testFileNotFoundDoctrineStyle() { - yield 'Doctrine style' => [new Image([ + $this->validator->validate('foobar', new Image([ 'notFoundMessage' => 'myMessage', - ])]; - yield 'Named arguments' => [ - new Image(notFoundMessage: 'myMessage'), - ]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ file }}', '"foobar"') + ->setCode(Image::NOT_FOUND_ERROR) + ->assertRaised(); } public function testValidSize() { - $constraint = new Image([ - 'minWidth' => 1, - 'maxWidth' => 2, - 'minHeight' => 1, - 'maxHeight' => 2, - ]); + $constraint = new Image( + minWidth: 1, + maxWidth: 2, + minHeight: 1, + maxHeight: 2, + ); $this->validator->validate($this->image, $constraint); $this->assertNoViolation(); } - /** - * @dataProvider provideMinWidthConstraints - */ - public function testWidthTooSmall(Image $constraint) + public function testWidthTooSmall() { - $this->validator->validate($this->image, $constraint); + $this->validator->validate($this->image, new Image(minWidth: 3, minWidthMessage: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ width }}', '2') @@ -125,23 +127,26 @@ public function testWidthTooSmall(Image $constraint) ->assertRaised(); } - public static function provideMinWidthConstraints(): iterable + /** + * @group legacy + */ + public function testWidthTooSmallDoctrineStyle() { - yield 'Doctrine style' => [new Image([ + $this->validator->validate($this->image, new Image([ 'minWidth' => 3, 'minWidthMessage' => 'myMessage', - ])]; - yield 'Named arguments' => [ - new Image(minWidth: 3, minWidthMessage: 'myMessage'), - ]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ width }}', '2') + ->setParameter('{{ min_width }}', '3') + ->setCode(Image::TOO_NARROW_ERROR) + ->assertRaised(); } - /** - * @dataProvider provideMaxWidthConstraints - */ - public function testWidthTooBig(Image $constraint) + public function testWidthTooBig() { - $this->validator->validate($this->image, $constraint); + $this->validator->validate($this->image, new Image(maxWidth: 1, maxWidthMessage: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ width }}', '2') @@ -150,23 +155,26 @@ public function testWidthTooBig(Image $constraint) ->assertRaised(); } - public static function provideMaxWidthConstraints(): iterable + /** + * @group legacy + */ + public function testWidthTooBigDoctrineStyle() { - yield 'Doctrine style' => [new Image([ + $this->validator->validate($this->image, new Image([ 'maxWidth' => 1, 'maxWidthMessage' => 'myMessage', - ])]; - yield 'Named arguments' => [ - new Image(maxWidth: 1, maxWidthMessage: 'myMessage'), - ]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ width }}', '2') + ->setParameter('{{ max_width }}', '1') + ->setCode(Image::TOO_WIDE_ERROR) + ->assertRaised(); } - /** - * @dataProvider provideMinHeightConstraints - */ - public function testHeightTooSmall(Image $constraint) + public function testHeightTooSmall() { - $this->validator->validate($this->image, $constraint); + $this->validator->validate($this->image, new Image(minHeight: 3, minHeightMessage: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ height }}', '2') @@ -175,23 +183,26 @@ public function testHeightTooSmall(Image $constraint) ->assertRaised(); } - public static function provideMinHeightConstraints(): iterable + /** + * @group legacy + */ + public function testHeightTooSmallDoctrineStyle() { - yield 'Doctrine style' => [new Image([ + $this->validator->validate($this->image, new Image([ 'minHeight' => 3, 'minHeightMessage' => 'myMessage', - ])]; - yield 'Named arguments' => [ - new Image(minHeight: 3, minHeightMessage: 'myMessage'), - ]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ height }}', '2') + ->setParameter('{{ min_height }}', '3') + ->setCode(Image::TOO_LOW_ERROR) + ->assertRaised(); } - /** - * @dataProvider provideMaxHeightConstraints - */ - public function testHeightTooBig(Image $constraint) + public function testHeightTooBig() { - $this->validator->validate($this->image, $constraint); + $this->validator->validate($this->image, new Image(maxHeight: 1, maxHeightMessage: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ height }}', '2') @@ -200,23 +211,26 @@ public function testHeightTooBig(Image $constraint) ->assertRaised(); } - public static function provideMaxHeightConstraints(): iterable + /** + * @group legacy + */ + public function testHeightTooBigDoctrineStyle() { - yield 'Doctrine style' => [new Image([ + $this->validator->validate($this->image, new Image([ 'maxHeight' => 1, 'maxHeightMessage' => 'myMessage', - ])]; - yield 'Named arguments' => [ - new Image(maxHeight: 1, maxHeightMessage: 'myMessage'), - ]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ height }}', '2') + ->setParameter('{{ max_height }}', '1') + ->setCode(Image::TOO_HIGH_ERROR) + ->assertRaised(); } - /** - * @dataProvider provideMinPixelsConstraints - */ - public function testPixelsTooFew(Image $constraint) + public function testPixelsTooFew() { - $this->validator->validate($this->image, $constraint); + $this->validator->validate($this->image, new Image(minPixels: 5, minPixelsMessage: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ pixels }}', '4') @@ -227,23 +241,28 @@ public function testPixelsTooFew(Image $constraint) ->assertRaised(); } - public static function provideMinPixelsConstraints(): iterable + /** + * @group legacy + */ + public function testPixelsTooFewDoctrineStyle() { - yield 'Doctrine style' => [new Image([ + $this->validator->validate($this->image, new Image([ 'minPixels' => 5, 'minPixelsMessage' => 'myMessage', - ])]; - yield 'Named arguments' => [ - new Image(minPixels: 5, minPixelsMessage: 'myMessage'), - ]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ pixels }}', '4') + ->setParameter('{{ min_pixels }}', '5') + ->setParameter('{{ height }}', '2') + ->setParameter('{{ width }}', '2') + ->setCode(Image::TOO_FEW_PIXEL_ERROR) + ->assertRaised(); } - /** - * @dataProvider provideMaxPixelsConstraints - */ - public function testPixelsTooMany(Image $constraint) + public function testPixelsTooMany() { - $this->validator->validate($this->image, $constraint); + $this->validator->validate($this->image, new Image(maxPixels: 3, maxPixelsMessage: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ pixels }}', '4') @@ -254,23 +273,28 @@ public function testPixelsTooMany(Image $constraint) ->assertRaised(); } - public static function provideMaxPixelsConstraints(): iterable + /** + * @group legacy + */ + public function testPixelsTooManyDoctrineStyle() { - yield 'Doctrine style' => [new Image([ + $this->validator->validate($this->image, new Image([ 'maxPixels' => 3, 'maxPixelsMessage' => 'myMessage', - ])]; - yield 'Named arguments' => [ - new Image(maxPixels: 3, maxPixelsMessage: 'myMessage'), - ]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ pixels }}', '4') + ->setParameter('{{ max_pixels }}', '3') + ->setParameter('{{ height }}', '2') + ->setParameter('{{ width }}', '2') + ->setCode(Image::TOO_MANY_PIXEL_ERROR) + ->assertRaised(); } - /** - * @dataProvider provideMinRatioConstraints - */ - public function testRatioTooSmall(Image $constraint) + public function testRatioTooSmall() { - $this->validator->validate($this->image, $constraint); + $this->validator->validate($this->image, new Image(minRatio: 2, minRatioMessage: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ ratio }}', 1) @@ -279,23 +303,26 @@ public function testRatioTooSmall(Image $constraint) ->assertRaised(); } - public static function provideMinRatioConstraints(): iterable + /** + * @group legacy + */ + public function testRatioTooSmallDoctrineStyle() { - yield 'Doctrine style' => [new Image([ + $this->validator->validate($this->image, new Image([ 'minRatio' => 2, 'minRatioMessage' => 'myMessage', - ])]; - yield 'Named arguments' => [ - new Image(minRatio: 2, minRatioMessage: 'myMessage'), - ]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ ratio }}', 1) + ->setParameter('{{ min_ratio }}', 2) + ->setCode(Image::RATIO_TOO_SMALL_ERROR) + ->assertRaised(); } - /** - * @dataProvider provideMaxRatioConstraints - */ - public function testRatioTooBig(Image $constraint) + public function testRatioTooBig() { - $this->validator->validate($this->image, $constraint); + $this->validator->validate($this->image, new Image(maxRatio: 0.5, maxRatioMessage: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ ratio }}', 1) @@ -304,22 +331,26 @@ public function testRatioTooBig(Image $constraint) ->assertRaised(); } - public static function provideMaxRatioConstraints(): iterable + /** + * @group legacy + */ + public function testRatioTooBigDoctrineStyle() { - yield 'Doctrine style' => [new Image([ + $this->validator->validate($this->image, new Image([ 'maxRatio' => 0.5, 'maxRatioMessage' => 'myMessage', - ])]; - yield 'Named arguments' => [ - new Image(maxRatio: 0.5, maxRatioMessage: 'myMessage'), - ]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ ratio }}', 1) + ->setParameter('{{ max_ratio }}', 0.5) + ->setCode(Image::RATIO_TOO_BIG_ERROR) + ->assertRaised(); } public function testMaxRatioUsesTwoDecimalsOnly() { - $constraint = new Image([ - 'maxRatio' => 1.33, - ]); + $constraint = new Image(maxRatio: 1.33); $this->validator->validate($this->image4By3, $constraint); @@ -328,9 +359,7 @@ public function testMaxRatioUsesTwoDecimalsOnly() public function testMinRatioUsesInputMoreDecimals() { - $constraint = new Image([ - 'minRatio' => 4 / 3, - ]); + $constraint = new Image(minRatio: 4 / 3); $this->validator->validate($this->image4By3, $constraint); @@ -339,21 +368,16 @@ public function testMinRatioUsesInputMoreDecimals() public function testMaxRatioUsesInputMoreDecimals() { - $constraint = new Image([ - 'maxRatio' => 16 / 9, - ]); + $constraint = new Image(maxRatio: 16 / 9); $this->validator->validate($this->image16By9, $constraint); $this->assertNoViolation(); } - /** - * @dataProvider provideAllowSquareConstraints - */ - public function testSquareNotAllowed(Image $constraint) + public function testSquareNotAllowed() { - $this->validator->validate($this->image, $constraint); + $this->validator->validate($this->image, new Image(allowSquare: false, allowSquareMessage: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ width }}', 2) @@ -362,23 +386,26 @@ public function testSquareNotAllowed(Image $constraint) ->assertRaised(); } - public static function provideAllowSquareConstraints(): iterable + /** + * @group legacy + */ + public function testSquareNotAllowedDoctrineStyle() { - yield 'Doctrine style' => [new Image([ + $this->validator->validate($this->image, new Image([ 'allowSquare' => false, 'allowSquareMessage' => 'myMessage', - ])]; - yield 'Named arguments' => [ - new Image(allowSquare: false, allowSquareMessage: 'myMessage'), - ]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ width }}', 2) + ->setParameter('{{ height }}', 2) + ->setCode(Image::SQUARE_NOT_ALLOWED_ERROR) + ->assertRaised(); } - /** - * @dataProvider provideAllowLandscapeConstraints - */ - public function testLandscapeNotAllowed(Image $constraint) + public function testLandscapeNotAllowed() { - $this->validator->validate($this->imageLandscape, $constraint); + $this->validator->validate($this->imageLandscape, new Image(allowLandscape: false, allowLandscapeMessage: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ width }}', 2) @@ -387,23 +414,26 @@ public function testLandscapeNotAllowed(Image $constraint) ->assertRaised(); } - public static function provideAllowLandscapeConstraints(): iterable + /** + * @group legacy + */ + public function testLandscapeNotAllowedDoctrineStyle() { - yield 'Doctrine style' => [new Image([ + $this->validator->validate($this->imageLandscape, new Image([ 'allowLandscape' => false, 'allowLandscapeMessage' => 'myMessage', - ])]; - yield 'Named arguments' => [ - new Image(allowLandscape: false, allowLandscapeMessage: 'myMessage'), - ]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ width }}', 2) + ->setParameter('{{ height }}', 1) + ->setCode(Image::LANDSCAPE_NOT_ALLOWED_ERROR) + ->assertRaised(); } - /** - * @dataProvider provideAllowPortraitConstraints - */ - public function testPortraitNotAllowed(Image $constraint) + public function testPortraitNotAllowed() { - $this->validator->validate($this->imagePortrait, $constraint); + $this->validator->validate($this->imagePortrait, new Image(allowPortrait: false, allowPortraitMessage: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ width }}', 1) @@ -412,26 +442,56 @@ public function testPortraitNotAllowed(Image $constraint) ->assertRaised(); } - public static function provideAllowPortraitConstraints(): iterable + /** + * @group legacy + */ + public function testPortraitNotAllowedDoctrineStyle() { - yield 'Doctrine style' => [new Image([ + $this->validator->validate($this->imagePortrait, new Image([ 'allowPortrait' => false, 'allowPortraitMessage' => 'myMessage', - ])]; - yield 'Named arguments' => [ - new Image(allowPortrait: false, allowPortraitMessage: 'myMessage'), - ]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ width }}', 1) + ->setParameter('{{ height }}', 2) + ->setCode(Image::PORTRAIT_NOT_ALLOWED_ERROR) + ->assertRaised(); + } + + public function testCorrupted() + { + if (!\function_exists('imagecreatefromstring')) { + $this->markTestSkipped('This test require GD extension'); + } + + $constraint = new Image(detectCorrupted: true, corruptedMessage: 'myMessage'); + + $this->validator->validate($this->image, $constraint); + + $this->assertNoViolation(); + + $this->validator->validate($this->imageCorrupted, $constraint); + + $this->buildViolation('myMessage') + ->setCode(Image::CORRUPTED_IMAGE_ERROR) + ->assertRaised(); } /** - * @dataProvider provideDetectCorruptedConstraints + * @group legacy */ - public function testCorrupted(Image $constraint) + public function testCorruptedDoctrineStyle() { if (!\function_exists('imagecreatefromstring')) { $this->markTestSkipped('This test require GD extension'); } + $constraint = new Image([ + 'detectCorrupted' => true, + 'corruptedMessage' => 'myMessage', + ]); + $this->validator->validate($this->image, $constraint); $this->assertNoViolation(); @@ -458,23 +518,33 @@ public function testInvalidMimeType() ->assertRaised(); } - public static function provideDetectCorruptedConstraints(): iterable + public function testInvalidMimeTypeWithNarrowedSet() { - yield 'Doctrine style' => [new Image([ - 'detectCorrupted' => true, - 'corruptedMessage' => 'myMessage', - ])]; - yield 'Named arguments' => [ - new Image(detectCorrupted: true, corruptedMessage: 'myMessage'), - ]; + $this->validator->validate($this->image, new Image(mimeTypes: [ + 'image/jpeg', + 'image/png', + ])); + + $this->buildViolation('The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.') + ->setParameter('{{ file }}', \sprintf('"%s"', $this->image)) + ->setParameter('{{ type }}', '"image/gif"') + ->setParameter('{{ types }}', '"image/jpeg", "image/png"') + ->setParameter('{{ name }}', '"test.gif"') + ->setCode(Image::INVALID_MIME_TYPE_ERROR) + ->assertRaised(); } /** - * @dataProvider provideInvalidMimeTypeWithNarrowedSet + * @group legacy */ - public function testInvalidMimeTypeWithNarrowedSet(Image $constraint) + public function testInvalidMimeTypeWithNarrowedSetDoctrineStyle() { - $this->validator->validate($this->image, $constraint); + $this->validator->validate($this->image, new Image([ + 'mimeTypes' => [ + 'image/jpeg', + 'image/png', + ], + ])); $this->buildViolation('The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.') ->setParameter('{{ file }}', \sprintf('"%s"', $this->image)) @@ -485,19 +555,139 @@ public function testInvalidMimeTypeWithNarrowedSet(Image $constraint) ->assertRaised(); } - public static function provideInvalidMimeTypeWithNarrowedSet() + /** @dataProvider provideSvgWithViolation */ + public function testSvgWithViolation(string $image, Image $constraint, string $violation, array $parameters = []) { - yield 'Doctrine style' => [new Image([ - 'mimeTypes' => [ - 'image/jpeg', - 'image/png', + $this->validator->validate($image, $constraint); + + $this->buildViolation('myMessage') + ->setCode($violation) + ->setParameters($parameters) + ->assertRaised(); + } + + public static function provideSvgWithViolation(): iterable + { + yield 'No size svg' => [ + __DIR__.'/Fixtures/test_no_size.svg', + new Image(allowLandscape: false, sizeNotDetectedMessage: 'myMessage'), + Image::SIZE_NOT_DETECTED_ERROR, + ]; + + yield 'Landscape SVG not allowed' => [ + __DIR__.'/Fixtures/test_landscape.svg', + new Image(allowLandscape: false, allowLandscapeMessage: 'myMessage'), + Image::LANDSCAPE_NOT_ALLOWED_ERROR, + [ + '{{ width }}' => 500, + '{{ height }}' => 200, ], - ])]; - yield 'Named arguments' => [ - new Image(mimeTypes: [ - 'image/jpeg', - 'image/png', - ]), + ]; + + yield 'Portrait SVG not allowed' => [ + __DIR__.'/Fixtures/test_portrait.svg', + new Image(allowPortrait: false, allowPortraitMessage: 'myMessage'), + Image::PORTRAIT_NOT_ALLOWED_ERROR, + [ + '{{ width }}' => 200, + '{{ height }}' => 500, + ], + ]; + + yield 'Square SVG not allowed' => [ + __DIR__.'/Fixtures/test_square.svg', + new Image(allowSquare: false, allowSquareMessage: 'myMessage'), + Image::SQUARE_NOT_ALLOWED_ERROR, + [ + '{{ width }}' => 500, + '{{ height }}' => 500, + ], + ]; + + yield 'Landscape with width attribute SVG allowed' => [ + __DIR__.'/Fixtures/test_landscape_width.svg', + new Image(allowLandscape: false, allowLandscapeMessage: 'myMessage'), + Image::LANDSCAPE_NOT_ALLOWED_ERROR, + [ + '{{ width }}' => 600, + '{{ height }}' => 200, + ], + ]; + + yield 'Landscape with height attribute SVG not allowed' => [ + __DIR__.'/Fixtures/test_landscape_height.svg', + new Image(allowLandscape: false, allowLandscapeMessage: 'myMessage'), + Image::LANDSCAPE_NOT_ALLOWED_ERROR, + [ + '{{ width }}' => 500, + '{{ height }}' => 300, + ], + ]; + + yield 'Landscape with width and height attribute SVG not allowed' => [ + __DIR__.'/Fixtures/test_landscape_width_height.svg', + new Image(allowLandscape: false, allowLandscapeMessage: 'myMessage'), + Image::LANDSCAPE_NOT_ALLOWED_ERROR, + [ + '{{ width }}' => 600, + '{{ height }}' => 300, + ], + ]; + + yield 'SVG Min ratio 2' => [ + __DIR__.'/Fixtures/test_square.svg', + new Image(minRatio: 2, minRatioMessage: 'myMessage'), + Image::RATIO_TOO_SMALL_ERROR, + [ + '{{ ratio }}' => '1', + '{{ min_ratio }}' => '2', + ], + ]; + + yield 'SVG Min ratio 0.5' => [ + __DIR__.'/Fixtures/test_square.svg', + new Image(maxRatio: 0.5, maxRatioMessage: 'myMessage'), + Image::RATIO_TOO_BIG_ERROR, + [ + '{{ ratio }}' => '1', + '{{ max_ratio }}' => '0.5', + ], + ]; + } + + /** @dataProvider provideSvgWithoutViolation */ + public function testSvgWithoutViolation(string $image, Image $constraint) + { + $this->validator->validate($image, $constraint); + + $this->assertNoViolation(); + } + + public static function provideSvgWithoutViolation(): iterable + { + yield 'Landscape SVG allowed' => [ + __DIR__.'/Fixtures/test_landscape.svg', + new Image(allowLandscape: true, allowLandscapeMessage: 'myMessage'), + ]; + + yield 'Portrait SVG allowed' => [ + __DIR__.'/Fixtures/test_portrait.svg', + new Image(allowPortrait: true, allowPortraitMessage: 'myMessage'), + ]; + + yield 'Square SVG allowed' => [ + __DIR__.'/Fixtures/test_square.svg', + new Image(allowSquare: true, allowSquareMessage: 'myMessage'), + ]; + + yield 'SVG Min ratio 1' => [ + __DIR__.'/Fixtures/test_square.svg', + new Image(minRatio: 1, minRatioMessage: 'myMessage'), + ]; + + yield 'SVG Max ratio 1' => [ + __DIR__.'/Fixtures/test_square.svg', + new Image(maxRatio: 1, maxRatioMessage: 'myMessage'), ]; } diff --git a/Tests/Constraints/IpTest.php b/Tests/Constraints/IpTest.php index 7f391153f..2d740ae88 100644 --- a/Tests/Constraints/IpTest.php +++ b/Tests/Constraints/IpTest.php @@ -24,11 +24,14 @@ class IpTest extends TestCase { public function testNormalizerCanBeSet() { - $ip = new Ip(['normalizer' => 'trim']); + $ip = new Ip(normalizer: 'trim'); $this->assertEquals('trim', $ip->normalizer); } + /** + * @group legacy + */ public function testInvalidNormalizerThrowsException() { $this->expectException(InvalidArgumentException::class); @@ -36,6 +39,9 @@ public function testInvalidNormalizerThrowsException() new Ip(['normalizer' => 'Unknown Callable']); } + /** + * @group legacy + */ public function testInvalidNormalizerObjectThrowsException() { $this->expectException(InvalidArgumentException::class); diff --git a/Tests/Constraints/IpValidatorTest.php b/Tests/Constraints/IpValidatorTest.php index a2277a3d8..e37d61bb6 100644 --- a/Tests/Constraints/IpValidatorTest.php +++ b/Tests/Constraints/IpValidatorTest.php @@ -47,9 +47,7 @@ public function testExpectsStringCompatibleType() public function testInvalidValidatorVersion() { $this->expectException(ConstraintDefinitionException::class); - new Ip([ - 'version' => 666, - ]); + new Ip(version: 666); } /** @@ -57,9 +55,7 @@ public function testInvalidValidatorVersion() */ public function testValidIpsV4($ip) { - $this->validator->validate($ip, new Ip([ - 'version' => Ip::V4, - ])); + $this->validator->validate($ip, new Ip(version: Ip::V4)); $this->assertNoViolation(); } @@ -83,10 +79,10 @@ public static function getValidIpsV4() */ public function testValidIpsV4WithWhitespaces($ip) { - $this->validator->validate($ip, new Ip([ - 'version' => Ip::V4, - 'normalizer' => 'trim', - ])); + $this->validator->validate($ip, new Ip( + version: Ip::V4, + normalizer: 'trim', + )); $this->assertNoViolation(); } @@ -118,9 +114,7 @@ public static function getValidIpsV4WithWhitespaces() */ public function testValidIpsV6($ip) { - $this->validator->validate($ip, new Ip([ - 'version' => Ip::V6, - ])); + $this->validator->validate($ip, new Ip(version: Ip::V6)); $this->assertNoViolation(); } @@ -155,9 +149,7 @@ public static function getValidIpsV6() */ public function testValidIpsAll($ip) { - $this->validator->validate($ip, new Ip([ - 'version' => Ip::ALL, - ])); + $this->validator->validate($ip, new Ip(version: Ip::ALL)); $this->assertNoViolation(); } @@ -172,10 +164,10 @@ public static function getValidIpsAll() */ public function testInvalidIpsV4($ip) { - $constraint = new Ip([ - 'version' => Ip::V4, - 'message' => 'myMessage', - ]); + $constraint = new Ip( + version: Ip::V4, + message: 'myMessage', + ); $this->validator->validate($ip, $constraint); @@ -190,10 +182,10 @@ public function testInvalidIpsV4($ip) */ public function testInvalidNoPublicIpsV4($ip) { - $constraint = new Ip([ - 'version' => Ip::V4_NO_PUBLIC, - 'message' => 'myMessage', - ]); + $constraint = new Ip( + version: Ip::V4_NO_PUBLIC, + message: 'myMessage', + ); $this->validator->validate($ip, $constraint); @@ -232,9 +224,7 @@ public static function getInvalidIpsV4() */ public function testValidPrivateIpsV4($ip) { - $this->validator->validate($ip, new Ip([ - 'version' => Ip::V4_ONLY_PRIVATE, - ])); + $this->validator->validate($ip, new Ip(version: Ip::V4_ONLY_PRIVATE)); $this->assertNoViolation(); } @@ -244,10 +234,10 @@ public function testValidPrivateIpsV4($ip) */ public function testInvalidPrivateIpsV4($ip) { - $constraint = new Ip([ - 'version' => Ip::V4_NO_PRIVATE, - 'message' => 'myMessage', - ]); + $constraint = new Ip( + version: Ip::V4_NO_PRIVATE, + message: 'myMessage', + ); $this->validator->validate($ip, $constraint); @@ -262,10 +252,10 @@ public function testInvalidPrivateIpsV4($ip) */ public function testInvalidOnlyPrivateIpsV4($ip) { - $constraint = new Ip([ - 'version' => Ip::V4_ONLY_PRIVATE, - 'message' => 'myMessage', - ]); + $constraint = new Ip( + version: Ip::V4_ONLY_PRIVATE, + message: 'myMessage', + ); $this->validator->validate($ip, $constraint); @@ -294,9 +284,7 @@ public static function getInvalidPrivateIpsV4() */ public function testValidReservedIpsV4($ip) { - $this->validator->validate($ip, new Ip([ - 'version' => Ip::V4_ONLY_RESERVED, - ])); + $this->validator->validate($ip, new Ip(version: Ip::V4_ONLY_RESERVED)); $this->assertNoViolation(); } @@ -306,10 +294,10 @@ public function testValidReservedIpsV4($ip) */ public function testInvalidReservedIpsV4($ip) { - $constraint = new Ip([ - 'version' => Ip::V4_NO_RESERVED, - 'message' => 'myMessage', - ]); + $constraint = new Ip( + version: Ip::V4_NO_RESERVED, + message: 'myMessage', + ); $this->validator->validate($ip, $constraint); @@ -324,10 +312,10 @@ public function testInvalidReservedIpsV4($ip) */ public function testInvalidOnlyReservedIpsV4($ip) { - $constraint = new Ip([ - 'version' => Ip::V4_ONLY_RESERVED, - 'message' => 'myMessage', - ]); + $constraint = new Ip( + version: Ip::V4_ONLY_RESERVED, + message: 'myMessage', + ); $this->validator->validate($ip, $constraint); @@ -356,10 +344,10 @@ public static function getInvalidReservedIpsV4() */ public function testInvalidPublicIpsV4($ip) { - $constraint = new Ip([ - 'version' => Ip::V4_ONLY_PUBLIC, - 'message' => 'myMessage', - ]); + $constraint = new Ip( + version: Ip::V4_ONLY_PUBLIC, + message: 'myMessage', + ); $this->validator->validate($ip, $constraint); @@ -379,10 +367,10 @@ public static function getInvalidPublicIpsV4() */ public function testInvalidIpsV6($ip) { - $constraint = new Ip([ - 'version' => Ip::V6, - 'message' => 'myMessage', - ]); + $constraint = new Ip( + version: Ip::V6, + message: 'myMessage', + ); $this->validator->validate($ip, $constraint); @@ -416,10 +404,10 @@ public static function getInvalidIpsV6() */ public function testInvalidPrivateIpsV6($ip) { - $constraint = new Ip([ - 'version' => Ip::V6_NO_PRIVATE, - 'message' => 'myMessage', - ]); + $constraint = new Ip( + version: Ip::V6_NO_PRIVATE, + message: 'myMessage', + ); $this->validator->validate($ip, $constraint); @@ -443,10 +431,10 @@ public static function getInvalidPrivateIpsV6() */ public function testInvalidReservedIpsV6($ip) { - $constraint = new Ip([ - 'version' => Ip::V6_NO_RESERVED, - 'message' => 'myMessage', - ]); + $constraint = new Ip( + version: Ip::V6_NO_RESERVED, + message: 'myMessage', + ); $this->validator->validate($ip, $constraint); @@ -469,10 +457,10 @@ public static function getInvalidReservedIpsV6() */ public function testInvalidPublicIpsV6($ip) { - $constraint = new Ip([ - 'version' => Ip::V6_ONLY_PUBLIC, - 'message' => 'myMessage', - ]); + $constraint = new Ip( + version: Ip::V6_ONLY_PUBLIC, + message: 'myMessage', + ); $this->validator->validate($ip, $constraint); @@ -492,10 +480,10 @@ public static function getInvalidPublicIpsV6() */ public function testInvalidIpsAll($ip) { - $constraint = new Ip([ - 'version' => Ip::ALL, - 'message' => 'myMessage', - ]); + $constraint = new Ip( + version: Ip::ALL, + message: 'myMessage', + ); $this->validator->validate($ip, $constraint); @@ -515,10 +503,10 @@ public static function getInvalidIpsAll() */ public function testInvalidPrivateIpsAll($ip) { - $constraint = new Ip([ - 'version' => Ip::ALL_NO_PRIVATE, - 'message' => 'myMessage', - ]); + $constraint = new Ip( + version: Ip::ALL_NO_PRIVATE, + message: 'myMessage', + ); $this->validator->validate($ip, $constraint); @@ -538,10 +526,10 @@ public static function getInvalidPrivateIpsAll() */ public function testInvalidReservedIpsAll($ip) { - $constraint = new Ip([ - 'version' => Ip::ALL_NO_RESERVED, - 'message' => 'myMessage', - ]); + $constraint = new Ip( + version: Ip::ALL_NO_RESERVED, + message: 'myMessage', + ); $this->validator->validate($ip, $constraint); @@ -561,10 +549,10 @@ public static function getInvalidReservedIpsAll() */ public function testInvalidPublicIpsAll($ip) { - $constraint = new Ip([ - 'version' => Ip::ALL_ONLY_PUBLIC, - 'message' => 'myMessage', - ]); + $constraint = new Ip( + version: Ip::ALL_ONLY_PUBLIC, + message: 'myMessage', + ); $this->validator->validate($ip, $constraint); diff --git a/Tests/Constraints/IsFalseValidatorTest.php b/Tests/Constraints/IsFalseValidatorTest.php index e59764764..c6e2ccef6 100644 --- a/Tests/Constraints/IsFalseValidatorTest.php +++ b/Tests/Constraints/IsFalseValidatorTest.php @@ -36,12 +36,9 @@ public function testFalseIsValid() $this->assertNoViolation(); } - /** - * @dataProvider provideInvalidConstraints - */ - public function testTrueIsInvalid(IsFalse $constraint) + public function testTrueIsInvalid() { - $this->validator->validate(true, $constraint); + $this->validator->validate(true, new IsFalse(message: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ value }}', 'true') @@ -49,11 +46,20 @@ public function testTrueIsInvalid(IsFalse $constraint) ->assertRaised(); } - public static function provideInvalidConstraints(): iterable + /** + * @group legacy + */ + public function testTrueIsInvalidDoctrineStyle() { - yield 'Doctrine style' => [new IsFalse([ + $constraint = new IsFalse([ 'message' => 'myMessage', - ])]; - yield 'named parameters' => [new IsFalse(message: 'myMessage')]; + ]); + + $this->validator->validate(true, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', 'true') + ->setCode(IsFalse::NOT_FALSE_ERROR) + ->assertRaised(); } } diff --git a/Tests/Constraints/IsNullValidatorTest.php b/Tests/Constraints/IsNullValidatorTest.php index f0ff58f34..ed6beffc4 100644 --- a/Tests/Constraints/IsNullValidatorTest.php +++ b/Tests/Constraints/IsNullValidatorTest.php @@ -34,9 +34,7 @@ public function testNullIsValid() */ public function testInvalidValues($value, $valueAsString) { - $constraint = new IsNull([ - 'message' => 'myMessage', - ]); + $constraint = new IsNull(message: 'myMessage'); $this->validator->validate($value, $constraint); diff --git a/Tests/Constraints/IsTrueValidatorTest.php b/Tests/Constraints/IsTrueValidatorTest.php index 1dc47f4b0..4a9eb7702 100644 --- a/Tests/Constraints/IsTrueValidatorTest.php +++ b/Tests/Constraints/IsTrueValidatorTest.php @@ -36,12 +36,9 @@ public function testTrueIsValid() $this->assertNoViolation(); } - /** - * @dataProvider provideInvalidConstraints - */ - public function testFalseIsInvalid(IsTrue $constraint) + public function testFalseIsInvalid() { - $this->validator->validate(false, $constraint); + $this->validator->validate(false, new IsTrue(message: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ value }}', 'false') @@ -49,11 +46,18 @@ public function testFalseIsInvalid(IsTrue $constraint) ->assertRaised(); } - public static function provideInvalidConstraints(): iterable + /** + * @group legacy + */ + public function testFalseIsInvalidDoctrineStyle() { - yield 'Doctrine style' => [new IsTrue([ + $this->validator->validate(false, new IsTrue([ 'message' => 'myMessage', - ])]; - yield 'named parameters' => [new IsTrue(message: 'myMessage')]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', 'false') + ->setCode(IsTrue::NOT_TRUE_ERROR) + ->assertRaised(); } } diff --git a/Tests/Constraints/IsbnValidatorTest.php b/Tests/Constraints/IsbnValidatorTest.php index 3b257026f..3ae3864d5 100644 --- a/Tests/Constraints/IsbnValidatorTest.php +++ b/Tests/Constraints/IsbnValidatorTest.php @@ -150,9 +150,7 @@ public function testExpectsStringCompatibleType() */ public function testValidIsbn10($isbn) { - $constraint = new Isbn([ - 'type' => 'isbn10', - ]); + $constraint = new Isbn(type: 'isbn10'); $this->validator->validate($isbn, $constraint); @@ -160,6 +158,8 @@ public function testValidIsbn10($isbn) } /** + * @group legacy + * * @dataProvider getInvalidIsbn10 */ public function testInvalidIsbn10($isbn, $code) @@ -195,7 +195,7 @@ public function testInvalidIsbn10Named() */ public function testValidIsbn13($isbn) { - $constraint = new Isbn(['type' => 'isbn13']); + $constraint = new Isbn(type: 'isbn13'); $this->validator->validate($isbn, $constraint); @@ -203,6 +203,8 @@ public function testValidIsbn13($isbn) } /** + * @group legacy + * * @dataProvider getInvalidIsbn13 */ public function testInvalidIsbn13($isbn, $code) @@ -220,16 +222,21 @@ public function testInvalidIsbn13($isbn, $code) ->assertRaised(); } - public function testInvalidIsbn13Named() + /** + * @dataProvider getInvalidIsbn13 + */ + public function testInvalidIsbn13Named($isbn, $code) { - $this->validator->validate( - '2723442284', - new Isbn(type: Isbn::ISBN_13, isbn13Message: 'myMessage') + $constraint = new Isbn( + type: Isbn::ISBN_13, + isbn13Message: 'myMessage', ); + $this->validator->validate($isbn, $constraint); + $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"2723442284"') - ->setCode(Isbn::TOO_SHORT_ERROR) + ->setParameter('{{ value }}', '"'.$isbn.'"') + ->setCode($code) ->assertRaised(); } @@ -250,9 +257,7 @@ public function testValidIsbnAny($isbn) */ public function testInvalidIsbnAnyIsbn10($isbn, $code) { - $constraint = new Isbn([ - 'bothIsbnMessage' => 'myMessage', - ]); + $constraint = new Isbn(bothIsbnMessage: 'myMessage'); $this->validator->validate($isbn, $constraint); @@ -272,9 +277,7 @@ public function testInvalidIsbnAnyIsbn10($isbn, $code) */ public function testInvalidIsbnAnyIsbn13($isbn, $code) { - $constraint = new Isbn([ - 'bothIsbnMessage' => 'myMessage', - ]); + $constraint = new Isbn(bothIsbnMessage: 'myMessage'); $this->validator->validate($isbn, $constraint); diff --git a/Tests/Constraints/IsinValidatorTest.php b/Tests/Constraints/IsinValidatorTest.php index dca4a423f..b1ac3be20 100644 --- a/Tests/Constraints/IsinValidatorTest.php +++ b/Tests/Constraints/IsinValidatorTest.php @@ -130,9 +130,7 @@ public static function getIsinWithValidFormatButIncorrectChecksum() private function assertViolationRaised($isin, $code) { - $constraint = new Isin([ - 'message' => 'myMessage', - ]); + $constraint = new Isin(message: 'myMessage'); $this->validator->validate($isin, $constraint); diff --git a/Tests/Constraints/IssnValidatorTest.php b/Tests/Constraints/IssnValidatorTest.php index 9eece3eb9..6351ab620 100644 --- a/Tests/Constraints/IssnValidatorTest.php +++ b/Tests/Constraints/IssnValidatorTest.php @@ -119,10 +119,10 @@ public function testExpectsStringCompatibleType() */ public function testCaseSensitiveIssns($issn) { - $constraint = new Issn([ - 'caseSensitive' => true, - 'message' => 'myMessage', - ]); + $constraint = new Issn( + caseSensitive: true, + message: 'myMessage', + ); $this->validator->validate($issn, $constraint); @@ -137,10 +137,10 @@ public function testCaseSensitiveIssns($issn) */ public function testRequireHyphenIssns($issn) { - $constraint = new Issn([ - 'requireHyphen' => true, - 'message' => 'myMessage', - ]); + $constraint = new Issn( + requireHyphen: true, + message: 'myMessage', + ); $this->validator->validate($issn, $constraint); @@ -167,9 +167,7 @@ public function testValidIssn($issn) */ public function testInvalidIssn($issn, $code) { - $constraint = new Issn([ - 'message' => 'myMessage', - ]); + $constraint = new Issn(message: 'myMessage'); $this->validator->validate($issn, $constraint); diff --git a/Tests/Constraints/JsonValidatorTest.php b/Tests/Constraints/JsonValidatorTest.php index 92d8a20a7..123cb95fe 100644 --- a/Tests/Constraints/JsonValidatorTest.php +++ b/Tests/Constraints/JsonValidatorTest.php @@ -37,9 +37,7 @@ public function testJsonIsValid($value) */ public function testInvalidValues($value) { - $constraint = new Json([ - 'message' => 'myMessageTest', - ]); + $constraint = new Json(message: 'myMessageTest'); $this->validator->validate($value, $constraint); diff --git a/Tests/Constraints/LanguageValidatorTest.php b/Tests/Constraints/LanguageValidatorTest.php index 9abb9cfc4..9522fba75 100644 --- a/Tests/Constraints/LanguageValidatorTest.php +++ b/Tests/Constraints/LanguageValidatorTest.php @@ -83,9 +83,7 @@ public static function getValidLanguages() */ public function testInvalidLanguages($language) { - $constraint = new Language([ - 'message' => 'myMessage', - ]); + $constraint = new Language(message: 'myMessage'); $this->validator->validate($language, $constraint); @@ -108,9 +106,7 @@ public static function getInvalidLanguages() */ public function testValidAlpha3Languages($language) { - $this->validator->validate($language, new Language([ - 'alpha3' => true, - ])); + $this->validator->validate($language, new Language(alpha3: true)); $this->assertNoViolation(); } @@ -129,10 +125,10 @@ public static function getValidAlpha3Languages() */ public function testInvalidAlpha3Languages($language) { - $constraint = new Language([ - 'alpha3' => true, - 'message' => 'myMessage', - ]); + $constraint = new Language( + alpha3: true, + message: 'myMessage', + ); $this->validator->validate($language, $constraint); @@ -167,14 +163,12 @@ public function testInvalidAlpha3LanguageNamed() public function testValidateUsingCountrySpecificLocale() { - IntlTestHelper::requireFullIntl($this, false); + IntlTestHelper::requireFullIntl($this); \Locale::setDefault('fr_FR'); $existingLanguage = 'en'; - $this->validator->validate($existingLanguage, new Language([ - 'message' => 'aMessage', - ])); + $this->validator->validate($existingLanguage, new Language(message: 'aMessage')); $this->assertNoViolation(); } diff --git a/Tests/Constraints/LengthTest.php b/Tests/Constraints/LengthTest.php index 6af8a7bc1..6e292cb35 100644 --- a/Tests/Constraints/LengthTest.php +++ b/Tests/Constraints/LengthTest.php @@ -24,11 +24,18 @@ class LengthTest extends TestCase { public function testNormalizerCanBeSet() { - $length = new Length(['min' => 0, 'max' => 10, 'normalizer' => 'trim']); + $length = new Length( + min: 0, + max: 10, + normalizer: 'trim', + ); $this->assertEquals('trim', $length->normalizer); } + /** + * @group legacy + */ public function testInvalidNormalizerThrowsException() { $this->expectException(InvalidArgumentException::class); @@ -36,6 +43,9 @@ public function testInvalidNormalizerThrowsException() new Length(['min' => 0, 'max' => 10, 'normalizer' => 'Unknown Callable']); } + /** + * @group legacy + */ public function testInvalidNormalizerObjectThrowsException() { $this->expectException(InvalidArgumentException::class); @@ -45,13 +55,13 @@ public function testInvalidNormalizerObjectThrowsException() public function testDefaultCountUnitIsUsed() { - $length = new Length(['min' => 0, 'max' => 10]); + $length = new Length(min: 0, max: 10); $this->assertSame(Length::COUNT_CODEPOINTS, $length->countUnit); } public function testNonDefaultCountUnitCanBeSet() { - $length = new Length(['min' => 0, 'max' => 10, 'countUnit' => Length::COUNT_GRAPHEMES]); + $length = new Length(min: 0, max: 10, countUnit: Length::COUNT_GRAPHEMES); $this->assertSame(Length::COUNT_GRAPHEMES, $length->countUnit); } @@ -59,7 +69,7 @@ public function testInvalidCountUnitThrowsException() { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage(\sprintf('The "countUnit" option must be one of the "%s"::COUNT_* constants ("%s" given).', Length::class, 'nonExistentCountUnit')); - new Length(['min' => 0, 'max' => 10, 'countUnit' => 'nonExistentCountUnit']); + new Length(min: 0, max: 10, countUnit: 'nonExistentCountUnit'); } public function testConstraintDefaultOption() @@ -72,7 +82,7 @@ public function testConstraintDefaultOption() public function testConstraintAttributeDefaultOption() { - $constraint = new Length(['value' => 5, 'exactMessage' => 'message']); + $constraint = new Length(exactly: 5, exactMessage: 'message'); self::assertEquals(5, $constraint->min); self::assertEquals(5, $constraint->max); diff --git a/Tests/Constraints/LengthValidatorTest.php b/Tests/Constraints/LengthValidatorTest.php index 0afc9e6e1..10f61f50b 100644 --- a/Tests/Constraints/LengthValidatorTest.php +++ b/Tests/Constraints/LengthValidatorTest.php @@ -25,17 +25,17 @@ protected function createValidator(): LengthValidator public function testNullIsValid() { - $this->validator->validate(null, new Length(['value' => 6])); + $this->validator->validate(null, new Length(exactly: 6)); $this->assertNoViolation(); } public function testEmptyStringIsInvalid() { - $this->validator->validate('', new Length([ - 'value' => $limit = 6, - 'exactMessage' => 'myMessage', - ])); + $this->validator->validate('', new Length( + exactly: $limit = 6, + exactMessage: 'myMessage', + )); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '""') @@ -50,7 +50,7 @@ public function testEmptyStringIsInvalid() public function testExpectsStringCompatibleType() { $this->expectException(UnexpectedValueException::class); - $this->validator->validate(new \stdClass(), new Length(['value' => 5])); + $this->validator->validate(new \stdClass(), new Length(exactly: 5)); } public static function getThreeOrLessCharacters() @@ -118,7 +118,7 @@ public static function getThreeCharactersWithWhitespaces() */ public function testValidValuesMin(int|string $value) { - $constraint = new Length(['min' => 5]); + $constraint = new Length(min: 5); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -129,7 +129,7 @@ public function testValidValuesMin(int|string $value) */ public function testValidValuesMax(int|string $value) { - $constraint = new Length(['max' => 3]); + $constraint = new Length(max: 3); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -151,7 +151,7 @@ public function testValidValuesExact(int|string $value) */ public function testValidNormalizedValues($value) { - $constraint = new Length(['min' => 3, 'max' => 3, 'normalizer' => 'trim']); + $constraint = new Length(min: 3, max: 3, normalizer: 'trim'); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -186,10 +186,10 @@ public function testValidBytesValues() */ public function testInvalidValuesMin(int|string $value, int $valueLength) { - $constraint = new Length([ - 'min' => 4, - 'minMessage' => 'myMessage', - ]); + $constraint = new Length( + min: 4, + minMessage: 'myMessage', + ); $this->validator->validate($value, $constraint); @@ -227,10 +227,10 @@ public function testInvalidValuesMinNamed(int|string $value, int $valueLength) */ public function testInvalidValuesMax(int|string $value, int $valueLength) { - $constraint = new Length([ - 'max' => 4, - 'maxMessage' => 'myMessage', - ]); + $constraint = new Length( + max: 4, + maxMessage: 'myMessage', + ); $this->validator->validate($value, $constraint); @@ -268,11 +268,11 @@ public function testInvalidValuesMaxNamed(int|string $value, int $valueLength) */ public function testInvalidValuesExactLessThanFour(int|string $value, int $valueLength) { - $constraint = new Length([ - 'min' => 4, - 'max' => 4, - 'exactMessage' => 'myMessage', - ]); + $constraint = new Length( + min: 4, + max: 4, + exactMessage: 'myMessage', + ); $this->validator->validate($value, $constraint); @@ -310,11 +310,11 @@ public function testInvalidValuesExactLessThanFourNamed(int|string $value, int $ */ public function testInvalidValuesExactMoreThanFour(int|string $value, int $valueLength) { - $constraint = new Length([ - 'min' => 4, - 'max' => 4, - 'exactMessage' => 'myMessage', - ]); + $constraint = new Length( + min: 4, + max: 4, + exactMessage: 'myMessage', + ); $this->validator->validate($value, $constraint); @@ -333,12 +333,12 @@ public function testInvalidValuesExactMoreThanFour(int|string $value, int $value */ public function testOneCharset($value, $charset, $isValid) { - $constraint = new Length([ - 'min' => 1, - 'max' => 1, - 'charset' => $charset, - 'charsetMessage' => 'myMessage', - ]); + $constraint = new Length( + min: 1, + max: 1, + charset: $charset, + charsetMessage: 'myMessage', + ); $this->validator->validate($value, $constraint); diff --git a/Tests/Constraints/LessThanOrEqualValidatorTest.php b/Tests/Constraints/LessThanOrEqualValidatorTest.php index 4c0aa5349..9a84043ca 100644 --- a/Tests/Constraints/LessThanOrEqualValidatorTest.php +++ b/Tests/Constraints/LessThanOrEqualValidatorTest.php @@ -34,7 +34,11 @@ protected function createValidator(): LessThanOrEqualValidator protected static function createConstraint(?array $options = null): Constraint { - return new LessThanOrEqual($options); + if (null !== $options) { + return new LessThanOrEqual(...$options); + } + + return new LessThanOrEqual(); } protected function getErrorCode(): ?string diff --git a/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php b/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php index 43bca5121..685bb58a6 100644 --- a/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php +++ b/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php @@ -59,6 +59,9 @@ public static function provideInvalidComparisons(): array ]; } + /** + * @group legacy + */ public function testThrowsConstraintExceptionIfPropertyPath() { $this->expectException(ConstraintDefinitionException::class); @@ -67,6 +70,9 @@ public function testThrowsConstraintExceptionIfPropertyPath() return new NegativeOrZero(['propertyPath' => 'field']); } + /** + * @group legacy + */ public function testThrowsConstraintExceptionIfValue() { $this->expectException(ConstraintDefinitionException::class); diff --git a/Tests/Constraints/LessThanValidatorTest.php b/Tests/Constraints/LessThanValidatorTest.php index c6918942d..da7f929cd 100644 --- a/Tests/Constraints/LessThanValidatorTest.php +++ b/Tests/Constraints/LessThanValidatorTest.php @@ -34,7 +34,11 @@ protected function createValidator(): LessThanValidator protected static function createConstraint(?array $options = null): Constraint { - return new LessThan($options); + if (null !== $options) { + return new LessThan(...$options); + } + + return new LessThan(); } protected function getErrorCode(): ?string diff --git a/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php b/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php index fa820c19b..5174a951d 100644 --- a/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php +++ b/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php @@ -58,6 +58,9 @@ public static function provideInvalidComparisons(): array ]; } + /** + * @group legacy + */ public function testThrowsConstraintExceptionIfPropertyPath() { $this->expectException(ConstraintDefinitionException::class); @@ -66,6 +69,9 @@ public function testThrowsConstraintExceptionIfPropertyPath() return new Negative(['propertyPath' => 'field']); } + /** + * @group legacy + */ public function testThrowsConstraintExceptionIfValue() { $this->expectException(ConstraintDefinitionException::class); diff --git a/Tests/Constraints/LocaleValidatorTest.php b/Tests/Constraints/LocaleValidatorTest.php index 82c5a5dd8..3b3819512 100644 --- a/Tests/Constraints/LocaleValidatorTest.php +++ b/Tests/Constraints/LocaleValidatorTest.php @@ -71,9 +71,7 @@ public static function getValidLocales() */ public function testInvalidLocales($locale) { - $constraint = new Locale([ - 'message' => 'myMessage', - ]); + $constraint = new Locale(message: 'myMessage'); $this->validator->validate($locale, $constraint); @@ -93,9 +91,7 @@ public static function getInvalidLocales() public function testTooLongLocale() { - $constraint = new Locale([ - 'message' => 'myMessage', - ]); + $constraint = new Locale(message: 'myMessage'); $locale = str_repeat('a', (\defined('INTL_MAX_LOCALE_LEN') ? \INTL_MAX_LOCALE_LEN : 85) + 1); $this->validator->validate($locale, $constraint); @@ -111,9 +107,7 @@ public function testTooLongLocale() */ public function testValidLocalesWithCanonicalization(string $locale) { - $constraint = new Locale([ - 'message' => 'myMessage', - ]); + $constraint = new Locale(message: 'myMessage'); $this->validator->validate($locale, $constraint); @@ -125,10 +119,10 @@ public function testValidLocalesWithCanonicalization(string $locale) */ public function testValidLocalesWithoutCanonicalization(string $locale) { - $constraint = new Locale([ - 'message' => 'myMessage', - 'canonicalize' => false, - ]); + $constraint = new Locale( + message: 'myMessage', + canonicalize: false, + ); $this->validator->validate($locale, $constraint); @@ -140,10 +134,10 @@ public function testValidLocalesWithoutCanonicalization(string $locale) */ public function testInvalidLocalesWithoutCanonicalization(string $locale) { - $constraint = new Locale([ - 'message' => 'myMessage', - 'canonicalize' => false, - ]); + $constraint = new Locale( + message: 'myMessage', + canonicalize: false, + ); $this->validator->validate($locale, $constraint); diff --git a/Tests/Constraints/LuhnValidatorTest.php b/Tests/Constraints/LuhnValidatorTest.php index b0571ebd0..9eb33bde6 100644 --- a/Tests/Constraints/LuhnValidatorTest.php +++ b/Tests/Constraints/LuhnValidatorTest.php @@ -76,9 +76,7 @@ public static function getValidNumbers() */ public function testInvalidNumbers($number, $code) { - $constraint = new Luhn([ - 'message' => 'myMessage', - ]); + $constraint = new Luhn(message: 'myMessage'); $this->validator->validate($number, $constraint); diff --git a/Tests/Constraints/NoSuspiciousCharactersValidatorTest.php b/Tests/Constraints/NoSuspiciousCharactersValidatorTest.php index d15e41660..c38a431f5 100644 --- a/Tests/Constraints/NoSuspiciousCharactersValidatorTest.php +++ b/Tests/Constraints/NoSuspiciousCharactersValidatorTest.php @@ -32,7 +32,7 @@ protected function createValidator(): NoSuspiciousCharactersValidator */ public function testNonSuspiciousStrings(string $string, array $options = []) { - $this->validator->validate($string, new NoSuspiciousCharacters($options)); + $this->validator->validate($string, new NoSuspiciousCharacters(...$options)); $this->assertNoViolation(); } @@ -58,7 +58,7 @@ public static function provideNonSuspiciousStrings(): iterable */ public function testSuspiciousStrings(string $string, array $options, array $errors) { - $this->validator->validate($string, new NoSuspiciousCharacters($options)); + $this->validator->validate($string, new NoSuspiciousCharacters(...$options)); $violations = null; diff --git a/Tests/Constraints/NotBlankTest.php b/Tests/Constraints/NotBlankTest.php index 77435a37a..d04a65f1c 100644 --- a/Tests/Constraints/NotBlankTest.php +++ b/Tests/Constraints/NotBlankTest.php @@ -24,7 +24,7 @@ class NotBlankTest extends TestCase { public function testNormalizerCanBeSet() { - $notBlank = new NotBlank(['normalizer' => 'trim']); + $notBlank = new NotBlank(normalizer: 'trim'); $this->assertEquals('trim', $notBlank->normalizer); } @@ -45,6 +45,9 @@ public function testAttributes() self::assertSame('myMessage', $bConstraint->message); } + /** + * @group legacy + */ public function testInvalidNormalizerThrowsException() { $this->expectException(InvalidArgumentException::class); @@ -52,6 +55,9 @@ public function testInvalidNormalizerThrowsException() new NotBlank(['normalizer' => 'Unknown Callable']); } + /** + * @group legacy + */ public function testInvalidNormalizerObjectThrowsException() { $this->expectException(InvalidArgumentException::class); diff --git a/Tests/Constraints/NotBlankValidatorTest.php b/Tests/Constraints/NotBlankValidatorTest.php index 8d1ba3d0f..42d5f3a60 100644 --- a/Tests/Constraints/NotBlankValidatorTest.php +++ b/Tests/Constraints/NotBlankValidatorTest.php @@ -45,9 +45,7 @@ public static function getValidValues() public function testNullIsInvalid() { - $constraint = new NotBlank([ - 'message' => 'myMessage', - ]); + $constraint = new NotBlank(message: 'myMessage'); $this->validator->validate(null, $constraint); @@ -59,9 +57,7 @@ public function testNullIsInvalid() public function testBlankIsInvalid() { - $constraint = new NotBlank([ - 'message' => 'myMessage', - ]); + $constraint = new NotBlank(message: 'myMessage'); $this->validator->validate('', $constraint); @@ -73,9 +69,7 @@ public function testBlankIsInvalid() public function testFalseIsInvalid() { - $constraint = new NotBlank([ - 'message' => 'myMessage', - ]); + $constraint = new NotBlank(message: 'myMessage'); $this->validator->validate(false, $constraint); @@ -87,9 +81,7 @@ public function testFalseIsInvalid() public function testEmptyArrayIsInvalid() { - $constraint = new NotBlank([ - 'message' => 'myMessage', - ]); + $constraint = new NotBlank(message: 'myMessage'); $this->validator->validate([], $constraint); @@ -101,10 +93,10 @@ public function testEmptyArrayIsInvalid() public function testAllowNullTrue() { - $constraint = new NotBlank([ - 'message' => 'myMessage', - 'allowNull' => true, - ]); + $constraint = new NotBlank( + message: 'myMessage', + allowNull: true, + ); $this->validator->validate(null, $constraint); $this->assertNoViolation(); @@ -112,10 +104,10 @@ public function testAllowNullTrue() public function testAllowNullFalse() { - $constraint = new NotBlank([ - 'message' => 'myMessage', - 'allowNull' => false, - ]); + $constraint = new NotBlank( + message: 'myMessage', + allowNull: false, + ); $this->validator->validate(null, $constraint); @@ -130,10 +122,10 @@ public function testAllowNullFalse() */ public function testNormalizedStringIsInvalid($value) { - $constraint = new NotBlank([ - 'message' => 'myMessage', - 'normalizer' => 'trim', - ]); + $constraint = new NotBlank( + message: 'myMessage', + normalizer: 'trim', + ); $this->validator->validate($value, $constraint); diff --git a/Tests/Constraints/NotCompromisedPasswordValidatorTest.php b/Tests/Constraints/NotCompromisedPasswordValidatorTest.php index 3ff24eb94..11c325d53 100644 --- a/Tests/Constraints/NotCompromisedPasswordValidatorTest.php +++ b/Tests/Constraints/NotCompromisedPasswordValidatorTest.php @@ -87,7 +87,7 @@ public function testInvalidPassword() public function testThresholdReached() { - $constraint = new NotCompromisedPassword(['threshold' => 3]); + $constraint = new NotCompromisedPassword(threshold: 3); $this->validator->validate(self::PASSWORD_LEAKED, $constraint); $this->buildViolation($constraint->message) @@ -95,20 +95,21 @@ public function testThresholdReached() ->assertRaised(); } - /** - * @dataProvider provideConstraintsWithThreshold - */ - public function testThresholdNotReached(NotCompromisedPassword $constraint) + public function testThresholdNotReached() { - $this->validator->validate(self::PASSWORD_LEAKED, $constraint); + $this->validator->validate(self::PASSWORD_LEAKED, new NotCompromisedPassword(threshold: 10)); $this->assertNoViolation(); } - public static function provideConstraintsWithThreshold(): iterable + /** + * @group legacy + */ + public function testThresholdNotReachedDoctrineStyle() { - yield 'Doctrine style' => [new NotCompromisedPassword(['threshold' => 10])]; - yield 'named arguments' => [new NotCompromisedPassword(threshold: 10)]; + $this->validator->validate(self::PASSWORD_LEAKED, new NotCompromisedPassword(['threshold' => 10])); + + $this->assertNoViolation(); } public function testValidPassword() @@ -208,20 +209,21 @@ public function testApiError() $this->validator->validate(self::PASSWORD_TRIGGERING_AN_ERROR, new NotCompromisedPassword()); } - /** - * @dataProvider provideErrorSkippingConstraints - */ - public function testApiErrorSkipped(NotCompromisedPassword $constraint) + public function testApiErrorSkipped() { $this->expectNotToPerformAssertions(); - $this->validator->validate(self::PASSWORD_TRIGGERING_AN_ERROR, $constraint); + $this->validator->validate(self::PASSWORD_TRIGGERING_AN_ERROR, new NotCompromisedPassword(skipOnError: true)); } - public static function provideErrorSkippingConstraints(): iterable + /** + * @group legacy + */ + public function testApiErrorSkippedDoctrineStyle() { - yield 'Doctrine style' => [new NotCompromisedPassword(['skipOnError' => true])]; - yield 'named arguments' => [new NotCompromisedPassword(skipOnError: true)]; + $this->expectNotToPerformAssertions(); + + $this->validator->validate(self::PASSWORD_TRIGGERING_AN_ERROR, new NotCompromisedPassword(['skipOnError' => true])); } private function createHttpClientStub(?string $returnValue = null): HttpClientInterface diff --git a/Tests/Constraints/NotEqualToValidatorTest.php b/Tests/Constraints/NotEqualToValidatorTest.php index 52e25a8db..2f6948db9 100644 --- a/Tests/Constraints/NotEqualToValidatorTest.php +++ b/Tests/Constraints/NotEqualToValidatorTest.php @@ -34,7 +34,11 @@ protected function createValidator(): NotEqualToValidator protected static function createConstraint(?array $options = null): Constraint { - return new NotEqualTo($options); + if (null !== $options) { + return new NotEqualTo(...$options); + } + + return new NotEqualTo(); } protected function getErrorCode(): ?string diff --git a/Tests/Constraints/NotIdenticalToValidatorTest.php b/Tests/Constraints/NotIdenticalToValidatorTest.php index 825a5ff9f..9831d26cb 100644 --- a/Tests/Constraints/NotIdenticalToValidatorTest.php +++ b/Tests/Constraints/NotIdenticalToValidatorTest.php @@ -34,7 +34,11 @@ protected function createValidator(): NotIdenticalToValidator protected static function createConstraint(?array $options = null): Constraint { - return new NotIdenticalTo($options); + if (null !== $options) { + return new NotIdenticalTo(...$options); + } + + return new NotIdenticalTo(); } protected function getErrorCode(): ?string diff --git a/Tests/Constraints/NotNullValidatorTest.php b/Tests/Constraints/NotNullValidatorTest.php index 82156e326..fec2ec12a 100644 --- a/Tests/Constraints/NotNullValidatorTest.php +++ b/Tests/Constraints/NotNullValidatorTest.php @@ -42,12 +42,9 @@ public static function getValidValues() ]; } - /** - * @dataProvider provideInvalidConstraints - */ - public function testNullIsInvalid(NotNull $constraint) + public function testNullIsInvalid() { - $this->validator->validate(null, $constraint); + $this->validator->validate(null, new NotNull(message: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ value }}', 'null') @@ -55,11 +52,18 @@ public function testNullIsInvalid(NotNull $constraint) ->assertRaised(); } - public static function provideInvalidConstraints(): iterable + /** + * @group legacy + */ + public function testNullIsInvalidDoctrineStyle() { - yield 'Doctrine style' => [new NotNull([ + $this->validator->validate(null, new NotNull([ 'message' => 'myMessage', - ])]; - yield 'named parameters' => [new NotNull(message: 'myMessage')]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', 'null') + ->setCode(NotNull::IS_NULL_ERROR) + ->assertRaised(); } } diff --git a/Tests/Constraints/RangeTest.php b/Tests/Constraints/RangeTest.php index a306b104a..01481e8bc 100644 --- a/Tests/Constraints/RangeTest.php +++ b/Tests/Constraints/RangeTest.php @@ -18,6 +18,9 @@ class RangeTest extends TestCase { + /** + * @group legacy + */ public function testThrowsConstraintExceptionIfBothMinLimitAndPropertyPath() { $this->expectException(ConstraintDefinitionException::class); @@ -35,6 +38,9 @@ public function testThrowsConstraintExceptionIfBothMinLimitAndPropertyPathNamed( new Range(min: 'min', minPropertyPath: 'minPropertyPath'); } + /** + * @group legacy + */ public function testThrowsConstraintExceptionIfBothMaxLimitAndPropertyPath() { $this->expectException(ConstraintDefinitionException::class); @@ -56,7 +62,7 @@ public function testThrowsConstraintExceptionIfNoLimitNorPropertyPath() { $this->expectException(MissingOptionsException::class); $this->expectExceptionMessage('Either option "min", "minPropertyPath", "max" or "maxPropertyPath" must be given'); - new Range([]); + new Range(); } public function testThrowsNoDefaultOptionConfiguredException() @@ -86,6 +92,9 @@ public function testThrowsConstraintDefinitionExceptionIfBothMinAndMaxAndMaxMess new Range(min: 'min', max: 'max', maxMessage: 'maxMessage'); } + /** + * @group legacy + */ public function testThrowsConstraintDefinitionExceptionIfBothMinAndMaxAndMinMessageAndMaxMessageOptions() { $this->expectException(ConstraintDefinitionException::class); @@ -98,6 +107,9 @@ public function testThrowsConstraintDefinitionExceptionIfBothMinAndMaxAndMinMess ]); } + /** + * @group legacy + */ public function testThrowsConstraintDefinitionExceptionIfBothMinAndMaxAndMinMessageOptions() { $this->expectException(ConstraintDefinitionException::class); @@ -109,6 +121,9 @@ public function testThrowsConstraintDefinitionExceptionIfBothMinAndMaxAndMinMess ]); } + /** + * @group legacy + */ public function testThrowsConstraintDefinitionExceptionIfBothMinAndMaxAndMaxMessageOptions() { $this->expectException(ConstraintDefinitionException::class); diff --git a/Tests/Constraints/RangeValidatorTest.php b/Tests/Constraints/RangeValidatorTest.php index e0fff6f85..423c8d460 100644 --- a/Tests/Constraints/RangeValidatorTest.php +++ b/Tests/Constraints/RangeValidatorTest.php @@ -30,7 +30,7 @@ protected function createValidator(): RangeValidator public function testNullIsValid() { - $this->validator->validate(null, new Range(['min' => 10, 'max' => 20])); + $this->validator->validate(null, new Range(min: 10, max: 20)); $this->assertNoViolation(); } @@ -70,6 +70,8 @@ public static function getMoreThanTwenty(): array } /** + * @group legacy + * * @dataProvider getTenToTwenty */ public function testValidValuesMin($value) @@ -92,6 +94,8 @@ public function testValidValuesMinNamed($value) } /** + * @group legacy + * * @dataProvider getTenToTwenty */ public function testValidValuesMax($value) @@ -114,6 +118,8 @@ public function testValidValuesMaxNamed($value) } /** + * @group legacy + * * @dataProvider getTenToTwenty */ public function testValidValuesMinMax($value) @@ -136,6 +142,8 @@ public function testValidValuesMinMaxNamed($value) } /** + * @group legacy + * * @dataProvider getLessThanTen */ public function testInvalidValuesMin($value, $formattedValue) @@ -171,6 +179,8 @@ public function testInvalidValuesMinNamed($value, $formattedValue) } /** + * @group legacy + * * @dataProvider getMoreThanTwenty */ public function testInvalidValuesMax($value, $formattedValue) @@ -206,6 +216,8 @@ public function testInvalidValuesMaxNamed($value, $formattedValue) } /** + * @group legacy + * * @dataProvider getMoreThanTwenty */ public function testInvalidValuesCombinedMax($value, $formattedValue) @@ -244,6 +256,8 @@ public function testInvalidValuesCombinedMaxNamed($value, $formattedValue) } /** + * @group legacy + * * @dataProvider getLessThanTen */ public function testInvalidValuesCombinedMin($value, $formattedValue) @@ -345,7 +359,7 @@ public static function getLaterThanTwentiethMarch2014(): array */ public function testValidDatesMin($value) { - $constraint = new Range(['min' => 'March 10, 2014']); + $constraint = new Range(min: 'March 10, 2014'); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -356,7 +370,7 @@ public function testValidDatesMin($value) */ public function testValidDatesMax($value) { - $constraint = new Range(['max' => 'March 20, 2014']); + $constraint = new Range(max: 'March 20, 2014'); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -367,7 +381,7 @@ public function testValidDatesMax($value) */ public function testValidDatesMinMax($value) { - $constraint = new Range(['min' => 'March 10, 2014', 'max' => 'March 20, 2014']); + $constraint = new Range(min: 'March 10, 2014', max: 'March 20, 2014'); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -382,10 +396,10 @@ public function testInvalidDatesMin(\DateTimeInterface $value, string $dateTimeA // Make sure we have the correct version loaded IntlTestHelper::requireIntl($this, '57.1'); - $constraint = new Range([ - 'min' => 'March 10, 2014', - 'minMessage' => 'myMessage', - ]); + $constraint = new Range( + min: 'March 10, 2014', + minMessage: 'myMessage', + ); $this->validator->validate($value, $constraint); @@ -405,10 +419,10 @@ public function testInvalidDatesMax(\DateTimeInterface $value, string $dateTimeA // Make sure we have the correct version loaded IntlTestHelper::requireIntl($this, '57.1'); - $constraint = new Range([ - 'max' => 'March 20, 2014', - 'maxMessage' => 'myMessage', - ]); + $constraint = new Range( + max: 'March 20, 2014', + maxMessage: 'myMessage', + ); $this->validator->validate($value, $constraint); @@ -428,11 +442,11 @@ public function testInvalidDatesCombinedMax(\DateTimeInterface $value, string $d // Make sure we have the correct version loaded IntlTestHelper::requireIntl($this, '57.1'); - $constraint = new Range([ - 'min' => 'March 10, 2014', - 'max' => 'March 20, 2014', - 'notInRangeMessage' => 'myNotInRangeMessage', - ]); + $constraint = new Range( + min: 'March 10, 2014', + max: 'March 20, 2014', + notInRangeMessage: 'myNotInRangeMessage', + ); $this->validator->validate($value, $constraint); @@ -453,11 +467,11 @@ public function testInvalidDatesCombinedMin($value, $dateTimeAsString) // Make sure we have the correct version loaded IntlTestHelper::requireIntl($this, '57.1'); - $constraint = new Range([ - 'min' => 'March 10, 2014', - 'max' => 'March 20, 2014', - 'notInRangeMessage' => 'myNotInRangeMessage', - ]); + $constraint = new Range( + min: 'March 10, 2014', + max: 'March 20, 2014', + notInRangeMessage: 'myNotInRangeMessage', + ); $this->validator->validate($value, $constraint); @@ -482,10 +496,10 @@ public function getInvalidValues(): array public function testNonNumeric() { - $constraint = new Range([ - 'min' => 10, - 'max' => 20, - ]); + $constraint = new Range( + min: 10, + max: 20, + ); $this->validator->validate('abcd', $constraint); @@ -497,9 +511,9 @@ public function testNonNumeric() public function testNonNumericWithParsableDatetimeMinAndMaxNull() { - $constraint = new Range([ - 'min' => 'March 10, 2014', - ]); + $constraint = new Range( + min: 'March 10, 2014', + ); $this->validator->validate('abcd', $constraint); @@ -511,9 +525,9 @@ public function testNonNumericWithParsableDatetimeMinAndMaxNull() public function testNonNumericWithParsableDatetimeMaxAndMinNull() { - $constraint = new Range([ - 'max' => 'March 20, 2014', - ]); + $constraint = new Range( + max: 'March 20, 2014', + ); $this->validator->validate('abcd', $constraint); @@ -525,10 +539,10 @@ public function testNonNumericWithParsableDatetimeMaxAndMinNull() public function testNonNumericWithParsableDatetimeMinAndMax() { - $constraint = new Range([ - 'min' => 'March 10, 2014', - 'max' => 'March 20, 2014', - ]); + $constraint = new Range( + min: 'March 10, 2014', + max: 'March 20, 2014', + ); $this->validator->validate('abcd', $constraint); @@ -540,10 +554,10 @@ public function testNonNumericWithParsableDatetimeMinAndMax() public function testNonNumericWithNonParsableDatetimeMin() { - $constraint = new Range([ - 'min' => 'March 40, 2014', - 'max' => 'March 20, 2014', - ]); + $constraint = new Range( + min: 'March 40, 2014', + max: 'March 20, 2014', + ); $this->validator->validate('abcd', $constraint); @@ -555,10 +569,10 @@ public function testNonNumericWithNonParsableDatetimeMin() public function testNonNumericWithNonParsableDatetimeMax() { - $constraint = new Range([ - 'min' => 'March 10, 2014', - 'max' => 'March 50, 2014', - ]); + $constraint = new Range( + min: 'March 10, 2014', + max: 'March 50, 2014', + ); $this->validator->validate('abcd', $constraint); @@ -570,10 +584,10 @@ public function testNonNumericWithNonParsableDatetimeMax() public function testNonNumericWithNonParsableDatetimeMinAndMax() { - $constraint = new Range([ - 'min' => 'March 40, 2014', - 'max' => 'March 50, 2014', - ]); + $constraint = new Range( + min: 'March 40, 2014', + max: 'March 50, 2014', + ); $this->validator->validate('abcd', $constraint); @@ -591,10 +605,10 @@ public function testThrowsOnInvalidStringDates($expectedMessage, $value, $min, $ $this->expectException(ConstraintDefinitionException::class); $this->expectExceptionMessage($expectedMessage); - $this->validator->validate($value, new Range([ - 'min' => $min, - 'max' => $max, - ])); + $this->validator->validate($value, new Range( + min: $min, + max: $max, + )); } public static function throwsOnInvalidStringDatesProvider(): array @@ -612,15 +626,17 @@ public function testNoViolationOnNullObjectWithPropertyPaths() { $this->setObject(null); - $this->validator->validate(1, new Range([ - 'minPropertyPath' => 'minPropertyPath', - 'maxPropertyPath' => 'maxPropertyPath', - ])); + $this->validator->validate(1, new Range( + minPropertyPath: 'minPropertyPath', + maxPropertyPath: 'maxPropertyPath', + )); $this->assertNoViolation(); } /** + * @group legacy + * * @dataProvider getTenToTwenty */ public function testValidValuesMinPropertyPath($value) @@ -653,9 +669,9 @@ public function testValidValuesMaxPropertyPath($value) { $this->setObject(new Limit(20)); - $this->validator->validate($value, new Range([ - 'maxPropertyPath' => 'value', - ])); + $this->validator->validate($value, new Range( + maxPropertyPath: 'value', + )); $this->assertNoViolation(); } @@ -679,10 +695,10 @@ public function testValidValuesMinMaxPropertyPath($value) { $this->setObject(new MinMax(10, 20)); - $this->validator->validate($value, new Range([ - 'minPropertyPath' => 'min', - 'maxPropertyPath' => 'max', - ])); + $this->validator->validate($value, new Range( + minPropertyPath: 'min', + maxPropertyPath: 'max', + )); $this->assertNoViolation(); } @@ -694,10 +710,10 @@ public function testInvalidValuesMinPropertyPath($value, $formattedValue) { $this->setObject(new Limit(10)); - $constraint = new Range([ - 'minPropertyPath' => 'value', - 'minMessage' => 'myMessage', - ]); + $constraint = new Range( + minPropertyPath: 'value', + minMessage: 'myMessage', + ); $this->validator->validate($value, $constraint); @@ -716,10 +732,10 @@ public function testInvalidValuesMaxPropertyPath($value, $formattedValue) { $this->setObject(new Limit(20)); - $constraint = new Range([ - 'maxPropertyPath' => 'value', - 'maxMessage' => 'myMessage', - ]); + $constraint = new Range( + maxPropertyPath: 'value', + maxMessage: 'myMessage', + ); $this->validator->validate($value, $constraint); @@ -732,6 +748,8 @@ public function testInvalidValuesMaxPropertyPath($value, $formattedValue) } /** + * @group legacy + * * @dataProvider getMoreThanTwenty */ public function testInvalidValuesCombinedMaxPropertyPath($value, $formattedValue) @@ -782,6 +800,8 @@ public function testInvalidValuesCombinedMaxPropertyPathNamed($value, $formatted } /** + * @group legacy + * * @dataProvider getLessThanTen */ public function testInvalidValuesCombinedMinPropertyPath($value, $formattedValue) @@ -838,11 +858,11 @@ public function testViolationOnNullObjectWithDefinedMin($value, $formattedValue) { $this->setObject(null); - $this->validator->validate($value, new Range([ - 'min' => 10, - 'maxPropertyPath' => 'max', - 'minMessage' => 'myMessage', - ])); + $this->validator->validate($value, new Range( + min: 10, + maxPropertyPath: 'max', + minMessage: 'myMessage', + )); $this->buildViolation('myMessage') ->setParameter('{{ value }}', $formattedValue) @@ -859,11 +879,11 @@ public function testViolationOnNullObjectWithDefinedMax($value, $formattedValue) { $this->setObject(null); - $this->validator->validate($value, new Range([ - 'minPropertyPath' => 'min', - 'max' => 20, - 'maxMessage' => 'myMessage', - ])); + $this->validator->validate($value, new Range( + minPropertyPath: 'min', + max: 20, + maxMessage: 'myMessage', + )); $this->buildViolation('myMessage') ->setParameter('{{ value }}', $formattedValue) @@ -880,7 +900,7 @@ public function testValidDatesMinPropertyPath($value) { $this->setObject(new Limit('March 10, 2014')); - $this->validator->validate($value, new Range(['minPropertyPath' => 'value'])); + $this->validator->validate($value, new Range(minPropertyPath: 'value')); $this->assertNoViolation(); } @@ -892,7 +912,7 @@ public function testValidDatesMaxPropertyPath($value) { $this->setObject(new Limit('March 20, 2014')); - $constraint = new Range(['maxPropertyPath' => 'value']); + $constraint = new Range(maxPropertyPath: 'value'); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -905,7 +925,7 @@ public function testValidDatesMinMaxPropertyPath($value) { $this->setObject(new MinMax('March 10, 2014', 'March 20, 2014')); - $constraint = new Range(['minPropertyPath' => 'min', 'maxPropertyPath' => 'max']); + $constraint = new Range(minPropertyPath: 'min', maxPropertyPath: 'max'); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -922,10 +942,10 @@ public function testInvalidDatesMinPropertyPath($value, $dateTimeAsString) $this->setObject(new Limit('March 10, 2014')); - $constraint = new Range([ - 'minPropertyPath' => 'value', - 'minMessage' => 'myMessage', - ]); + $constraint = new Range( + minPropertyPath: 'value', + minMessage: 'myMessage', + ); $this->validator->validate($value, $constraint); @@ -948,10 +968,10 @@ public function testInvalidDatesMaxPropertyPath($value, $dateTimeAsString) $this->setObject(new Limit('March 20, 2014')); - $constraint = new Range([ - 'maxPropertyPath' => 'value', - 'maxMessage' => 'myMessage', - ]); + $constraint = new Range( + maxPropertyPath: 'value', + maxMessage: 'myMessage', + ); $this->validator->validate($value, $constraint); @@ -974,11 +994,11 @@ public function testInvalidDatesCombinedMaxPropertyPath($value, $dateTimeAsStrin $this->setObject(new MinMax('March 10, 2014', 'March 20, 2014')); - $constraint = new Range([ - 'minPropertyPath' => 'min', - 'maxPropertyPath' => 'max', - 'notInRangeMessage' => 'myNotInRangeMessage', - ]); + $constraint = new Range( + minPropertyPath: 'min', + maxPropertyPath: 'max', + notInRangeMessage: 'myNotInRangeMessage', + ); $this->validator->validate($value, $constraint); @@ -1003,11 +1023,11 @@ public function testInvalidDatesCombinedMinPropertyPath($value, $dateTimeAsStrin $this->setObject(new MinMax('March 10, 2014', 'March 20, 2014')); - $constraint = new Range([ - 'minPropertyPath' => 'min', - 'maxPropertyPath' => 'max', - 'notInRangeMessage' => 'myNotInRangeMessage', - ]); + $constraint = new Range( + minPropertyPath: 'min', + maxPropertyPath: 'max', + notInRangeMessage: 'myNotInRangeMessage', + ); $this->validator->validate($value, $constraint); @@ -1027,7 +1047,7 @@ public function testMinPropertyPathReferencingUninitializedProperty() $object->max = 5; $this->setObject($object); - $this->validator->validate(5, new Range(['minPropertyPath' => 'min', 'maxPropertyPath' => 'max'])); + $this->validator->validate(5, new Range(minPropertyPath: 'min', maxPropertyPath: 'max')); $this->assertNoViolation(); } @@ -1038,14 +1058,14 @@ public function testMaxPropertyPathReferencingUninitializedProperty() $object->min = 5; $this->setObject($object); - $this->validator->validate(5, new Range(['minPropertyPath' => 'min', 'maxPropertyPath' => 'max'])); + $this->validator->validate(5, new Range(minPropertyPath: 'min', maxPropertyPath: 'max')); $this->assertNoViolation(); } public static function provideMessageIfMinAndMaxSet(): array { - $notInRangeMessage = (new Range(['min' => '']))->notInRangeMessage; + $notInRangeMessage = (new Range(min: ''))->notInRangeMessage; return [ [ @@ -1068,7 +1088,7 @@ public static function provideMessageIfMinAndMaxSet(): array */ public function testMessageIfMinAndMaxSet(array $constraintExtraOptions, int $value, string $expectedMessage, string $expectedCode) { - $constraint = new Range(array_merge(['min' => 1, 'max' => 10], $constraintExtraOptions)); + $constraint = new Range(...array_merge(['min' => 1, 'max' => 10], $constraintExtraOptions)); $this->validator->validate($value, $constraint); $this diff --git a/Tests/Constraints/RegexTest.php b/Tests/Constraints/RegexTest.php index 4df86e434..853e0d785 100644 --- a/Tests/Constraints/RegexTest.php +++ b/Tests/Constraints/RegexTest.php @@ -70,10 +70,10 @@ public static function provideHtmlPatterns() */ public function testGetHtmlPattern($pattern, $htmlPattern, $match = true) { - $constraint = new Regex([ - 'pattern' => $pattern, - 'match' => $match, - ]); + $constraint = new Regex( + pattern: $pattern, + match: $match, + ); $this->assertSame($pattern, $constraint->pattern); $this->assertSame($htmlPattern, $constraint->getHtmlPattern()); @@ -81,10 +81,10 @@ public function testGetHtmlPattern($pattern, $htmlPattern, $match = true) public function testGetCustomHtmlPattern() { - $constraint = new Regex([ - 'pattern' => '((?![0-9]$|[a-z]+).)*', - 'htmlPattern' => 'foobar', - ]); + $constraint = new Regex( + pattern: '((?![0-9]$|[a-z]+).)*', + htmlPattern: 'foobar', + ); $this->assertSame('((?![0-9]$|[a-z]+).)*', $constraint->pattern); $this->assertSame('foobar', $constraint->getHtmlPattern()); @@ -92,11 +92,14 @@ public function testGetCustomHtmlPattern() public function testNormalizerCanBeSet() { - $regex = new Regex(['pattern' => '/^[0-9]+$/', 'normalizer' => 'trim']); + $regex = new Regex(pattern: '/^[0-9]+$/', normalizer: 'trim'); $this->assertEquals('trim', $regex->normalizer); } + /** + * @group legacy + */ public function testInvalidNormalizerThrowsException() { $this->expectException(InvalidArgumentException::class); @@ -104,6 +107,9 @@ public function testInvalidNormalizerThrowsException() new Regex(['pattern' => '/^[0-9]+$/', 'normalizer' => 'Unknown Callable']); } + /** + * @group legacy + */ public function testInvalidNormalizerObjectThrowsException() { $this->expectException(InvalidArgumentException::class); @@ -142,6 +148,9 @@ public function testMissingPattern() new Regex(null); } + /** + * @group legacy + */ public function testMissingPatternDoctrineStyle() { $this->expectException(MissingOptionsException::class); diff --git a/Tests/Constraints/RegexValidatorTest.php b/Tests/Constraints/RegexValidatorTest.php index 82739f0e3..bafc752c3 100644 --- a/Tests/Constraints/RegexValidatorTest.php +++ b/Tests/Constraints/RegexValidatorTest.php @@ -25,14 +25,14 @@ protected function createValidator(): RegexValidator public function testNullIsValid() { - $this->validator->validate(null, new Regex(['pattern' => '/^[0-9]+$/'])); + $this->validator->validate(null, new Regex(pattern: '/^[0-9]+$/')); $this->assertNoViolation(); } public function testEmptyStringIsValid() { - $this->validator->validate('', new Regex(['pattern' => '/^[0-9]+$/'])); + $this->validator->validate('', new Regex(pattern: '/^[0-9]+$/')); $this->assertNoViolation(); } @@ -40,7 +40,7 @@ public function testEmptyStringIsValid() public function testExpectsStringCompatibleType() { $this->expectException(UnexpectedValueException::class); - $this->validator->validate(new \stdClass(), new Regex(['pattern' => '/^[0-9]+$/'])); + $this->validator->validate(new \stdClass(), new Regex(pattern: '/^[0-9]+$/')); } /** @@ -48,13 +48,15 @@ public function testExpectsStringCompatibleType() */ public function testValidValues($value) { - $constraint = new Regex(['pattern' => '/^[0-9]+$/']); + $constraint = new Regex(pattern: '/^[0-9]+$/'); $this->validator->validate($value, $constraint); $this->assertNoViolation(); } /** + * @group legacy + * * @dataProvider getValidValuesWithWhitespaces */ public function testValidValuesWithWhitespaces($value) @@ -105,6 +107,8 @@ public static function getValidValuesWithWhitespaces() } /** + * @group legacy + * * @dataProvider getInvalidValues */ public function testInvalidValues($value) diff --git a/Tests/Constraints/SequentiallyValidatorTest.php b/Tests/Constraints/SequentiallyValidatorTest.php index 657ff2637..4c8a48e10 100644 --- a/Tests/Constraints/SequentiallyValidatorTest.php +++ b/Tests/Constraints/SequentiallyValidatorTest.php @@ -33,7 +33,7 @@ public function testWalkThroughConstraints() { $constraints = [ new Type('number'), - new Range(['min' => 4]), + new Range(min: 4), ]; $value = 6; @@ -50,7 +50,7 @@ public function testStopsAtFirstConstraintWithViolations() { $constraints = [ new Type('string'), - new Regex(['pattern' => '[a-z]']), + new Regex(pattern: '[a-z]'), new NotEqualTo('Foo'), ]; @@ -68,20 +68,20 @@ public function testNestedConstraintsAreNotExecutedWhenGroupDoesNotMatch() { $validator = Validation::createValidator(); - $violations = $validator->validate(50, new Sequentially([ - 'constraints' => [ - new GreaterThan([ - 'groups' => 'senior', - 'value' => 55, - ]), - new Range([ - 'groups' => 'adult', - 'min' => 18, - 'max' => 55, - ]), + $violations = $validator->validate(50, new Sequentially( + constraints: [ + new GreaterThan( + groups: ['senior'], + value: 55, + ), + new Range( + groups: ['adult'], + min: 18, + max: 55, + ), ], - 'groups' => ['adult', 'senior'], - ]), 'adult'); + groups: ['adult', 'senior'], + ), 'adult'); $this->assertCount(0, $violations); } diff --git a/Tests/Constraints/TimeValidatorTest.php b/Tests/Constraints/TimeValidatorTest.php index 5d9027a17..7c1a9feb9 100644 --- a/Tests/Constraints/TimeValidatorTest.php +++ b/Tests/Constraints/TimeValidatorTest.php @@ -87,9 +87,7 @@ public static function getValidTimes() */ public function testValidTimesWithoutSeconds(string $time) { - $this->validator->validate($time, new Time([ - 'withSeconds' => false, - ])); + $this->validator->validate($time, new Time(withSeconds: false)); $this->assertNoViolation(); } @@ -143,9 +141,7 @@ public static function getInvalidTimesWithoutSeconds() */ public function testInvalidTimes($time, $code) { - $constraint = new Time([ - 'message' => 'myMessage', - ]); + $constraint = new Time(message: 'myMessage'); $this->validator->validate($time, $constraint); diff --git a/Tests/Constraints/TimezoneTest.php b/Tests/Constraints/TimezoneTest.php index 42a38a711..41fed2386 100644 --- a/Tests/Constraints/TimezoneTest.php +++ b/Tests/Constraints/TimezoneTest.php @@ -25,12 +25,12 @@ class TimezoneTest extends TestCase public function testValidTimezoneConstraints() { new Timezone(); - new Timezone(['zone' => \DateTimeZone::ALL]); + new Timezone(zone: \DateTimeZone::ALL); new Timezone(\DateTimeZone::ALL_WITH_BC); - new Timezone([ - 'zone' => \DateTimeZone::PER_COUNTRY, - 'countryCode' => 'AR', - ]); + new Timezone( + zone: \DateTimeZone::PER_COUNTRY, + countryCode: 'AR', + ); $this->addToAssertionCount(1); } @@ -38,16 +38,16 @@ public function testValidTimezoneConstraints() public function testExceptionForGroupedTimezonesByCountryWithWrongZone() { $this->expectException(ConstraintDefinitionException::class); - new Timezone([ - 'zone' => \DateTimeZone::ALL, - 'countryCode' => 'AR', - ]); + new Timezone( + zone: \DateTimeZone::ALL, + countryCode: 'AR', + ); } public function testExceptionForGroupedTimezonesByCountryWithoutZone() { $this->expectException(ConstraintDefinitionException::class); - new Timezone(['countryCode' => 'AR']); + new Timezone(countryCode: 'AR'); } /** @@ -56,7 +56,7 @@ public function testExceptionForGroupedTimezonesByCountryWithoutZone() public function testExceptionForInvalidGroupedTimezones(int $zone) { $this->expectException(ConstraintDefinitionException::class); - new Timezone(['zone' => $zone]); + new Timezone(zone: $zone); } public static function provideInvalidZones(): iterable diff --git a/Tests/Constraints/TimezoneValidatorTest.php b/Tests/Constraints/TimezoneValidatorTest.php index 25451c5d2..7ed4d79ed 100644 --- a/Tests/Constraints/TimezoneValidatorTest.php +++ b/Tests/Constraints/TimezoneValidatorTest.php @@ -92,9 +92,7 @@ public static function getValidTimezones(): iterable */ public function testValidGroupedTimezones(string $timezone, int $zone) { - $constraint = new Timezone([ - 'zone' => $zone, - ]); + $constraint = new Timezone(zone: $zone); $this->validator->validate($timezone, $constraint); @@ -125,9 +123,7 @@ public static function getValidGroupedTimezones(): iterable */ public function testInvalidTimezoneWithoutZone(string $timezone) { - $constraint = new Timezone([ - 'message' => 'myMessage', - ]); + $constraint = new Timezone(message: 'myMessage'); $this->validator->validate($timezone, $constraint); @@ -150,10 +146,10 @@ public static function getInvalidTimezones(): iterable */ public function testInvalidGroupedTimezones(string $timezone, int $zone) { - $constraint = new Timezone([ - 'zone' => $zone, - 'message' => 'myMessage', - ]); + $constraint = new Timezone( + zone: $zone, + message: 'myMessage', + ); $this->validator->validate($timezone, $constraint); @@ -193,10 +189,10 @@ public function testInvalidGroupedTimezoneNamed() */ public function testValidGroupedTimezonesByCountry(string $timezone, string $country) { - $constraint = new Timezone([ - 'zone' => \DateTimeZone::PER_COUNTRY, - 'countryCode' => $country, - ]); + $constraint = new Timezone( + zone: \DateTimeZone::PER_COUNTRY, + countryCode: $country, + ); $this->validator->validate($timezone, $constraint); @@ -230,11 +226,11 @@ public static function getValidGroupedTimezonesByCountry(): iterable */ public function testInvalidGroupedTimezonesByCountry(string $timezone, string $countryCode) { - $constraint = new Timezone([ - 'message' => 'myMessage', - 'zone' => \DateTimeZone::PER_COUNTRY, - 'countryCode' => $countryCode, - ]); + $constraint = new Timezone( + message: 'myMessage', + zone: \DateTimeZone::PER_COUNTRY, + countryCode: $countryCode, + ); $this->validator->validate($timezone, $constraint); @@ -255,11 +251,11 @@ public static function getInvalidGroupedTimezonesByCountry(): iterable public function testGroupedTimezonesWithInvalidCountry() { - $constraint = new Timezone([ - 'message' => 'myMessage', - 'zone' => \DateTimeZone::PER_COUNTRY, - 'countryCode' => 'foobar', - ]); + $constraint = new Timezone( + message: 'myMessage', + zone: \DateTimeZone::PER_COUNTRY, + countryCode: 'foobar', + ); $this->validator->validate('Europe/Amsterdam', $constraint); @@ -274,6 +270,11 @@ public function testGroupedTimezonesWithInvalidCountry() */ public function testDeprecatedTimezonesAreValidWithBC(string $timezone) { + // Skip test if the timezone is not available in the current timezone database + if (!\in_array($timezone, \DateTimeZone::listIdentifiers(\DateTimeZone::ALL_WITH_BC), true)) { + $this->markTestSkipped(sprintf('Timezone "%s" is not available in the current timezone database', $timezone)); + } + $constraint = new Timezone(\DateTimeZone::ALL_WITH_BC); $this->validator->validate($timezone, $constraint); @@ -286,9 +287,7 @@ public function testDeprecatedTimezonesAreValidWithBC(string $timezone) */ public function testDeprecatedTimezonesAreInvalidWithoutBC(string $timezone) { - $constraint = new Timezone([ - 'message' => 'myMessage', - ]); + $constraint = new Timezone(message: 'myMessage'); $this->validator->validate($timezone, $constraint); @@ -332,10 +331,10 @@ public function testIntlCompatibility() $this->markTestSkipped('"Europe/Saratov" is expired until 2017, current version is '.$tzDbVersion); } - $constraint = new Timezone([ - 'message' => 'myMessage', - 'intlCompatible' => true, - ]); + $constraint = new Timezone( + message: 'myMessage', + intlCompatible: true, + ); $this->validator->validate('Europe/Saratov', $constraint); diff --git a/Tests/Constraints/TypeValidatorTest.php b/Tests/Constraints/TypeValidatorTest.php index 99714407f..8e9e1aa3b 100644 --- a/Tests/Constraints/TypeValidatorTest.php +++ b/Tests/Constraints/TypeValidatorTest.php @@ -26,7 +26,7 @@ protected function createValidator(): TypeValidator public function testNullIsValid() { - $constraint = new Type(['type' => 'integer']); + $constraint = new Type(type: 'integer'); $this->validator->validate(null, $constraint); @@ -35,7 +35,7 @@ public function testNullIsValid() public function testEmptyIsValidIfString() { - $constraint = new Type(['type' => 'string']); + $constraint = new Type(type: 'string'); $this->validator->validate('', $constraint); @@ -44,10 +44,10 @@ public function testEmptyIsValidIfString() public function testEmptyIsInvalidIfNoString() { - $constraint = new Type([ - 'type' => 'integer', - 'message' => 'myMessage', - ]); + $constraint = new Type( + type: 'integer', + message: 'myMessage', + ); $this->validator->validate('', $constraint); @@ -63,7 +63,7 @@ public function testEmptyIsInvalidIfNoString() */ public function testValidValues($value, $type) { - $constraint = new Type(['type' => $type]); + $constraint = new Type(type: $type); $this->validator->validate($value, $constraint); @@ -123,10 +123,10 @@ public static function getValidValues() */ public function testInvalidValues($value, $type, $valueAsString) { - $constraint = new Type([ - 'type' => $type, - 'message' => 'myMessage', - ]); + $constraint = new Type( + type: $type, + message: 'myMessage', + ); $this->validator->validate($value, $constraint); @@ -195,7 +195,7 @@ public static function getInvalidValues() */ public function testValidValuesMultipleTypes($value, array $types) { - $constraint = new Type(['type' => $types]); + $constraint = new Type(type: $types); $this->validator->validate($value, $constraint); @@ -210,12 +210,9 @@ public static function getValidValuesMultipleTypes() ]; } - /** - * @dataProvider provideConstraintsWithMultipleTypes - */ - public function testInvalidValuesMultipleTypes(Type $constraint) + public function testInvalidValuesMultipleTypes() { - $this->validator->validate('12345', $constraint); + $this->validator->validate('12345', new Type(type: ['boolean', 'array'], message: 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"12345"') @@ -224,13 +221,21 @@ public function testInvalidValuesMultipleTypes(Type $constraint) ->assertRaised(); } - public static function provideConstraintsWithMultipleTypes() + /** + * @group legacy + */ + public function testInvalidValuesMultipleTypesDoctrineStyle() { - yield 'Doctrine style' => [new Type([ + $this->validator->validate('12345', new Type([ 'type' => ['boolean', 'array'], 'message' => 'myMessage', - ])]; - yield 'named arguments' => [new Type(type: ['boolean', 'array'], message: 'myMessage')]; + ])); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"12345"') + ->setParameter('{{ type }}', implode('|', ['boolean', 'array'])) + ->setCode(Type::INVALID_TYPE_ERROR) + ->assertRaised(); } protected static function createFile() diff --git a/Tests/Constraints/UlidValidatorTest.php b/Tests/Constraints/UlidValidatorTest.php index abacdfdc5..172ace189 100644 --- a/Tests/Constraints/UlidValidatorTest.php +++ b/Tests/Constraints/UlidValidatorTest.php @@ -72,9 +72,7 @@ public function testValidUlidAsRfc4122() */ public function testInvalidUlid(string $ulid, string $code) { - $constraint = new Ulid([ - 'message' => 'testMessage', - ]); + $constraint = new Ulid(message: 'testMessage'); $this->validator->validate($ulid, $constraint); diff --git a/Tests/Constraints/UniqueTest.php b/Tests/Constraints/UniqueTest.php index 7d882a9c3..9fe2599fd 100644 --- a/Tests/Constraints/UniqueTest.php +++ b/Tests/Constraints/UniqueTest.php @@ -37,6 +37,9 @@ public function testAttributes() self::assertSame('intval', $dConstraint->normalizer); } + /** + * @group legacy + */ public function testInvalidNormalizerThrowsException() { $this->expectException(InvalidArgumentException::class); @@ -44,6 +47,9 @@ public function testInvalidNormalizerThrowsException() new Unique(['normalizer' => 'Unknown Callable']); } + /** + * @group legacy + */ public function testInvalidNormalizerObjectThrowsException() { $this->expectException(InvalidArgumentException::class); diff --git a/Tests/Constraints/UniqueValidatorTest.php b/Tests/Constraints/UniqueValidatorTest.php index f81621d65..12efb7698 100644 --- a/Tests/Constraints/UniqueValidatorTest.php +++ b/Tests/Constraints/UniqueValidatorTest.php @@ -63,9 +63,7 @@ public static function getValidValues() */ public function testInvalidValues($value, $expectedMessageParam) { - $constraint = new Unique([ - 'message' => 'myMessage', - ]); + $constraint = new Unique(message: 'myMessage'); $this->validator->validate($value, $constraint); $this->buildViolation('myMessage') @@ -118,9 +116,7 @@ public function testExpectsUniqueObjects($callback) $value = [$object1, $object2, $object3]; - $this->validator->validate($value, new Unique([ - 'normalizer' => $callback, - ])); + $this->validator->validate($value, new Unique(normalizer: $callback)); $this->assertNoViolation(); } @@ -144,10 +140,10 @@ public function testExpectsNonUniqueObjects($callback) $value = [$object1, $object2, $object3]; - $this->validator->validate($value, new Unique([ - 'message' => 'myMessage', - 'normalizer' => $callback, - ])); + $this->validator->validate($value, new Unique( + message: 'myMessage', + normalizer: $callback, + )); $this->buildViolation('myMessage') ->setParameter('{{ value }}', 'array') @@ -168,10 +164,10 @@ public static function getCallback(): array public function testExpectsInvalidNonStrictComparison() { - $this->validator->validate([1, '1', 1.0, '1.0'], new Unique([ - 'message' => 'myMessage', - 'normalizer' => 'intval', - ])); + $this->validator->validate([1, '1', 1.0, '1.0'], new Unique( + message: 'myMessage', + normalizer: 'intval', + )); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '1') @@ -183,9 +179,7 @@ public function testExpectsValidNonStrictComparison() { $callback = static fn ($item) => (int) $item; - $this->validator->validate([1, '2', 3, '4.0'], new Unique([ - 'normalizer' => $callback, - ])); + $this->validator->validate([1, '2', 3, '4.0'], new Unique(normalizer: $callback)); $this->assertNoViolation(); } @@ -194,10 +188,10 @@ public function testExpectsInvalidCaseInsensitiveComparison() { $callback = static fn ($item) => mb_strtolower($item); - $this->validator->validate(['Hello', 'hello', 'HELLO', 'hellO'], new Unique([ - 'message' => 'myMessage', - 'normalizer' => $callback, - ])); + $this->validator->validate(['Hello', 'hello', 'HELLO', 'hellO'], new Unique( + message: 'myMessage', + normalizer: $callback, + )); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"hello"') @@ -209,9 +203,7 @@ public function testExpectsValidCaseInsensitiveComparison() { $callback = static fn ($item) => mb_strtolower($item); - $this->validator->validate(['Hello', 'World'], new Unique([ - 'normalizer' => $callback, - ])); + $this->validator->validate(['Hello', 'World'], new Unique(normalizer: $callback)); $this->assertNoViolation(); } @@ -248,9 +240,10 @@ public static function getInvalidFieldNames(): array */ public function testInvalidCollectionValues(array $value, array $fields, string $expectedMessageParam) { - $this->validator->validate($value, new Unique([ - 'message' => 'myMessage', - ], fields: $fields)); + $this->validator->validate($value, new Unique( + message: 'myMessage', + fields: $fields, + )); $this->buildViolation('myMessage') ->setParameter('{{ value }}', $expectedMessageParam) @@ -394,6 +387,77 @@ public function testErrorPathWithNonList() ->assertRaised(); } + public function testWithoutStopOnFirstError() + { + $this->validator->validate( + ['a1', 'a2', 'a1', 'a1', 'a2'], + new Unique(stopOnFirstError: false), + ); + + $this + ->buildViolation('This collection should contain only unique elements.') + ->setParameter('{{ value }}', '"a1"') + ->setCode(Unique::IS_NOT_UNIQUE) + ->atPath('property.path[2]') + + ->buildNextViolation('This collection should contain only unique elements.') + ->setParameter('{{ value }}', '"a1"') + ->setCode(Unique::IS_NOT_UNIQUE) + ->atPath('property.path[3]') + + ->buildNextViolation('This collection should contain only unique elements.') + ->setParameter('{{ value }}', '"a2"') + ->setCode(Unique::IS_NOT_UNIQUE) + ->atPath('property.path[4]') + + ->assertRaised(); + } + + public function testWithoutStopOnFirstErrorWithErrorPath() + { + $array = [ + new DummyClassOne(), + new DummyClassOne(), + new DummyClassOne(), + new DummyClassOne(), + new DummyClassOne(), + ]; + + $array[0]->code = 'a1'; + $array[1]->code = 'a2'; + $array[2]->code = 'a1'; + $array[3]->code = 'a1'; + $array[4]->code = 'a2'; + + $this->validator->validate( + $array, + new Unique( + normalizer: [self::class, 'normalizeDummyClassOne'], + fields: 'code', + errorPath: 'code', + stopOnFirstError: false, + ) + ); + + $this + ->buildViolation('This collection should contain only unique elements.') + ->setParameter('{{ value }}', 'array') + ->setCode(Unique::IS_NOT_UNIQUE) + ->atPath('property.path[2].code') + + ->buildNextViolation('This collection should contain only unique elements.') + ->setParameter('{{ value }}', 'array') + ->setCode(Unique::IS_NOT_UNIQUE) + ->atPath('property.path[3].code') + + ->buildNextViolation('This collection should contain only unique elements.') + ->setParameter('{{ value }}', 'array') + ->setCode(Unique::IS_NOT_UNIQUE) + ->atPath('property.path[4].code') + + ->assertRaised(); + } + public static function normalizeDummyClassOne(DummyClassOne $obj): array { return [ diff --git a/Tests/Constraints/UrlTest.php b/Tests/Constraints/UrlTest.php index 59e626eda..cbc9bc18c 100644 --- a/Tests/Constraints/UrlTest.php +++ b/Tests/Constraints/UrlTest.php @@ -24,11 +24,14 @@ class UrlTest extends TestCase { public function testNormalizerCanBeSet() { - $url = new Url(['normalizer' => 'trim', 'requireTld' => true]); + $url = new Url(normalizer: 'trim', requireTld: true); $this->assertEquals('trim', $url->normalizer); } + /** + * @group legacy + */ public function testInvalidNormalizerThrowsException() { $this->expectException(InvalidArgumentException::class); @@ -36,6 +39,9 @@ public function testInvalidNormalizerThrowsException() new Url(['normalizer' => 'Unknown Callable', 'requireTld' => true]); } + /** + * @group legacy + */ public function testInvalidNormalizerObjectThrowsException() { $this->expectException(InvalidArgumentException::class); diff --git a/Tests/Constraints/UrlValidatorTest.php b/Tests/Constraints/UrlValidatorTest.php index df4406881..535714d1e 100644 --- a/Tests/Constraints/UrlValidatorTest.php +++ b/Tests/Constraints/UrlValidatorTest.php @@ -78,10 +78,10 @@ public function testValidUrlsWithNewLine($url) */ public function testValidUrlsWithWhitespaces($url) { - $this->validator->validate($url, new Url([ - 'normalizer' => 'trim', - 'requireTld' => true, - ])); + $this->validator->validate($url, new Url( + normalizer: 'trim', + requireTld: true, + )); $this->assertNoViolation(); } @@ -92,10 +92,10 @@ public function testValidUrlsWithWhitespaces($url) */ public function testValidRelativeUrl($url) { - $constraint = new Url([ - 'relativeProtocol' => true, - 'requireTld' => false, - ]); + $constraint = new Url( + relativeProtocol: true, + requireTld: false, + ); $this->validator->validate($url, $constraint); @@ -211,6 +211,8 @@ public static function getValidUrls() ['http://xn--94bcy3esc8fb.xn--54b7fta0cc/'], ['http://www.example.com/%E0%B8%84%E0%B8%99%E0%B9%81%E0%B8%8B%E0%B9%88%E0%B8%A5%E0%B8%B5%E0%B9%89/'], ['http://www.example.com/%E3%81%8B/'], + ['https://l.o_g~i!n$u/'s(e)r*n+a,m;e=:p.a_s~s!w$o\'r(d)*+,;=secret@ftp.example.com/path/file.tar.gz'], + ['https://l(o)g%40in:pa$+word%20secret@ftp.example.com/path/file.tar.gz'], ]; } @@ -231,10 +233,10 @@ public static function getValidUrlsWithWhitespaces() */ public function testInvalidUrls($url) { - $constraint = new Url([ - 'message' => 'myMessage', - 'requireTld' => false, - ]); + $constraint = new Url( + message: 'myMessage', + requireTld: false, + ); $this->validator->validate($url, $constraint); @@ -250,11 +252,11 @@ public function testInvalidUrls($url) */ public function testInvalidRelativeUrl($url) { - $constraint = new Url([ - 'message' => 'myMessage', - 'relativeProtocol' => true, - 'requireTld' => false, - ]); + $constraint = new Url( + message: 'myMessage', + relativeProtocol: true, + requireTld: false, + ); $this->validator->validate($url, $constraint); @@ -333,10 +335,10 @@ public static function getInvalidUrls() */ public function testCustomProtocolIsValid($url, $requireTld) { - $constraint = new Url([ - 'protocols' => ['ftp', 'file', 'git'], - 'requireTld' => $requireTld, - ]); + $constraint = new Url( + protocols: ['ftp', 'file', 'git'], + requireTld: $requireTld, + ); $this->validator->validate($url, $constraint); @@ -357,9 +359,7 @@ public static function getValidCustomUrls() */ public function testRequiredTld(string $url, bool $requireTld, bool $isValid) { - $constraint = new Url([ - 'requireTld' => $requireTld, - ]); + $constraint = new Url(requireTld: $requireTld); $this->validator->validate($url, $constraint); diff --git a/Tests/Constraints/UuidTest.php b/Tests/Constraints/UuidTest.php index 3da8b8133..22901a9db 100644 --- a/Tests/Constraints/UuidTest.php +++ b/Tests/Constraints/UuidTest.php @@ -24,11 +24,14 @@ class UuidTest extends TestCase { public function testNormalizerCanBeSet() { - $uuid = new Uuid(['normalizer' => 'trim']); + $uuid = new Uuid(normalizer: 'trim'); $this->assertEquals('trim', $uuid->normalizer); } + /** + * @group legacy + */ public function testInvalidNormalizerThrowsException() { $this->expectException(InvalidArgumentException::class); @@ -36,6 +39,9 @@ public function testInvalidNormalizerThrowsException() new Uuid(['normalizer' => 'Unknown Callable']); } + /** + * @group legacy + */ public function testInvalidNormalizerObjectThrowsException() { $this->expectException(InvalidArgumentException::class); diff --git a/Tests/Constraints/UuidValidatorTest.php b/Tests/Constraints/UuidValidatorTest.php index 23bfe8383..84edc6612 100644 --- a/Tests/Constraints/UuidValidatorTest.php +++ b/Tests/Constraints/UuidValidatorTest.php @@ -93,7 +93,7 @@ public static function getValidStrictUuids() */ public function testValidStrictUuidsWithWhitespaces($uuid, $versions = null) { - $constraint = new Uuid(['normalizer' => 'trim']); + $constraint = new Uuid(normalizer: 'trim'); if (null !== $versions) { $constraint->versions = $versions; @@ -131,9 +131,7 @@ public function testValidStrictUuidWithWhitespacesNamed() */ public function testInvalidStrictUuids($uuid, $code, $versions = null) { - $constraint = new Uuid([ - 'message' => 'testMessage', - ]); + $constraint = new Uuid(message: 'testMessage'); if (null !== $versions) { $constraint->versions = $versions; @@ -195,9 +193,7 @@ public static function getInvalidStrictUuids() */ public function testValidNonStrictUuids($uuid) { - $constraint = new Uuid([ - 'strict' => false, - ]); + $constraint = new Uuid(strict: false); $this->validator->validate($uuid, $constraint); @@ -226,10 +222,10 @@ public static function getValidNonStrictUuids() */ public function testInvalidNonStrictUuids($uuid, $code) { - $constraint = new Uuid([ - 'strict' => false, - 'message' => 'myMessage', - ]); + $constraint = new Uuid( + strict: false, + message: 'myMessage', + ); $this->validator->validate($uuid, $constraint); @@ -270,9 +266,7 @@ public function testInvalidNonStrictUuidNamed() */ public function testTimeBasedUuid(string $uid, bool $expectedTimeBased) { - $constraint = new Uuid([ - 'versions' => Uuid::TIME_BASED_VERSIONS, - ]); + $constraint = new Uuid(versions: Uuid::TIME_BASED_VERSIONS); $this->validator->validate($uid, $constraint); diff --git a/Tests/Constraints/ValidTest.php b/Tests/Constraints/ValidTest.php index c56cdedd5..a862171f1 100644 --- a/Tests/Constraints/ValidTest.php +++ b/Tests/Constraints/ValidTest.php @@ -23,7 +23,7 @@ class ValidTest extends TestCase { public function testGroupsCanBeSet() { - $constraint = new Valid(['groups' => 'foo']); + $constraint = new Valid(groups: ['foo']); $this->assertSame(['foo'], $constraint->groups); } diff --git a/Tests/Constraints/WhenTest.php b/Tests/Constraints/WhenTest.php index 58e1af3ab..6f82c6429 100644 --- a/Tests/Constraints/WhenTest.php +++ b/Tests/Constraints/WhenTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints\Callback; +use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Component\Validator\Constraints\When; @@ -21,9 +22,13 @@ use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\Validator\Mapping\Loader\AttributeLoader; use Symfony\Component\Validator\Tests\Constraints\Fixtures\WhenTestWithAttributes; +use Symfony\Component\Validator\Tests\Constraints\Fixtures\WhenTestWithClosure; final class WhenTest extends TestCase { + /** + * @group legacy + */ public function testMissingOptionsExceptionIsThrown() { $this->expectException(MissingOptionsException::class); @@ -59,24 +64,22 @@ public function testAttributes() self::assertInstanceOf(When::class, $classConstraint); self::assertSame('true', $classConstraint->expression); self::assertEquals([ - new Callback([ - 'callback' => 'callback', - 'groups' => ['Default', 'WhenTestWithAttributes'], - ]), + new Callback( + callback: 'callback', + groups: ['Default', 'WhenTestWithAttributes'], + ), ], $classConstraint->constraints); + self::assertSame([], $classConstraint->otherwise); [$fooConstraint] = $metadata->properties['foo']->getConstraints(); self::assertInstanceOf(When::class, $fooConstraint); self::assertSame('true', $fooConstraint->expression); self::assertEquals([ - new NotNull([ - 'groups' => ['Default', 'WhenTestWithAttributes'], - ]), - new NotBlank([ - 'groups' => ['Default', 'WhenTestWithAttributes'], - ]), + new NotNull(groups: ['Default', 'WhenTestWithAttributes']), + new NotBlank(groups: ['Default', 'WhenTestWithAttributes']), ], $fooConstraint->constraints); + self::assertSame([], $fooConstraint->otherwise); self::assertSame(['Default', 'WhenTestWithAttributes'], $fooConstraint->groups); [$barConstraint] = $metadata->properties['bar']->getConstraints(); @@ -84,24 +87,18 @@ public function testAttributes() self::assertInstanceOf(When::class, $barConstraint); self::assertSame('false', $barConstraint->expression); self::assertEquals([ - new NotNull([ - 'groups' => ['foo'], - ]), - new NotBlank([ - 'groups' => ['foo'], - ]), + new NotNull(groups: ['foo']), + new NotBlank(groups: ['foo']), ], $barConstraint->constraints); + self::assertSame([], $barConstraint->otherwise); self::assertSame(['foo'], $barConstraint->groups); [$quxConstraint] = $metadata->properties['qux']->getConstraints(); self::assertInstanceOf(When::class, $quxConstraint); self::assertSame('true', $quxConstraint->expression); - self::assertEquals([ - new NotNull([ - 'groups' => ['foo'], - ]), - ], $quxConstraint->constraints); + self::assertEquals([new NotNull(groups: ['foo'])], $quxConstraint->constraints); + self::assertSame([], $quxConstraint->otherwise); self::assertSame(['foo'], $quxConstraint->groups); [$bazConstraint] = $metadata->getters['baz']->getConstraints(); @@ -109,13 +106,52 @@ public function testAttributes() self::assertInstanceOf(When::class, $bazConstraint); self::assertSame('true', $bazConstraint->expression); self::assertEquals([ - new NotNull([ - 'groups' => ['Default', 'WhenTestWithAttributes'], - ]), - new NotBlank([ - 'groups' => ['Default', 'WhenTestWithAttributes'], - ]), + new NotNull(groups: ['Default', 'WhenTestWithAttributes']), + new NotBlank(groups: ['Default', 'WhenTestWithAttributes']), ], $bazConstraint->constraints); + self::assertSame([], $bazConstraint->otherwise); self::assertSame(['Default', 'WhenTestWithAttributes'], $bazConstraint->groups); + + [$quuxConstraint] = $metadata->properties['quux']->getConstraints(); + + self::assertInstanceOf(When::class, $quuxConstraint); + self::assertSame('true', $quuxConstraint->expression); + self::assertEquals([new NotNull(groups: ['foo'])], $quuxConstraint->constraints); + self::assertEquals([new Length(exactly: 10, groups: ['foo'])], $quuxConstraint->otherwise); + self::assertSame(['foo'], $quuxConstraint->groups); + } + + /** + * @requires PHP 8.5 + */ + public function testAttributesWithClosure() + { + $loader = new AttributeLoader(); + $metadata = new ClassMetadata(WhenTestWithClosure::class); + + self::assertTrue($loader->loadClassMetadata($metadata)); + + [$classConstraint] = $metadata->getConstraints(); + + self::assertInstanceOf(When::class, $classConstraint); + self::assertInstanceOf(\Closure::class, $classConstraint->expression); + self::assertEquals([ + new Callback( + callback: 'isValid', + groups: ['Default', 'WhenTestWithClosure'], + ), + ], $classConstraint->constraints); + self::assertSame([], $classConstraint->otherwise); + + [$fooConstraint] = $metadata->properties['foo']->getConstraints(); + + self::assertInstanceOf(When::class, $fooConstraint); + self::assertInstanceOf(\Closure::class, $fooConstraint->expression); + self::assertEquals([ + new NotNull(groups: ['Default', 'WhenTestWithClosure']), + new NotBlank(groups: ['Default', 'WhenTestWithClosure']), + ], $fooConstraint->constraints); + self::assertSame([], $fooConstraint->otherwise); + self::assertSame(['Default', 'WhenTestWithClosure'], $fooConstraint->groups); } } diff --git a/Tests/Constraints/WhenValidatorTest.php b/Tests/Constraints/WhenValidatorTest.php index f79d53031..35d8b8ce9 100644 --- a/Tests/Constraints/WhenValidatorTest.php +++ b/Tests/Constraints/WhenValidatorTest.php @@ -13,6 +13,7 @@ use Symfony\Component\Validator\Constraints\Blank; use Symfony\Component\Validator\Constraints\Callback; +use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NegativeOrZero; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotNull; @@ -33,10 +34,38 @@ public function testConstraintsAreExecuted() $this->expectValidateValue(0, 'Foo', $constraints); - $this->validator->validate('Foo', new When([ - 'expression' => 'true', - 'constraints' => $constraints, - ])); + $this->validator->validate('Foo', new When( + expression: 'true', + constraints: $constraints, + )); + } + + public function testConstraintsAreExecutedWhenClosureIsTrue() + { + $constraints = [ + new NotNull(), + new NotBlank(), + ]; + + $this->expectValidateValue(0, 'Foo', $constraints); + + $this->validator->validate('Foo', new When( + expression: static fn () => true, + constraints: $constraints, + )); + } + + public function testClosureTakesSubject() + { + $subject = new \stdClass(); + $this->setObject($subject); + + $this->validator->validate($subject, new When( + expression: static function ($closureSubject) use ($subject) { + self::assertSame($subject, $closureSubject); + }, + constraints: new NotNull(), + )); } public function testConstraintIsExecuted() @@ -44,10 +73,38 @@ public function testConstraintIsExecuted() $constraint = new NotNull(); $this->expectValidateValue(0, 'Foo', [$constraint]); - $this->validator->validate('Foo', new When([ - 'expression' => 'true', - 'constraints' => $constraint, - ])); + $this->validator->validate('Foo', new When( + expression: 'true', + constraints: $constraint, + )); + } + + public function testOtherwiseIsExecutedWhenFalse() + { + $constraint = new NotNull(); + $otherwise = new Length(exactly: 10); + + $this->expectValidateValue(0, 'Foo', [$otherwise]); + + $this->validator->validate('Foo', new When( + expression: 'false', + constraints: $constraint, + otherwise: $otherwise, + )); + } + + public function testOtherwiseIsExecutedWhenClosureReturnsFalse() + { + $constraint = new NotNull(); + $otherwise = new Length(exactly: 10); + + $this->expectValidateValue(0, 'Foo', [$otherwise]); + + $this->validator->validate('Foo', new When( + expression: static fn () => false, + constraints: $constraint, + otherwise: $otherwise, + )); } public function testConstraintsAreExecutedWithNull() @@ -58,10 +115,10 @@ public function testConstraintsAreExecutedWithNull() $this->expectValidateValue(0, null, $constraints); - $this->validator->validate(null, new When([ - 'expression' => 'true', - 'constraints' => $constraints, - ])); + $this->validator->validate(null, new When( + expression: 'true', + constraints: $constraints, + )); } public function testConstraintsAreExecutedWithObject() @@ -79,10 +136,10 @@ public function testConstraintsAreExecutedWithObject() $this->expectValidateValue(0, $number->value, $constraints); - $this->validator->validate($number->value, new When([ - 'expression' => 'this.type === "positive"', - 'constraints' => $constraints, - ])); + $this->validator->validate($number->value, new When( + expression: 'this.type === "positive"', + constraints: $constraints, + )); } public function testConstraintsAreExecutedWithNestedObject() @@ -104,10 +161,10 @@ public function testConstraintsAreExecutedWithNestedObject() $this->expectValidateValue(0, $number->value, $constraints); - $this->validator->validate($number->value, new When([ - 'expression' => 'context.getRoot().ok === true', - 'constraints' => $constraints, - ])); + $this->validator->validate($number->value, new When( + expression: 'context.getRoot().ok === true', + constraints: $constraints, + )); } public function testConstraintsAreExecutedWithValue() @@ -118,10 +175,10 @@ public function testConstraintsAreExecutedWithValue() $this->expectValidateValue(0, 'foo', $constraints); - $this->validator->validate('foo', new When([ - 'expression' => 'value === "foo"', - 'constraints' => $constraints, - ])); + $this->validator->validate('foo', new When( + expression: 'value === "foo"', + constraints: $constraints, + )); } public function testConstraintsAreExecutedWithExpressionValues() @@ -132,14 +189,14 @@ public function testConstraintsAreExecutedWithExpressionValues() $this->expectValidateValue(0, 'foo', $constraints); - $this->validator->validate('foo', new When([ - 'expression' => 'activated && value === compared_value', - 'constraints' => $constraints, - 'values' => [ + $this->validator->validate('foo', new When( + expression: 'activated && value === compared_value', + constraints: $constraints, + values: [ 'activated' => true, 'compared_value' => 'foo', ], - ])); + )); } public function testConstraintsNotExecuted() @@ -151,10 +208,25 @@ public function testConstraintsNotExecuted() $this->expectNoValidate(); - $this->validator->validate('', new When([ - 'expression' => 'false', - 'constraints' => $constraints, - ])); + $this->validator->validate('', new When( + expression: 'false', + constraints: $constraints, + )); + + $this->assertNoViolation(); + } + + public function testOtherwiseIsExecutedWhenTrue() + { + $constraints = [new NotNull()]; + + $this->expectValidateValue(0, '', $constraints); + + $this->validator->validate('', new When( + expression: 'true', + constraints: $constraints, + otherwise: new Length(exactly: 10), + )); $this->assertNoViolation(); } @@ -174,10 +246,10 @@ public function testConstraintsNotExecutedWithObject() $this->expectNoValidate(); - $this->validator->validate($number->value, new When([ - 'expression' => 'this.type !== "positive"', - 'constraints' => $constraints, - ])); + $this->validator->validate($number->value, new When( + expression: 'this.type !== "positive"', + constraints: $constraints, + )); $this->assertNoViolation(); } @@ -190,10 +262,10 @@ public function testConstraintsNotExecutedWithValue() $this->expectNoValidate(); - $this->validator->validate('foo', new When([ - 'expression' => 'value === null', - 'constraints' => $constraints, - ])); + $this->validator->validate('foo', new When( + expression: 'value === null', + constraints: $constraints, + )); $this->assertNoViolation(); } @@ -206,14 +278,14 @@ public function testConstraintsNotExecutedWithExpressionValues() $this->expectNoValidate(); - $this->validator->validate('foo', new When([ - 'expression' => 'activated && value === compared_value', - 'constraints' => $constraints, - 'values' => [ + $this->validator->validate('foo', new When( + expression: 'activated && value === compared_value', + constraints: $constraints, + values: [ 'activated' => true, 'compared_value' => 'bar', ], - ])); + )); $this->assertNoViolation(); } @@ -221,9 +293,7 @@ public function testConstraintsNotExecutedWithExpressionValues() public function testConstraintViolations() { $constraints = [ - new Blank([ - 'message' => 'my_message', - ]), + new Blank(message: 'my_message'), ]; $this->expectFailingValueValidation( 0, diff --git a/Tests/Constraints/YamlValidatorTest.php b/Tests/Constraints/YamlValidatorTest.php index a31892667..5a90ccf03 100644 --- a/Tests/Constraints/YamlValidatorTest.php +++ b/Tests/Constraints/YamlValidatorTest.php @@ -71,6 +71,27 @@ public function testInvalidFlags() ->assertRaised(); } + /** + * @dataProvider getDeprecationOnLinesData + */ + public function testDeprecationTriggersParseException(int $yamlLine, string $yamlValue) + { + $lines = explode("\n", $yamlValue); + $errorLine = end($lines); + $expectedError = 'This is a simulated deprecation at line '.$yamlLine.' (near "'.$errorLine.'")'; + + $constraint = new Yaml( + message: 'myMessageTest', + flags: YamlParser::PARSE_OBJECT, + ); + $this->validator->validate($yamlValue, $constraint); + $this->buildViolation('myMessageTest') + ->setParameter('{{ error }}', $expectedError) + ->setParameter('{{ line }}', $yamlLine) + ->setCode(Yaml::INVALID_YAML_ERROR) + ->assertRaised(); + } + public static function getValidValues() { return [ @@ -94,4 +115,34 @@ public static function getInvalidValues(): array ["key:\nvalue", 'Unable to parse at line 2 (near "value").', 2], ]; } + + /** + * @return array + */ + public static function getDeprecationOnLinesData(): array + { + $serialized = serialize(new DeprecatedObjectFixture()); + + return [ + 'deprecation at line 1' => [1, "object: !php/object '".$serialized."'"], + 'deprecation at line 2' => [2, "valid: yaml\nobject: !php/object '".$serialized."'"], + 'deprecation at line 5' => [5, "line1: value\nline2: value\nline3: value\nline4: value\nobject: !php/object '".$serialized."'"], + ]; + } +} + +/** + * Fixture class for triggering deprecation during unserialize. + */ +class DeprecatedObjectFixture +{ + public function __serialize(): array + { + return []; + } + + public function __unserialize(array $data): void + { + @trigger_error('This is a simulated deprecation', \E_USER_DEPRECATED); + } } diff --git a/Tests/Fixtures/DummyCompoundConstraint.php b/Tests/Fixtures/DummyCompoundConstraint.php index 87253f25d..e4f7bafaa 100644 --- a/Tests/Fixtures/DummyCompoundConstraint.php +++ b/Tests/Fixtures/DummyCompoundConstraint.php @@ -22,7 +22,7 @@ protected function getConstraints(array $options): array { return [ new NotBlank(), - new Length(['max' => 3]), + new Length(max: 3), new Regex('/[a-z]+/'), new Regex('/[0-9]+/'), ]; diff --git a/Tests/Fixtures/DummyEntityConstraintWithoutNamedArguments.php b/Tests/Fixtures/DummyEntityConstraintWithoutNamedArguments.php new file mode 100644 index 000000000..880f73cae --- /dev/null +++ b/Tests/Fixtures/DummyEntityConstraintWithoutNamedArguments.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +class DummyEntityConstraintWithoutNamedArguments +{ +} diff --git a/Tests/Fixtures/EntityStaticCar.php b/Tests/Fixtures/EntityStaticCar.php index af90ddc74..3afaaf843 100644 --- a/Tests/Fixtures/EntityStaticCar.php +++ b/Tests/Fixtures/EntityStaticCar.php @@ -18,6 +18,6 @@ class EntityStaticCar extends EntityStaticVehicle { public static function loadValidatorMetadata(ClassMetadata $metadata) { - $metadata->addPropertyConstraint('wheels', new Length(['max' => 99])); + $metadata->addPropertyConstraint('wheels', new Length(max: 99)); } } diff --git a/Tests/Fixtures/EntityStaticCarTurbo.php b/Tests/Fixtures/EntityStaticCarTurbo.php index d559074db..cb0efe281 100644 --- a/Tests/Fixtures/EntityStaticCarTurbo.php +++ b/Tests/Fixtures/EntityStaticCarTurbo.php @@ -18,6 +18,6 @@ class EntityStaticCarTurbo extends EntityStaticCar { public static function loadValidatorMetadata(ClassMetadata $metadata) { - $metadata->addPropertyConstraint('wheels', new Length(['max' => 99])); + $metadata->addPropertyConstraint('wheels', new Length(max: 99)); } } diff --git a/Tests/Fixtures/EntityStaticVehicle.php b/Tests/Fixtures/EntityStaticVehicle.php index 1190318fa..429bffdeb 100644 --- a/Tests/Fixtures/EntityStaticVehicle.php +++ b/Tests/Fixtures/EntityStaticVehicle.php @@ -20,6 +20,6 @@ class EntityStaticVehicle public static function loadValidatorMetadata(ClassMetadata $metadata) { - $metadata->addPropertyConstraint('wheels', new Length(['max' => 99])); + $metadata->addPropertyConstraint('wheels', new Length(max: 99)); } } diff --git a/Tests/Fixtures/FakeMetadataFactory.php b/Tests/Fixtures/FakeMetadataFactory.php index 6e673ee9f..f905b66fd 100644 --- a/Tests/Fixtures/FakeMetadataFactory.php +++ b/Tests/Fixtures/FakeMetadataFactory.php @@ -21,10 +21,10 @@ class FakeMetadataFactory implements MetadataFactoryInterface public function getMetadataFor($class): MetadataInterface { - $hash = null; + $objectId = null; if (\is_object($class)) { - $hash = spl_object_hash($class); + $objectId = spl_object_id($class); $class = $class::class; } @@ -33,8 +33,8 @@ public function getMetadataFor($class): MetadataInterface } if (!isset($this->metadatas[$class])) { - if (isset($this->metadatas[$hash])) { - return $this->metadatas[$hash]; + if (isset($this->metadatas[$objectId])) { + return $this->metadatas[$objectId]; } throw new NoSuchMetadataException(sprintf('No metadata for "%s"', $class)); @@ -45,10 +45,10 @@ public function getMetadataFor($class): MetadataInterface public function hasMetadataFor($class): bool { - $hash = null; + $objectId = null; if (\is_object($class)) { - $hash = spl_object_hash($class); + $objectId = spl_object_id($class); $class = $class::class; } @@ -56,7 +56,7 @@ public function hasMetadataFor($class): bool return false; } - return isset($this->metadatas[$class]) || isset($this->metadatas[$hash]); + return isset($this->metadatas[$class]) || isset($this->metadatas[$objectId]); } public function addMetadata($metadata) @@ -66,7 +66,7 @@ public function addMetadata($metadata) public function addMetadataForValue($value, MetadataInterface $metadata) { - $key = \is_object($value) ? spl_object_hash($value) : $value; + $key = \is_object($value) ? spl_object_id($value) : $value; $this->metadatas[$key] = $metadata; } } diff --git a/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php b/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php index d2250114f..68f279ecf 100644 --- a/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php +++ b/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php @@ -38,8 +38,8 @@ public function testLoadClassMetadataWithInterface() $metadata = $factory->getMetadataFor(self::PARENT_CLASS); $constraints = [ - new ConstraintA(['groups' => ['Default', 'EntityParent']]), - new ConstraintA(['groups' => ['Default', 'EntityInterfaceA', 'EntityParent']]), + new ConstraintA(groups: ['Default', 'EntityParent']), + new ConstraintA(groups: ['Default', 'EntityInterfaceA', 'EntityParent']), ]; $this->assertEquals($constraints, $metadata->getConstraints()); @@ -51,31 +51,31 @@ public function testMergeParentConstraints() $metadata = $factory->getMetadataFor(self::CLASS_NAME); $constraints = [ - new ConstraintA(['groups' => [ + new ConstraintA(groups: [ 'Default', 'Entity', - ]]), - new ConstraintA(['groups' => [ + ]), + new ConstraintA(groups: [ 'Default', 'EntityParent', 'Entity', - ]]), - new ConstraintA(['groups' => [ + ]), + new ConstraintA(groups: [ 'Default', 'EntityInterfaceA', 'EntityParent', 'Entity', - ]]), - new ConstraintA(['groups' => [ + ]), + new ConstraintA(groups: [ 'Default', 'EntityInterfaceB', 'Entity', - ]]), - new ConstraintA(['groups' => [ + ]), + new ConstraintA(groups: [ 'Default', 'EntityParentInterface', 'Entity', - ]]), + ]), ]; $this->assertEquals($constraints, $metadata->getConstraints()); @@ -87,8 +87,8 @@ public function testCachedMetadata() $factory = new LazyLoadingMetadataFactory(new TestLoader(), $cache); $expectedConstraints = [ - new ConstraintA(['groups' => ['Default', 'EntityParent']]), - new ConstraintA(['groups' => ['Default', 'EntityInterfaceA', 'EntityParent']]), + new ConstraintA(groups: ['Default', 'EntityParent']), + new ConstraintA(groups: ['Default', 'EntityInterfaceA', 'EntityParent']), ]; $metadata = $factory->getMetadataFor(self::PARENT_CLASS); diff --git a/Tests/Mapping/Loader/AttributeLoaderTest.php b/Tests/Mapping/Loader/AttributeLoaderTest.php index ca025431c..9285117f9 100644 --- a/Tests/Mapping/Loader/AttributeLoaderTest.php +++ b/Tests/Mapping/Loader/AttributeLoaderTest.php @@ -66,29 +66,29 @@ public function testLoadClassMetadata() $expected->addConstraint(new Sequentially([ new Expression('this.getFirstName() != null'), ])); - $expected->addConstraint(new Callback(['callback' => 'validateMe', 'payload' => 'foo'])); + $expected->addConstraint(new Callback(callback: 'validateMe', payload: 'foo')); $expected->addConstraint(new Callback('validateMeStatic')); $expected->addPropertyConstraint('firstName', new NotNull()); - $expected->addPropertyConstraint('firstName', new Range(['min' => 3])); - $expected->addPropertyConstraint('firstName', new All([new NotNull(), new Range(['min' => 3])])); - $expected->addPropertyConstraint('firstName', new All(['constraints' => [new NotNull(), new Range(['min' => 3])]])); - $expected->addPropertyConstraint('firstName', new Collection([ - 'foo' => [new NotNull(), new Range(['min' => 3])], - 'bar' => new Range(['min' => 5]), + $expected->addPropertyConstraint('firstName', new Range(min: 3)); + $expected->addPropertyConstraint('firstName', new All(constraints: [new NotNull(), new Range(min: 3)])); + $expected->addPropertyConstraint('firstName', new All(constraints: [new NotNull(), new Range(min: 3)])); + $expected->addPropertyConstraint('firstName', new Collection(fields: [ + 'foo' => [new NotNull(), new Range(min: 3)], + 'bar' => new Range(min: 5), 'baz' => new Required([new Email()]), 'qux' => new Optional([new NotBlank()]), - ], null, null, true)); - $expected->addPropertyConstraint('firstName', new Choice([ - 'message' => 'Must be one of %choices%', - 'choices' => ['A', 'B'], - ])); + ], allowExtraFields: true)); + $expected->addPropertyConstraint('firstName', new Choice( + message: 'Must be one of %choices%', + choices: ['A', 'B'], + )); $expected->addPropertyConstraint('firstName', new AtLeastOneOf([ new NotNull(), - new Range(['min' => 3]), + new Range(min: 3), ], null, null, 'foo', null, false)); $expected->addPropertyConstraint('firstName', new Sequentially([ new NotBlank(), - new Range(['min' => 5]), + new Range(min: 5), ])); $expected->addPropertyConstraint('childA', new Valid()); $expected->addPropertyConstraint('childB', new Valid()); @@ -152,29 +152,29 @@ public function testLoadClassMetadataAndMerge() $expected->addConstraint(new Sequentially([ new Expression('this.getFirstName() != null'), ])); - $expected->addConstraint(new Callback(['callback' => 'validateMe', 'payload' => 'foo'])); + $expected->addConstraint(new Callback(callback: 'validateMe', payload: 'foo')); $expected->addConstraint(new Callback('validateMeStatic')); $expected->addPropertyConstraint('firstName', new NotNull()); - $expected->addPropertyConstraint('firstName', new Range(['min' => 3])); - $expected->addPropertyConstraint('firstName', new All([new NotNull(), new Range(['min' => 3])])); - $expected->addPropertyConstraint('firstName', new All(['constraints' => [new NotNull(), new Range(['min' => 3])]])); - $expected->addPropertyConstraint('firstName', new Collection([ - 'foo' => [new NotNull(), new Range(['min' => 3])], - 'bar' => new Range(['min' => 5]), + $expected->addPropertyConstraint('firstName', new Range(min: 3)); + $expected->addPropertyConstraint('firstName', new All(constraints: [new NotNull(), new Range(min: 3)])); + $expected->addPropertyConstraint('firstName', new All(constraints: [new NotNull(), new Range(min: 3)])); + $expected->addPropertyConstraint('firstName', new Collection(fields: [ + 'foo' => [new NotNull(), new Range(min: 3)], + 'bar' => new Range(min: 5), 'baz' => new Required([new Email()]), 'qux' => new Optional([new NotBlank()]), - ], null, null, true)); - $expected->addPropertyConstraint('firstName', new Choice([ - 'message' => 'Must be one of %choices%', - 'choices' => ['A', 'B'], - ])); + ], allowExtraFields: true)); + $expected->addPropertyConstraint('firstName', new Choice( + message: 'Must be one of %choices%', + choices: ['A', 'B'], + )); $expected->addPropertyConstraint('firstName', new AtLeastOneOf([ new NotNull(), - new Range(['min' => 3]), + new Range(min: 3), ], null, null, 'foo', null, false)); $expected->addPropertyConstraint('firstName', new Sequentially([ new NotBlank(), - new Range(['min' => 5]), + new Range(min: 5), ])); $expected->addPropertyConstraint('childA', new Valid()); $expected->addPropertyConstraint('childB', new Valid()); diff --git a/Tests/Mapping/Loader/FilesLoaderTest.php b/Tests/Mapping/Loader/FilesLoaderTest.php index f2e84130c..ffb0dd23b 100644 --- a/Tests/Mapping/Loader/FilesLoaderTest.php +++ b/Tests/Mapping/Loader/FilesLoaderTest.php @@ -36,6 +36,13 @@ public function testCallsActualFileLoaderForMetadata() public function getFilesLoader(LoaderInterface $loader) { - return new class([__DIR__.'/constraint-mapping.xml', __DIR__.'/constraint-mapping.yaml', __DIR__.'/constraint-mapping.test', __DIR__.'/constraint-mapping.txt'], $loader) extends FilesLoader {}; + $files = [ + __DIR__.'/constraint-mapping.xml', + __DIR__.'/constraint-mapping.yaml', + __DIR__.'/constraint-mapping.test', + __DIR__.'/constraint-mapping.txt', + ]; + + return new class($files, $loader) extends FilesLoader {}; } } diff --git a/Tests/Mapping/Loader/Fixtures/ConstraintWithoutNamedArguments.php b/Tests/Mapping/Loader/Fixtures/ConstraintWithoutNamedArguments.php new file mode 100644 index 000000000..035a1a837 --- /dev/null +++ b/Tests/Mapping/Loader/Fixtures/ConstraintWithoutNamedArguments.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Mapping\Loader\Fixtures; + +use Symfony\Component\Validator\Constraint; + +class ConstraintWithoutNamedArguments extends Constraint +{ + public function getTargets(): string + { + return self::CLASS_CONSTRAINT; + } +} diff --git a/Tests/Mapping/Loader/PropertyInfoLoaderTest.php b/Tests/Mapping/Loader/PropertyInfoLoaderTest.php index 6c49f0d25..ae5253a3f 100644 --- a/Tests/Mapping/Loader/PropertyInfoLoaderTest.php +++ b/Tests/Mapping/Loader/PropertyInfoLoaderTest.php @@ -214,7 +214,7 @@ public function getTypes(string $class, string $property, array $context = []): $this->assertInstanceOf(Iban::class, $alreadyPartiallyMappedCollectionConstraints[0]->constraints[1]); $readOnlyMetadata = $classMetadata->getPropertyMetadata('readOnly'); - $this->assertEmpty($readOnlyMetadata); + $this->assertSame([], $readOnlyMetadata); /** @var PropertyMetadata[] $noAutoMappingMetadata */ $noAutoMappingMetadata = $classMetadata->getPropertyMetadata('noAutoMapping'); @@ -298,7 +298,7 @@ public function getTypes(string $class, string $property, array $context = []): /** @var ClassMetadata $classMetadata */ $classMetadata = $validator->getMetadataFor(new PropertyInfoLoaderNoAutoMappingEntity()); - $this->assertEmpty($classMetadata->getPropertyMetadata('string')); + $this->assertSame([], $classMetadata->getPropertyMetadata('string')); $this->assertCount(2, $classMetadata->getPropertyMetadata('autoMappingExplicitlyEnabled')[0]->constraints); $this->assertSame(AutoMappingStrategy::ENABLED, $classMetadata->getPropertyMetadata('autoMappingExplicitlyEnabled')[0]->getAutoMappingStrategy()); } diff --git a/Tests/Mapping/Loader/XmlFileLoaderTest.php b/Tests/Mapping/Loader/XmlFileLoaderTest.php index 2385dc888..03757720c 100644 --- a/Tests/Mapping/Loader/XmlFileLoaderTest.php +++ b/Tests/Mapping/Loader/XmlFileLoaderTest.php @@ -12,11 +12,13 @@ namespace Symfony\Component\Validator\Tests\Mapping\Loader; use PHPUnit\Framework\TestCase; +use Symfony\Bridge\PhpUnit\ExpectUserDeprecationMessageTrait; use Symfony\Component\Validator\Constraints\All; use Symfony\Component\Validator\Constraints\Callback; use Symfony\Component\Validator\Constraints\Choice; use Symfony\Component\Validator\Constraints\Collection; use Symfony\Component\Validator\Constraints\IsTrue; +use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Component\Validator\Constraints\Range; use Symfony\Component\Validator\Constraints\Regex; @@ -29,6 +31,7 @@ use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; use Symfony\Component\Validator\Tests\Fixtures\ConstraintB; use Symfony\Component\Validator\Tests\Fixtures\ConstraintWithRequiredArgument; +use Symfony\Component\Validator\Tests\Fixtures\DummyEntityConstraintWithoutNamedArguments; use Symfony\Component\Validator\Tests\Fixtures\Entity_81; use Symfony\Component\Validator\Tests\Fixtures\NestedAttribute\Entity; use Symfony\Component\Validator\Tests\Fixtures\NestedAttribute\GroupSequenceProviderEntity; @@ -37,6 +40,8 @@ class XmlFileLoaderTest extends TestCase { + use ExpectUserDeprecationMessageTrait; + public function testLoadClassMetadataReturnsTrueIfSuccessful() { $loader = new XmlFileLoader(__DIR__.'/constraint-mapping.xml'); @@ -72,18 +77,18 @@ public function testLoadClassMetadata() $expected->addConstraint(new ConstraintWithNamedArguments(['foo', 'bar'])); $expected->addConstraint(new ConstraintWithoutValueWithNamedArguments(['foo'])); $expected->addPropertyConstraint('firstName', new NotNull()); - $expected->addPropertyConstraint('firstName', new Range(['min' => 3])); + $expected->addPropertyConstraint('firstName', new Range(min: 3)); $expected->addPropertyConstraint('firstName', new Choice(['A', 'B'])); - $expected->addPropertyConstraint('firstName', new All([new NotNull(), new Range(['min' => 3])])); - $expected->addPropertyConstraint('firstName', new All(['constraints' => [new NotNull(), new Range(['min' => 3])]])); - $expected->addPropertyConstraint('firstName', new Collection(['fields' => [ - 'foo' => [new NotNull(), new Range(['min' => 3])], - 'bar' => [new Range(['min' => 5])], - ]])); - $expected->addPropertyConstraint('firstName', new Choice([ - 'message' => 'Must be one of %choices%', - 'choices' => ['A', 'B'], + $expected->addPropertyConstraint('firstName', new All(constraints: [new NotNull(), new Range(min: 3)])); + $expected->addPropertyConstraint('firstName', new All(constraints: [new NotNull(), new Range(min: 3)])); + $expected->addPropertyConstraint('firstName', new Collection(fields: [ + 'foo' => [new NotNull(), new Range(min: 3)], + 'bar' => [new Range(min: 5)], ])); + $expected->addPropertyConstraint('firstName', new Choice( + message: 'Must be one of %choices%', + choices: ['A', 'B'], + )); $expected->addGetterConstraint('lastName', new NotNull()); $expected->addGetterConstraint('valid', new IsTrue()); $expected->addGetterConstraint('permissions', new IsTrue()); @@ -99,7 +104,7 @@ public function testLoadClassMetadataWithNonStrings() $loader->loadClassMetadata($metadata); $expected = new ClassMetadata(Entity::class); - $expected->addPropertyConstraint('firstName', new Regex(['pattern' => '/^1/', 'match' => false])); + $expected->addPropertyConstraint('firstName', new Regex(pattern: '/^1/', match: false)); $properties = $metadata->getPropertyMetadata('firstName'); $constraints = $properties[0]->getConstraints(); @@ -171,4 +176,36 @@ public function testDoNotModifyStateIfExceptionIsThrown() $loader->loadClassMetadata($metadata); } } + + /** + * @group legacy + */ + public function testLoadConstraintWithoutNamedArgumentsSupport() + { + $loader = new XmlFileLoader(__DIR__.'/constraint-without-named-arguments-support.xml'); + $metadata = new ClassMetadata(DummyEntityConstraintWithoutNamedArguments::class); + + $this->expectUserDeprecationMessage('Since symfony/validator 7.3: Using constraints not supporting named arguments is deprecated. Try adding the HasNamedArguments attribute to Symfony\Component\Validator\Tests\Mapping\Loader\Fixtures\ConstraintWithoutNamedArguments.'); + + $loader->loadClassMetadata($metadata); + } + + /** + * @group legacy + */ + public function testLengthConstraintValueOptionTriggersDeprecation() + { + $loader = new XmlFileLoader(__DIR__.'/constraint-mapping-exactly-value.xml'); + $metadata = new ClassMetadata(Entity_81::class); + + $this->expectUserDeprecationMessage(\sprintf('Since symfony/validator 7.3: Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', Length::class)); + + $loader->loadClassMetadata($metadata); + $constraints = $metadata->getPropertyMetadata('title')[0]->constraints; + + self::assertCount(1, $constraints); + self::assertInstanceOf(Length::class, $constraints[0]); + self::assertSame(6, $constraints[0]->min); + self::assertSame(6, $constraints[0]->max); + } } diff --git a/Tests/Mapping/Loader/YamlFileLoaderTest.php b/Tests/Mapping/Loader/YamlFileLoaderTest.php index 75955c09f..c3bbcb18e 100644 --- a/Tests/Mapping/Loader/YamlFileLoaderTest.php +++ b/Tests/Mapping/Loader/YamlFileLoaderTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Tests\Mapping\Loader; use PHPUnit\Framework\TestCase; +use Symfony\Bridge\PhpUnit\ExpectUserDeprecationMessageTrait; use Symfony\Component\Validator\Constraints\All; use Symfony\Component\Validator\Constraints\Callback; use Symfony\Component\Validator\Constraints\Choice; @@ -26,6 +27,7 @@ use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; use Symfony\Component\Validator\Tests\Fixtures\ConstraintB; use Symfony\Component\Validator\Tests\Fixtures\ConstraintWithRequiredArgument; +use Symfony\Component\Validator\Tests\Fixtures\DummyEntityConstraintWithoutNamedArguments; use Symfony\Component\Validator\Tests\Fixtures\Entity_81; use Symfony\Component\Validator\Tests\Fixtures\NestedAttribute\Entity; use Symfony\Component\Validator\Tests\Fixtures\NestedAttribute\GroupSequenceProviderEntity; @@ -34,6 +36,8 @@ class YamlFileLoaderTest extends TestCase { + use ExpectUserDeprecationMessageTrait; + public function testLoadClassMetadataReturnsFalseIfEmpty() { $loader = new YamlFileLoader(__DIR__.'/empty-mapping.yml'); @@ -116,18 +120,18 @@ public function testLoadClassMetadata() $expected->addConstraint(new ConstraintWithNamedArguments('foo')); $expected->addConstraint(new ConstraintWithNamedArguments(['foo', 'bar'])); $expected->addPropertyConstraint('firstName', new NotNull()); - $expected->addPropertyConstraint('firstName', new Range(['min' => 3])); + $expected->addPropertyConstraint('firstName', new Range(min: 3)); $expected->addPropertyConstraint('firstName', new Choice(['A', 'B'])); - $expected->addPropertyConstraint('firstName', new All([new NotNull(), new Range(['min' => 3])])); - $expected->addPropertyConstraint('firstName', new All(['constraints' => [new NotNull(), new Range(['min' => 3])]])); - $expected->addPropertyConstraint('firstName', new Collection(['fields' => [ - 'foo' => [new NotNull(), new Range(['min' => 3])], - 'bar' => [new Range(['min' => 5])], - ]])); - $expected->addPropertyConstraint('firstName', new Choice([ - 'message' => 'Must be one of %choices%', - 'choices' => ['A', 'B'], + $expected->addPropertyConstraint('firstName', new All(constraints: [new NotNull(), new Range(min: 3)])); + $expected->addPropertyConstraint('firstName', new All(constraints: [new NotNull(), new Range(min: 3)])); + $expected->addPropertyConstraint('firstName', new Collection(fields: [ + 'foo' => [new NotNull(), new Range(min: 3)], + 'bar' => [new Range(min: 5)], ])); + $expected->addPropertyConstraint('firstName', new Choice( + message: 'Must be one of %choices%', + choices: ['A', 'B'], + )); $expected->addGetterConstraint('lastName', new NotNull()); $expected->addGetterConstraint('valid', new IsTrue()); $expected->addGetterConstraint('permissions', new IsTrue()); @@ -143,7 +147,7 @@ public function testLoadClassMetadataWithConstants() $loader->loadClassMetadata($metadata); $expected = new ClassMetadata(Entity::class); - $expected->addPropertyConstraint('firstName', new Range(['max' => \PHP_INT_MAX])); + $expected->addPropertyConstraint('firstName', new Range(max: \PHP_INT_MAX)); $this->assertEquals($expected, $metadata); } @@ -187,4 +191,17 @@ public function testLoadGroupProvider() $this->assertEquals($expected, $metadata); } + + /** + * @group legacy + */ + public function testLoadConstraintWithoutNamedArgumentsSupport() + { + $loader = new YamlFileLoader(__DIR__.'/constraint-without-named-arguments-support.yml'); + $metadata = new ClassMetadata(DummyEntityConstraintWithoutNamedArguments::class); + + $this->expectUserDeprecationMessage('Since symfony/validator 7.3: Using constraints not supporting named arguments is deprecated. Try adding the HasNamedArguments attribute to Symfony\Component\Validator\Tests\Mapping\Loader\Fixtures\ConstraintWithoutNamedArguments.'); + + $loader->loadClassMetadata($metadata); + } } diff --git a/Tests/Mapping/Loader/constraint-mapping-exactly-value.xml b/Tests/Mapping/Loader/constraint-mapping-exactly-value.xml new file mode 100644 index 000000000..40e04f3a3 --- /dev/null +++ b/Tests/Mapping/Loader/constraint-mapping-exactly-value.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/Tests/Mapping/Loader/constraint-without-named-arguments-support.xml b/Tests/Mapping/Loader/constraint-without-named-arguments-support.xml new file mode 100644 index 000000000..48321b174 --- /dev/null +++ b/Tests/Mapping/Loader/constraint-without-named-arguments-support.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/Tests/Mapping/Loader/constraint-without-named-arguments-support.yml b/Tests/Mapping/Loader/constraint-without-named-arguments-support.yml new file mode 100644 index 000000000..3e25b78e4 --- /dev/null +++ b/Tests/Mapping/Loader/constraint-without-named-arguments-support.yml @@ -0,0 +1,4 @@ +Symfony\Component\Validator\Tests\Fixtures\DummyEntityConstraintWithoutNamedArguments: + constraints: + - Symfony\Component\Validator\Tests\Mapping\Loader\Fixtures\ConstraintWithoutNamedArguments: + groups: foo diff --git a/Tests/Mapping/MemberMetadataTest.php b/Tests/Mapping/MemberMetadataTest.php index cd429e676..84d047f10 100644 --- a/Tests/Mapping/MemberMetadataTest.php +++ b/Tests/Mapping/MemberMetadataTest.php @@ -84,7 +84,7 @@ public function testSerialize() public function testSerializeCollectionCascaded() { - $this->metadata->addConstraint(new Valid(['traverse' => true])); + $this->metadata->addConstraint(new Valid(traverse: true)); $metadata = unserialize(serialize($this->metadata)); @@ -93,7 +93,7 @@ public function testSerializeCollectionCascaded() public function testSerializeCollectionNotCascaded() { - $this->metadata->addConstraint(new Valid(['traverse' => false])); + $this->metadata->addConstraint(new Valid(traverse: false)); $metadata = unserialize(serialize($this->metadata)); diff --git a/Tests/Validator/RecursiveValidatorTest.php b/Tests/Validator/RecursiveValidatorTest.php index 19d8e4140..1ae14ba30 100644 --- a/Tests/Validator/RecursiveValidatorTest.php +++ b/Tests/Validator/RecursiveValidatorTest.php @@ -113,10 +113,10 @@ public function testValidate() $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $constraint = new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ]); + $constraint = new Callback( + callback: $callback, + groups: ['Group'], + ); $violations = $this->validate('Bernhard', $constraint, 'Group'); @@ -149,10 +149,10 @@ public function testClassConstraint() $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->metadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($entity, null, 'Group'); @@ -188,10 +188,10 @@ public function testPropertyConstraint() $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addPropertyConstraint('firstName', new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->metadata->addPropertyConstraint('firstName', new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($entity, null, 'Group'); @@ -227,10 +227,10 @@ public function testGetterConstraint() $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addGetterConstraint('lastName', new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->metadata->addGetterConstraint('lastName', new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($entity, null, 'Group'); @@ -264,10 +264,10 @@ public function testArray() $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->metadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($array, null, 'Group'); @@ -301,10 +301,10 @@ public function testRecursiveArray() $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->metadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($array, null, 'Group'); @@ -338,10 +338,10 @@ public function testTraversable() $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->metadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($traversable, null, 'Group'); @@ -377,10 +377,10 @@ public function testRecursiveTraversable() $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->metadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($traversable, null, 'Group'); @@ -415,10 +415,10 @@ public function testReferenceClassConstraint() }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($entity, null, 'Group'); @@ -456,10 +456,10 @@ public function testReferencePropertyConstraint() }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addPropertyConstraint('value', new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->referenceMetadata->addPropertyConstraint('value', new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($entity, null, 'Group'); @@ -497,10 +497,10 @@ public function testReferenceGetterConstraint() }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addPropertyConstraint('privateValue', new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->referenceMetadata->addPropertyConstraint('privateValue', new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($entity, null, 'Group'); @@ -563,10 +563,10 @@ public function testArrayReference($constraintMethod) }; $this->metadata->$constraintMethod('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($entity, null, 'Group'); @@ -604,10 +604,10 @@ public function testRecursiveArrayReference($constraintMethod) }; $this->metadata->$constraintMethod('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($entity, null, 'Group'); @@ -632,14 +632,14 @@ public function testOnlyCascadedArraysAreTraversed() $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addPropertyConstraint('reference', new Callback([ - 'callback' => function () {}, - 'groups' => 'Group', - ])); - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->metadata->addPropertyConstraint('reference', new Callback( + callback: function () {}, + groups: ['Group'], + )); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($entity, null, 'Group'); @@ -659,9 +659,9 @@ public function testArrayTraversalCannotBeDisabled($constraintMethod) $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->$constraintMethod('reference', new Valid([ - 'traverse' => false, - ])); + $this->metadata->$constraintMethod('reference', new Valid( + traverse: false, + )); $this->referenceMetadata->addConstraint(new Callback($callback)); $violations = $this->validate($entity); @@ -682,9 +682,9 @@ public function testRecursiveArrayTraversalCannotBeDisabled($constraintMethod) $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->$constraintMethod('reference', new Valid([ - 'traverse' => false, - ])); + $this->metadata->$constraintMethod('reference', new Valid( + traverse: false, + )); $this->referenceMetadata->addConstraint(new Callback($callback)); @@ -745,10 +745,10 @@ public function testTraversableReference() }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($entity, null, 'Group'); @@ -774,9 +774,9 @@ public function testDisableTraversableTraversal() }; $this->metadataFactory->addMetadata(new ClassMetadata('ArrayIterator')); - $this->metadata->addPropertyConstraint('reference', new Valid([ - 'traverse' => false, - ])); + $this->metadata->addPropertyConstraint('reference', new Valid( + traverse: false, + )); $this->referenceMetadata->addConstraint(new Callback($callback)); $violations = $this->validate($entity); @@ -790,9 +790,9 @@ public function testMetadataMustExistIfTraversalIsDisabled() $entity = new Entity(); $entity->reference = new \ArrayIterator(); - $this->metadata->addPropertyConstraint('reference', new Valid([ - 'traverse' => false, - ])); + $this->metadata->addPropertyConstraint('reference', new Valid( + traverse: false, + )); $this->expectException(NoSuchMetadataException::class); @@ -819,13 +819,13 @@ public function testEnableRecursiveTraversableTraversal() $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addPropertyConstraint('reference', new Valid([ - 'traverse' => true, - ])); - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->metadata->addPropertyConstraint('reference', new Valid( + traverse: true, + )); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($entity, null, 'Group'); @@ -866,14 +866,14 @@ public function testValidateProperty() $context->addViolation('Other violation'); }; - $this->metadata->addPropertyConstraint('firstName', new Callback([ - 'callback' => $callback1, - 'groups' => 'Group', - ])); - $this->metadata->addPropertyConstraint('lastName', new Callback([ - 'callback' => $callback2, - 'groups' => 'Group', - ])); + $this->metadata->addPropertyConstraint('firstName', new Callback( + callback: $callback1, + groups: ['Group'], + )); + $this->metadata->addPropertyConstraint('lastName', new Callback( + callback: $callback2, + groups: ['Group'], + )); $violations = $this->validateProperty($entity, 'firstName', 'Group'); @@ -924,14 +924,14 @@ public function testValidatePropertyValue() $context->addViolation('Other violation'); }; - $this->metadata->addPropertyConstraint('firstName', new Callback([ - 'callback' => $callback1, - 'groups' => 'Group', - ])); - $this->metadata->addPropertyConstraint('lastName', new Callback([ - 'callback' => $callback2, - 'groups' => 'Group', - ])); + $this->metadata->addPropertyConstraint('firstName', new Callback( + callback: $callback1, + groups: ['Group'], + )); + $this->metadata->addPropertyConstraint('lastName', new Callback( + callback: $callback2, + groups: ['Group'], + )); $violations = $this->validatePropertyValue( $entity, @@ -973,14 +973,14 @@ public function testValidatePropertyValueWithClassName() $context->addViolation('Other violation'); }; - $this->metadata->addPropertyConstraint('firstName', new Callback([ - 'callback' => $callback1, - 'groups' => 'Group', - ])); - $this->metadata->addPropertyConstraint('lastName', new Callback([ - 'callback' => $callback2, - 'groups' => 'Group', - ])); + $this->metadata->addPropertyConstraint('firstName', new Callback( + callback: $callback1, + groups: ['Group'], + )); + $this->metadata->addPropertyConstraint('lastName', new Callback( + callback: $callback2, + groups: ['Group'], + )); $violations = $this->validatePropertyValue( self::ENTITY_CLASS, @@ -1060,14 +1060,14 @@ public function testValidateSingleGroup() $context->addViolation('Message'); }; - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group 1', - ])); - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group 2', - ])); + $this->metadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group 1'], + )); + $this->metadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group 2'], + )); $violations = $this->validate($entity, null, 'Group 2'); @@ -1083,14 +1083,14 @@ public function testValidateMultipleGroups() $context->addViolation('Message'); }; - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group 1', - ])); - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group 2', - ])); + $this->metadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group 1'], + )); + $this->metadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group 2'], + )); $violations = $this->validate($entity, null, ['Group 1', 'Group 2']); @@ -1109,18 +1109,18 @@ public function testReplaceDefaultGroupByGroupSequenceObject() $context->addViolation('Violation in Group 3'); }; - $this->metadata->addConstraint(new Callback([ - 'callback' => function () {}, - 'groups' => 'Group 1', - ])); - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback1, - 'groups' => 'Group 2', - ])); - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback2, - 'groups' => 'Group 3', - ])); + $this->metadata->addConstraint(new Callback( + callback: function () {}, + groups: ['Group 1'], + )); + $this->metadata->addConstraint(new Callback( + callback: $callback1, + groups: ['Group 2'], + )); + $this->metadata->addConstraint(new Callback( + callback: $callback2, + groups: ['Group 3'], + )); $sequence = new GroupSequence(['Group 1', 'Group 2', 'Group 3', 'Entity']); $this->metadata->setGroupSequence($sequence); @@ -1143,18 +1143,18 @@ public function testReplaceDefaultGroupByGroupSequenceArray() $context->addViolation('Violation in Group 3'); }; - $this->metadata->addConstraint(new Callback([ - 'callback' => function () {}, - 'groups' => 'Group 1', - ])); - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback1, - 'groups' => 'Group 2', - ])); - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback2, - 'groups' => 'Group 3', - ])); + $this->metadata->addConstraint(new Callback( + callback: function () {}, + groups: ['Group 1'], + )); + $this->metadata->addConstraint(new Callback( + callback: $callback1, + groups: ['Group 2'], + )); + $this->metadata->addConstraint(new Callback( + callback: $callback2, + groups: ['Group 3'], + )); $sequence = ['Group 1', 'Group 2', 'Group 3', 'Entity']; $this->metadata->setGroupSequence($sequence); @@ -1179,14 +1179,14 @@ public function testPropagateDefaultGroupToReferenceWhenReplacingDefaultGroup() }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback1, - 'groups' => 'Default', - ])); - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback2, - 'groups' => 'Group 1', - ])); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback1, + groups: ['Default'], + )); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback2, + groups: ['Group 1'], + )); $sequence = new GroupSequence(['Group 1', 'Entity']); $this->metadata->setGroupSequence($sequence); @@ -1209,14 +1209,14 @@ public function testValidateCustomGroupWhenDefaultGroupWasReplaced() $context->addViolation('Violation in group sequence'); }; - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback1, - 'groups' => 'Other Group', - ])); - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback2, - 'groups' => 'Group 1', - ])); + $this->metadata->addConstraint(new Callback( + callback: $callback1, + groups: ['Other Group'], + )); + $this->metadata->addConstraint(new Callback( + callback: $callback2, + groups: ['Group 1'], + )); $sequence = new GroupSequence(['Group 1', 'Entity']); $this->metadata->setGroupSequence($sequence); @@ -1243,18 +1243,18 @@ public function testReplaceDefaultGroup($sequence, array $assertViolations) }; $metadata = new ClassMetadata($entity::class); - $metadata->addConstraint(new Callback([ - 'callback' => function () {}, - 'groups' => 'Group 1', - ])); - $metadata->addConstraint(new Callback([ - 'callback' => $callback1, - 'groups' => 'Group 2', - ])); - $metadata->addConstraint(new Callback([ - 'callback' => $callback2, - 'groups' => 'Group 3', - ])); + $metadata->addConstraint(new Callback( + callback: function () {}, + groups: ['Group 1'], + )); + $metadata->addConstraint(new Callback( + callback: $callback1, + groups: ['Group 2'], + )); + $metadata->addConstraint(new Callback( + callback: $callback2, + groups: ['Group 3'], + )); $metadata->setGroupSequenceProvider(true); $this->metadataFactory->addMetadata($metadata); @@ -1348,18 +1348,18 @@ public function testGroupSequenceAbortsAfterFailedGroup() $context->addViolation('Message 2'); }; - $this->metadata->addConstraint(new Callback([ - 'callback' => function () {}, - 'groups' => 'Group 1', - ])); - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback1, - 'groups' => 'Group 2', - ])); - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback2, - 'groups' => 'Group 3', - ])); + $this->metadata->addConstraint(new Callback( + callback: function () {}, + groups: ['Group 1'], + )); + $this->metadata->addConstraint(new Callback( + callback: $callback1, + groups: ['Group 2'], + )); + $this->metadata->addConstraint(new Callback( + callback: $callback2, + groups: ['Group 3'], + )); $sequence = new GroupSequence(['Group 1', 'Group 2', 'Group 3']); $violations = $this->validator->validate($entity, new Valid(), $sequence); @@ -1382,14 +1382,14 @@ public function testGroupSequenceIncludesReferences() }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback1, - 'groups' => 'Group 1', - ])); - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback2, - 'groups' => 'Group 2', - ])); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback1, + groups: ['Group 1'], + )); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback2, + groups: ['Group 2'], + )); $sequence = new GroupSequence(['Group 1', 'Entity']); $violations = $this->validator->validate($entity, new Valid(), $sequence); @@ -1442,14 +1442,14 @@ public function testValidateInSeparateContext() $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback1, - 'groups' => 'Group', - ])); - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback2, - 'groups' => 'Group', - ])); + $this->metadata->addConstraint(new Callback( + callback: $callback1, + groups: ['Group'], + )); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback2, + groups: ['Group'], + )); $violations = $this->validator->validate($entity, new Valid(), 'Group'); @@ -1498,14 +1498,14 @@ public function testValidateInContext() $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback1, - 'groups' => 'Group', - ])); - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback2, - 'groups' => 'Group', - ])); + $this->metadata->addConstraint(new Callback( + callback: $callback1, + groups: ['Group'], + )); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback2, + groups: ['Group'], + )); $violations = $this->validator->validate($entity, new Valid(), 'Group'); @@ -1561,14 +1561,14 @@ public function testValidateArrayInContext() $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback1, - 'groups' => 'Group', - ])); - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback2, - 'groups' => 'Group', - ])); + $this->metadata->addConstraint(new Callback( + callback: $callback1, + groups: ['Group'], + )); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback2, + groups: ['Group'], + )); $violations = $this->validator->validate($entity, new Valid(), 'Group'); @@ -1603,10 +1603,10 @@ public function testTraverseTraversableByDefault() }; $this->metadataFactory->addMetadata(new ClassMetadata('ArrayIterator')); - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->metadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($traversable, new Valid(), 'Group'); @@ -1635,10 +1635,10 @@ public function testTraversalEnabledOnClass() $traversableMetadata->addConstraint(new Traverse(true)); $this->metadataFactory->addMetadata($traversableMetadata); - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->metadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($traversable, new Valid(), 'Group'); @@ -1659,10 +1659,10 @@ public function testTraversalDisabledOnClass() $traversableMetadata->addConstraint(new Traverse(false)); $this->metadataFactory->addMetadata($traversableMetadata); - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->metadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($traversable, new Valid(), 'Group'); @@ -1692,10 +1692,10 @@ public function testReferenceTraversalDisabledOnClass() $traversableMetadata->addConstraint(new Traverse(false)); $this->metadataFactory->addMetadata($traversableMetadata); - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $this->metadata->addPropertyConstraint('reference', new Valid()); $violations = $this->validate($entity, new Valid(), 'Group'); @@ -1717,13 +1717,13 @@ public function testReferenceTraversalEnabledOnReferenceDisabledOnClass() $traversableMetadata->addConstraint(new Traverse(false)); $this->metadataFactory->addMetadata($traversableMetadata); - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); - $this->metadata->addPropertyConstraint('reference', new Valid([ - 'traverse' => true, - ])); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); + $this->metadata->addPropertyConstraint('reference', new Valid( + traverse: true, + )); $violations = $this->validate($entity, new Valid(), 'Group'); @@ -1744,13 +1744,13 @@ public function testReferenceTraversalDisabledOnReferenceEnabledOnClass() $traversableMetadata->addConstraint(new Traverse(true)); $this->metadataFactory->addMetadata($traversableMetadata); - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); - $this->metadata->addPropertyConstraint('reference', new Valid([ - 'traverse' => false, - ])); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); + $this->metadata->addPropertyConstraint('reference', new Valid( + traverse: false, + )); $violations = $this->validate($entity, new Valid(), 'Group'); @@ -1767,10 +1767,10 @@ public function testReferenceCascadeDisabledByDefault() $this->fail('Should not be called'); }; - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($entity, new Valid(), 'Group'); @@ -1789,10 +1789,10 @@ public function testReferenceCascadeEnabledIgnoresUntyped() $this->fail('Should not be called'); }; - $this->referenceMetadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $this->referenceMetadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $violations = $this->validate($entity, new Valid(), 'Group'); @@ -1816,10 +1816,10 @@ public function testTypedReferenceCascadeEnabled() $cascadingMetadata->addConstraint(new Cascade()); $cascadedMetadata = new ClassMetadata(CascadedChild::class); - $cascadedMetadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => 'Group', - ])); + $cascadedMetadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group'], + )); $this->metadataFactory->addMetadata($cascadingMetadata); $this->metadataFactory->addMetadata($cascadedMetadata); @@ -1868,10 +1868,10 @@ public function testNoDuplicateValidationIfClassConstraintInMultipleGroups() $context->addViolation('Message'); }; - $this->metadata->addConstraint(new Callback([ - 'callback' => $callback, - 'groups' => ['Group 1', 'Group 2'], - ])); + $this->metadata->addConstraint(new Callback( + callback: $callback, + groups: ['Group 1', 'Group 2'], + )); $violations = $this->validator->validate($entity, new Valid(), ['Group 1', 'Group 2']); @@ -1887,10 +1887,10 @@ public function testNoDuplicateValidationIfPropertyConstraintInMultipleGroups() $context->addViolation('Message'); }; - $this->metadata->addPropertyConstraint('firstName', new Callback([ - 'callback' => $callback, - 'groups' => ['Group 1', 'Group 2'], - ])); + $this->metadata->addPropertyConstraint('firstName', new Callback( + callback: $callback, + groups: ['Group 1', 'Group 2'], + )); $violations = $this->validator->validate($entity, new Valid(), ['Group 1', 'Group 2']); @@ -2007,8 +2007,8 @@ public function testNestedObjectIsNotValidatedIfGroupInValidConstraintIsNotValid $reference->value = ''; $entity->childA = $reference; - $this->metadata->addPropertyConstraint('firstName', new NotBlank(['groups' => 'group1'])); - $this->metadata->addPropertyConstraint('childA', new Valid(['groups' => 'group1'])); + $this->metadata->addPropertyConstraint('firstName', new NotBlank(groups: ['group1'])); + $this->metadata->addPropertyConstraint('childA', new Valid(groups: ['group1'])); $this->referenceMetadata->addPropertyConstraint('value', new NotBlank()); $violations = $this->validator->validate($entity, null, []); @@ -2024,9 +2024,9 @@ public function testNestedObjectIsValidatedIfGroupInValidConstraintIsValidated() $reference->value = ''; $entity->childA = $reference; - $this->metadata->addPropertyConstraint('firstName', new NotBlank(['groups' => 'group1'])); - $this->metadata->addPropertyConstraint('childA', new Valid(['groups' => 'group1'])); - $this->referenceMetadata->addPropertyConstraint('value', new NotBlank(['groups' => 'group1'])); + $this->metadata->addPropertyConstraint('firstName', new NotBlank(groups: ['group1'])); + $this->metadata->addPropertyConstraint('childA', new Valid(groups: ['group1'])); + $this->referenceMetadata->addPropertyConstraint('value', new NotBlank(groups: ['group1'])); $violations = $this->validator->validate($entity, null, ['Default', 'group1']); @@ -2044,10 +2044,10 @@ public function testNestedObjectIsValidatedInMultipleGroupsIfGroupInValidConstra $entity->childA = $reference; $this->metadata->addPropertyConstraint('firstName', new NotBlank()); - $this->metadata->addPropertyConstraint('childA', new Valid(['groups' => ['group1', 'group2']])); + $this->metadata->addPropertyConstraint('childA', new Valid(groups: ['group1', 'group2'])); - $this->referenceMetadata->addPropertyConstraint('value', new NotBlank(['groups' => 'group1'])); - $this->referenceMetadata->addPropertyConstraint('value', new NotNull(['groups' => 'group2'])); + $this->referenceMetadata->addPropertyConstraint('value', new NotBlank(groups: ['group1'])); + $this->referenceMetadata->addPropertyConstraint('value', new NotNull(groups: ['group2'])); $violations = $this->validator->validate($entity, null, ['Default', 'group1', 'group2']); @@ -2136,10 +2136,10 @@ public function testRelationBetweenChildAAndChildB() public function testCollectionConstraintValidateAllGroupsForNestedConstraints() { - $this->metadata->addPropertyConstraint('data', new Collection(['fields' => [ - 'one' => [new NotBlank(['groups' => 'one']), new Length(['min' => 2, 'groups' => 'two'])], - 'two' => [new NotBlank(['groups' => 'two'])], - ]])); + $this->metadata->addPropertyConstraint('data', new Collection(fields: [ + 'one' => [new NotBlank(groups: ['one']), new Length(min: 2, groups: ['two'])], + 'two' => [new NotBlank(groups: ['two'])], + ])); $entity = new Entity(); $entity->data = ['one' => 't', 'two' => '']; @@ -2154,9 +2154,9 @@ public function testCollectionConstraintValidateAllGroupsForNestedConstraints() public function testGroupedMethodConstraintValidateInSequence() { $metadata = new ClassMetadata(EntityWithGroupedConstraintOnMethods::class); - $metadata->addPropertyConstraint('bar', new NotNull(['groups' => 'Foo'])); - $metadata->addGetterMethodConstraint('validInFoo', 'isValidInFoo', new IsTrue(['groups' => 'Foo'])); - $metadata->addGetterMethodConstraint('bar', 'getBar', new NotNull(['groups' => 'Bar'])); + $metadata->addPropertyConstraint('bar', new NotNull(groups: ['Foo'])); + $metadata->addGetterMethodConstraint('validInFoo', 'isValidInFoo', new IsTrue(groups: ['Foo'])); + $metadata->addGetterMethodConstraint('bar', 'getBar', new NotNull(groups: ['Bar'])); $this->metadataFactory->addMetadata($metadata); @@ -2197,10 +2197,13 @@ public function testNotNullConstraintOnGetterReturningNull() public function testAllConstraintValidateAllGroupsForNestedConstraints() { - $this->metadata->addPropertyConstraint('data', new All(['constraints' => [ - new NotBlank(['groups' => 'one']), - new Length(['min' => 2, 'groups' => 'two']), - ]])); + $this->metadata->addPropertyConstraint('data', new All(constraints: [ + new NotBlank(groups: ['one']), + new Length( + min: 2, + groups: ['two'], + ), + ])); $entity = new Entity(); $entity->data = ['one' => 't', 'two' => '']; @@ -2330,8 +2333,8 @@ public function testValidateWithExplicitCascade() public function testValidatedConstraintsHashesDoNotCollide() { $metadata = new ClassMetadata(Entity::class); - $metadata->addPropertyConstraint('initialized', new NotNull(['groups' => 'should_pass'])); - $metadata->addPropertyConstraint('initialized', new IsNull(['groups' => 'should_fail'])); + $metadata->addPropertyConstraint('initialized', new NotNull(groups: ['should_pass'])); + $metadata->addPropertyConstraint('initialized', new IsNull(groups: ['should_fail'])); $this->metadataFactory->addMetadata($metadata); diff --git a/Tests/ValidatorBuilderTest.php b/Tests/ValidatorBuilderTest.php index c57a507e2..ec464b748 100644 --- a/Tests/ValidatorBuilderTest.php +++ b/Tests/ValidatorBuilderTest.php @@ -99,6 +99,11 @@ public function testSetTranslationDomain() $this->assertSame($this->builder, $this->builder->setTranslationDomain('TRANS_DOMAIN')); } + public function testDisableTranslation() + { + $this->assertSame($this->builder, $this->builder->disableTranslation()); + } + public function testGetValidator() { $this->assertInstanceOf(RecursiveValidator::class, $this->builder->getValidator()); diff --git a/Validator/TraceableValidator.php b/Validator/TraceableValidator.php index 5442c53da..6f9ab5bbc 100644 --- a/Validator/TraceableValidator.php +++ b/Validator/TraceableValidator.php @@ -29,6 +29,7 @@ class TraceableValidator implements ValidatorInterface, ResetInterface public function __construct( private ValidatorInterface $validator, + protected readonly ?\Closure $disabled = null, ) { } @@ -56,6 +57,10 @@ public function validate(mixed $value, Constraint|array|null $constraints = null { $violations = $this->validator->validate($value, $constraints, $groups); + if ($this->disabled?->__invoke()) { + return $violations; + } + $trace = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 7); $file = $trace[0]['file']; diff --git a/ValidatorBuilder.php b/ValidatorBuilder.php index 83e543b8f..917f1c57a 100644 --- a/ValidatorBuilder.php +++ b/ValidatorBuilder.php @@ -50,7 +50,7 @@ class ValidatorBuilder private ?ContainerInterface $groupProviderLocator = null; private ?CacheItemPoolInterface $mappingCache = null; private ?TranslatorInterface $translator = null; - private ?string $translationDomain = null; + private string|false|null $translationDomain = null; /** * Adds an object initializer to the validator. @@ -292,6 +292,16 @@ public function setTranslationDomain(?string $translationDomain): static return $this; } + /** + * @return $this + */ + public function disableTranslation(): static + { + $this->translationDomain = false; + + return $this; + } + /** * @return $this */ diff --git a/composer.json b/composer.json index 1ef7d5964..368373f53 100644 --- a/composer.json +++ b/composer.json @@ -38,6 +38,7 @@ "symfony/mime": "^6.4|^7.0", "symfony/property-access": "^6.4|^7.0", "symfony/property-info": "^6.4|^7.0", + "symfony/string": "^6.4|^7.0", "symfony/translation": "^6.4.3|^7.0.3", "symfony/type-info": "^7.1.8", "egulias/email-validator": "^2.1.10|^3|^4"