mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 23:08:46 +02:00
✅ Make unit tests working
This commit is contained in:
@@ -50,7 +50,7 @@ abstract class AbstractExtension implements FormExtensionInterface
|
||||
}
|
||||
|
||||
if (!isset($this->types[$name])) {
|
||||
throw new InvalidArgumentException(sprintf('The type "%s" cannot be loaded by this extension.', $name));
|
||||
throw new InvalidArgumentException(\sprintf('The type "%s" cannot be loaded by this extension.', $name));
|
||||
}
|
||||
|
||||
return $this->types[$name];
|
||||
|
||||
@@ -315,7 +315,7 @@ class Button implements \IteratorAggregate, FormInterface
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws Exception\AlreadySubmittedException if the button has already been submitted
|
||||
* @throws AlreadySubmittedException if the button has already been submitted
|
||||
*/
|
||||
public function submit(array|string|null $submittedData, bool $clearMissing = true): static
|
||||
{
|
||||
|
||||
@@ -114,7 +114,7 @@ class ArrayChoiceList implements ChoiceListInterface
|
||||
$choices = [];
|
||||
|
||||
foreach ($values as $i => $givenValue) {
|
||||
if (\array_key_exists($givenValue, $this->choices)) {
|
||||
if (\array_key_exists($givenValue ?? '', $this->choices)) {
|
||||
$choices[$i] = $this->choices[$givenValue];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ class DebugCommand extends Command
|
||||
new InputArgument('class', InputArgument::OPTIONAL, 'The form type class'),
|
||||
new InputArgument('option', InputArgument::OPTIONAL, 'The form type option'),
|
||||
new InputOption('show-deprecated', null, InputOption::VALUE_NONE, 'Display deprecated options in form types'),
|
||||
new InputOption('format', null, InputOption::VALUE_REQUIRED, sprintf('The output format ("%s")', implode('", "', $this->getAvailableFormatOptions())), 'txt'),
|
||||
new InputOption('format', null, InputOption::VALUE_REQUIRED, \sprintf('The output format ("%s")', implode('", "', $this->getAvailableFormatOptions())), 'txt'),
|
||||
])
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command displays information about form types.
|
||||
@@ -126,7 +126,7 @@ EOF
|
||||
$object = $resolvedType->getOptionsResolver();
|
||||
|
||||
if (!$object->isDefined($option)) {
|
||||
$message = sprintf('Option "%s" is not defined in "%s".', $option, $resolvedType->getInnerType()::class);
|
||||
$message = \sprintf('Option "%s" is not defined in "%s".', $option, $resolvedType->getInnerType()::class);
|
||||
|
||||
if ($alternatives = $this->findAlternatives($option, $object->getDefinedOptions())) {
|
||||
if (1 === \count($alternatives)) {
|
||||
@@ -160,7 +160,7 @@ EOF
|
||||
$classes = $this->getFqcnTypeClasses($shortClassName);
|
||||
|
||||
if (0 === $count = \count($classes)) {
|
||||
$message = sprintf("Could not find type \"%s\" into the following namespaces:\n %s", $shortClassName, implode("\n ", $this->namespaces));
|
||||
$message = \sprintf("Could not find type \"%s\" into the following namespaces:\n %s", $shortClassName, implode("\n ", $this->namespaces));
|
||||
|
||||
$allTypes = array_merge($this->getCoreTypes(), $this->types);
|
||||
if ($alternatives = $this->findAlternatives($shortClassName, $allTypes)) {
|
||||
@@ -178,10 +178,10 @@ EOF
|
||||
return $classes[0];
|
||||
}
|
||||
if (!$input->isInteractive()) {
|
||||
throw new InvalidArgumentException(sprintf("The type \"%s\" is ambiguous.\n\nDid you mean one of these?\n %s.", $shortClassName, implode("\n ", $classes)));
|
||||
throw new InvalidArgumentException(\sprintf("The type \"%s\" is ambiguous.\n\nDid you mean one of these?\n %s.", $shortClassName, implode("\n ", $classes)));
|
||||
}
|
||||
|
||||
return $io->choice(sprintf("The type \"%s\" is ambiguous.\n\nSelect one of the following form types to display its information:", $shortClassName), $classes, $classes[0]);
|
||||
return $io->choice(\sprintf("The type \"%s\" is ambiguous.\n\nSelect one of the following form types to display its information:", $shortClassName), $classes, $classes[0]);
|
||||
}
|
||||
|
||||
private function getFqcnTypeClasses(string $shortClassName): array
|
||||
|
||||
@@ -46,7 +46,7 @@ abstract class Descriptor implements DescriptorInterface
|
||||
null === $object => $this->describeDefaults($options),
|
||||
$object instanceof ResolvedFormTypeInterface => $this->describeResolvedFormType($object, $options),
|
||||
$object instanceof OptionsResolver => $this->describeOption($object, $options),
|
||||
default => throw new \InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_debug_type($object))),
|
||||
default => throw new \InvalidArgumentException(\sprintf('Object of type "%s" is not describable.', get_debug_type($object))),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ class TextDescriptor extends Descriptor
|
||||
'extension' => 'Extension options',
|
||||
], $formOptions);
|
||||
|
||||
$this->output->title(sprintf('%s (Block prefix: "%s")', $resolvedFormType->getInnerType()::class, $resolvedFormType->getInnerType()->getBlockPrefix()));
|
||||
$this->output->title(\sprintf('%s (Block prefix: "%s")', $resolvedFormType->getInnerType()::class, $resolvedFormType->getInnerType()->getBlockPrefix()));
|
||||
|
||||
if ($formOptions) {
|
||||
$this->output->table($tableHeaders, $this->buildTableRows($tableHeaders, $formOptions));
|
||||
@@ -134,7 +134,7 @@ class TextDescriptor extends Descriptor
|
||||
}
|
||||
array_pop($rows);
|
||||
|
||||
$this->output->title(sprintf('%s (%s)', $options['type']::class, $options['option']));
|
||||
$this->output->title(\sprintf('%s (%s)', $options['type']::class, $options['option']));
|
||||
$this->output->table([], $rows);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ class TextDescriptor extends Descriptor
|
||||
} else {
|
||||
$options[$group][] = null;
|
||||
}
|
||||
$options[$group][] = sprintf('<info>%s</info>', (new \ReflectionClass($class))->getShortName());
|
||||
$options[$group][] = \sprintf('<info>%s</info>', (new \ReflectionClass($class))->getShortName());
|
||||
$options[$group][] = new TableSeparator();
|
||||
|
||||
sort($opt);
|
||||
@@ -199,7 +199,7 @@ class TextDescriptor extends Descriptor
|
||||
return $text;
|
||||
}
|
||||
|
||||
return sprintf('<href=%s>%s</>', $fileLink, $text);
|
||||
return \sprintf('<href=%s>%s</>', $fileLink, $text);
|
||||
}
|
||||
|
||||
private function getFileLink(string $class): string
|
||||
|
||||
@@ -92,7 +92,7 @@ class FormPass implements CompilerPassInterface
|
||||
}
|
||||
|
||||
if (!$extendsTypes) {
|
||||
throw new InvalidArgumentException(sprintf('The getExtendedTypes() method for service "%s" does not return any extended types.', $serviceId));
|
||||
throw new InvalidArgumentException(\sprintf('The getExtendedTypes() method for service "%s" does not return any extended types.', $serviceId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,6 @@ class UnexpectedTypeException extends InvalidArgumentException
|
||||
{
|
||||
public function __construct(mixed $value, string $expectedType)
|
||||
{
|
||||
parent::__construct(sprintf('Expected argument of type "%s", "%s" given', $expectedType, get_debug_type($value)));
|
||||
parent::__construct(\sprintf('Expected argument of type "%s", "%s" given', $expectedType, get_debug_type($value)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class ArrayToPartsTransformer implements DataTransformerInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
throw new TransformationFailedException(sprintf('The keys "%s" should not be empty.', implode('", "', $emptyKeys)));
|
||||
throw new TransformationFailedException(\sprintf('The keys "%s" should not be empty.', implode('", "', $emptyKeys)));
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
@@ -48,13 +48,13 @@ abstract class BaseDateTimeTransformer implements DataTransformerInterface
|
||||
try {
|
||||
new \DateTimeZone($this->inputTimezone);
|
||||
} catch (\Exception $e) {
|
||||
throw new InvalidArgumentException(sprintf('Input timezone is invalid: "%s".', $this->inputTimezone), $e->getCode(), $e);
|
||||
throw new InvalidArgumentException(\sprintf('Input timezone is invalid: "%s".', $this->inputTimezone), $e->getCode(), $e);
|
||||
}
|
||||
|
||||
try {
|
||||
new \DateTimeZone($this->outputTimezone);
|
||||
} catch (\Exception $e) {
|
||||
throw new InvalidArgumentException(sprintf('Output timezone is invalid: "%s".', $this->outputTimezone), $e->getCode(), $e);
|
||||
throw new InvalidArgumentException(\sprintf('Output timezone is invalid: "%s".', $this->outputTimezone), $e->getCode(), $e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class ChoiceToValueTransformer implements DataTransformerInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
throw new TransformationFailedException(sprintf('The choice "%s" does not exist or is not unique.', $value));
|
||||
throw new TransformationFailedException(\sprintf('The choice "%s" does not exist or is not unique.', $value));
|
||||
}
|
||||
|
||||
return current($choices);
|
||||
|
||||
@@ -124,19 +124,19 @@ class DateIntervalToArrayTransformer implements DataTransformerInterface
|
||||
}
|
||||
}
|
||||
if (\count($emptyFields) > 0) {
|
||||
throw new TransformationFailedException(sprintf('The fields "%s" should not be empty.', implode('", "', $emptyFields)));
|
||||
throw new TransformationFailedException(\sprintf('The fields "%s" should not be empty.', implode('", "', $emptyFields)));
|
||||
}
|
||||
if (isset($value['invert']) && !\is_bool($value['invert'])) {
|
||||
throw new TransformationFailedException('The value of "invert" must be boolean.');
|
||||
}
|
||||
foreach (self::AVAILABLE_FIELDS as $field => $char) {
|
||||
if ('invert' !== $field && isset($value[$field]) && !ctype_digit((string) $value[$field])) {
|
||||
throw new TransformationFailedException(sprintf('This amount of "%s" is invalid.', $field));
|
||||
throw new TransformationFailedException(\sprintf('This amount of "%s" is invalid.', $field));
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (!empty($value['weeks'])) {
|
||||
$interval = sprintf(
|
||||
$interval = \sprintf(
|
||||
'P%sY%sM%sWT%sH%sM%sS',
|
||||
empty($value['years']) ? '0' : $value['years'],
|
||||
empty($value['months']) ? '0' : $value['months'],
|
||||
@@ -146,7 +146,7 @@ class DateIntervalToArrayTransformer implements DataTransformerInterface
|
||||
empty($value['seconds']) ? '0' : $value['seconds']
|
||||
);
|
||||
} else {
|
||||
$interval = sprintf(
|
||||
$interval = \sprintf(
|
||||
'P%sY%sM%sDT%sH%sM%sS',
|
||||
empty($value['years']) ? '0' : $value['years'],
|
||||
empty($value['months']) ? '0' : $value['months'],
|
||||
|
||||
@@ -81,7 +81,7 @@ class DateIntervalToStringTransformer implements DataTransformerInterface
|
||||
}
|
||||
$valuePattern = '/^'.preg_replace('/%([yYmMdDhHiIsSwW])(\w)/', '(?P<$1>\d+)$2', $this->format).'$/';
|
||||
if (!preg_match($valuePattern, $value)) {
|
||||
throw new TransformationFailedException(sprintf('Value "%s" contains intervals not accepted by format "%s".', $value, $this->format));
|
||||
throw new TransformationFailedException(\sprintf('Value "%s" contains intervals not accepted by format "%s".', $value, $this->format));
|
||||
}
|
||||
try {
|
||||
$dateInterval = new \DateInterval($value);
|
||||
|
||||
@@ -123,7 +123,7 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer
|
||||
}
|
||||
|
||||
if (\count($emptyFields) > 0) {
|
||||
throw new TransformationFailedException(sprintf('The fields "%s" should not be empty.', implode('", "', $emptyFields)));
|
||||
throw new TransformationFailedException(\sprintf('The fields "%s" should not be empty.', implode('", "', $emptyFields)));
|
||||
}
|
||||
|
||||
if (isset($value['month']) && !ctype_digit((string) $value['month'])) {
|
||||
@@ -155,7 +155,7 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer
|
||||
}
|
||||
|
||||
try {
|
||||
$dateTime = new \DateTime(sprintf(
|
||||
$dateTime = new \DateTime(\sprintf(
|
||||
'%s-%s-%s %s:%s:%s',
|
||||
empty($value['year']) ? $this->referenceDate->format('Y') : $value['year'],
|
||||
empty($value['month']) ? $this->referenceDate->format('m') : $value['month'],
|
||||
|
||||
@@ -85,7 +85,7 @@ class DateTimeToHtml5LocalDateTimeTransformer extends BaseDateTimeTransformer
|
||||
// to maintain backwards compatibility we do not strictly validate the submitted date
|
||||
// see https://github.com/symfony/symfony/issues/28699
|
||||
if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})[T ]\d{2}:\d{2}(?::\d{2})?/', $dateTimeLocal, $matches)) {
|
||||
throw new TransformationFailedException(sprintf('The date "%s" is not a valid date.', $dateTimeLocal));
|
||||
throw new TransformationFailedException(\sprintf('The date "%s" is not a valid date.', $dateTimeLocal));
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -99,7 +99,7 @@ class DateTimeToHtml5LocalDateTimeTransformer extends BaseDateTimeTransformer
|
||||
}
|
||||
|
||||
if (!checkdate($matches[2], $matches[3], $matches[1])) {
|
||||
throw new TransformationFailedException(sprintf('The date "%s-%s-%s" is not a valid date.', $matches[1], $matches[2], $matches[3]));
|
||||
throw new TransformationFailedException(\sprintf('The date "%s-%s-%s" is not a valid date.', $matches[1], $matches[2], $matches[3]));
|
||||
}
|
||||
|
||||
return $dateTime;
|
||||
|
||||
@@ -126,7 +126,7 @@ class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer
|
||||
} elseif (false === $timestamp) {
|
||||
// the value couldn't be parsed but the Intl extension didn't report an error code, this
|
||||
// could be the case when the Intl polyfill is used which always returns 0 as the error code
|
||||
throw new TransformationFailedException(sprintf('"%s" could not be parsed as a date.', $value));
|
||||
throw new TransformationFailedException(\sprintf('"%s" could not be parsed as a date.', $value));
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -135,7 +135,7 @@ class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer
|
||||
$dateTime = new \DateTime(gmdate('Y-m-d', $timestamp), new \DateTimeZone($this->outputTimezone));
|
||||
} else {
|
||||
// read timestamp into DateTime object - the formatter delivers a timestamp
|
||||
$dateTime = new \DateTime(sprintf('@%s', $timestamp));
|
||||
$dateTime = new \DateTime(\sprintf('@%s', $timestamp));
|
||||
}
|
||||
// set timezone separately, as it would be ignored if set via the constructor,
|
||||
// see https://php.net/datetime.construct
|
||||
|
||||
@@ -64,7 +64,7 @@ class DateTimeToRfc3339Transformer extends BaseDateTimeTransformer
|
||||
}
|
||||
|
||||
if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))$/', $rfc3339, $matches)) {
|
||||
throw new TransformationFailedException(sprintf('The date "%s" is not a valid date.', $rfc3339));
|
||||
throw new TransformationFailedException(\sprintf('The date "%s" is not a valid date.', $rfc3339));
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -78,7 +78,7 @@ class DateTimeToRfc3339Transformer extends BaseDateTimeTransformer
|
||||
}
|
||||
|
||||
if (!checkdate($matches[2], $matches[3], $matches[1])) {
|
||||
throw new TransformationFailedException(sprintf('The date "%s-%s-%s" is not a valid date.', $matches[1], $matches[2], $matches[3]));
|
||||
throw new TransformationFailedException(\sprintf('The date "%s-%s-%s" is not a valid date.', $matches[1], $matches[2], $matches[3]));
|
||||
}
|
||||
|
||||
return $dateTime;
|
||||
|
||||
@@ -38,7 +38,7 @@ class IntegerToLocalizedStringTransformer extends NumberToLocalizedStringTransfo
|
||||
$decimalSeparator = $this->getNumberFormatter()->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL);
|
||||
|
||||
if (\is_string($value) && str_contains($value, $decimalSeparator)) {
|
||||
throw new TransformationFailedException(sprintf('The value "%s" is not a valid integer.', $value));
|
||||
throw new TransformationFailedException(\sprintf('The value "%s" is not a valid integer.', $value));
|
||||
}
|
||||
|
||||
$result = parent::reverseTransform($value);
|
||||
|
||||
@@ -72,7 +72,7 @@ class IntlTimeZoneToStringTransformer implements DataTransformerInterface
|
||||
$intlTimeZone = \IntlTimeZone::createTimeZone($value);
|
||||
|
||||
if ('Etc/Unknown' === $intlTimeZone->getID()) {
|
||||
throw new TransformationFailedException(sprintf('Unknown timezone identifier "%s".', $value));
|
||||
throw new TransformationFailedException(\sprintf('Unknown timezone identifier "%s".', $value));
|
||||
}
|
||||
|
||||
return $intlTimeZone;
|
||||
|
||||
@@ -33,14 +33,14 @@ class MoneyToLocalizedStringTransformer extends NumberToLocalizedStringTransform
|
||||
/**
|
||||
* Transforms a normalized format into a localized money string.
|
||||
*
|
||||
* @param int|float|null $value Normalized number
|
||||
* @param int|float|string|null $value Normalized number
|
||||
*
|
||||
* @throws TransformationFailedException if the given value is not numeric or
|
||||
* if the value cannot be transformed
|
||||
*/
|
||||
public function transform(mixed $value): string
|
||||
{
|
||||
if (null !== $value && 1 !== $this->divisor) {
|
||||
if (null !== $value && '' !== $value && 1 !== $this->divisor) {
|
||||
if (!is_numeric($value)) {
|
||||
throw new TransformationFailedException('Expected a numeric.');
|
||||
}
|
||||
|
||||
@@ -43,14 +43,14 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface
|
||||
/**
|
||||
* Transforms a number type into localized number.
|
||||
*
|
||||
* @param int|float|null $value Number value
|
||||
* @param int|float|string|null $value Number value
|
||||
*
|
||||
* @throws TransformationFailedException if the given value is not numeric
|
||||
* or if the value cannot be transformed
|
||||
*/
|
||||
public function transform(mixed $value): string
|
||||
{
|
||||
if (null === $value) {
|
||||
if (null === $value || '' === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface
|
||||
$remainder = trim($remainder, " \t\n\r\0\x0b\xc2\xa0");
|
||||
|
||||
if ('' !== $remainder) {
|
||||
throw new TransformationFailedException(sprintf('The number contains unrecognized characters: "%s".', $remainder));
|
||||
throw new TransformationFailedException(\sprintf('The number contains unrecognized characters: "%s".', $remainder));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,6 +189,10 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface
|
||||
*/
|
||||
private function round(int|float $number): int|float
|
||||
{
|
||||
if (\is_int($number)) {
|
||||
return $number;
|
||||
}
|
||||
|
||||
if (null !== $this->scale && null !== $this->roundingMode) {
|
||||
// shift number to maintain the correct scale during rounding
|
||||
$roundingCoef = 10 ** $this->scale;
|
||||
|
||||
@@ -162,7 +162,7 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface
|
||||
$remainder = trim($remainder, " \t\n\r\0\x0b\xc2\xa0");
|
||||
|
||||
if ('' !== $remainder) {
|
||||
throw new TransformationFailedException(sprintf('The number contains unrecognized characters: "%s".', $remainder));
|
||||
throw new TransformationFailedException(\sprintf('The number contains unrecognized characters: "%s".', $remainder));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class UlidToStringTransformer implements DataTransformerInterface
|
||||
try {
|
||||
$ulid = new Ulid($value);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
throw new TransformationFailedException(sprintf('The value "%s" is not a valid ULID.', $value), $e->getCode(), $e);
|
||||
throw new TransformationFailedException(\sprintf('The value "%s" is not a valid ULID.', $value), $e->getCode(), $e);
|
||||
}
|
||||
|
||||
return $ulid;
|
||||
|
||||
@@ -63,13 +63,13 @@ class UuidToStringTransformer implements DataTransformerInterface
|
||||
}
|
||||
|
||||
if (!Uuid::isValid($value)) {
|
||||
throw new TransformationFailedException(sprintf('The value "%s" is not a valid UUID.', $value));
|
||||
throw new TransformationFailedException(\sprintf('The value "%s" is not a valid UUID.', $value));
|
||||
}
|
||||
|
||||
try {
|
||||
return Uuid::fromString($value);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
throw new TransformationFailedException(sprintf('The value "%s" is not a valid UUID.', $value), $e->getCode(), $e);
|
||||
throw new TransformationFailedException(\sprintf('The value "%s" is not a valid UUID.', $value), $e->getCode(), $e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class ValueToDuplicatesTransformer implements DataTransformerInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
throw new TransformationFailedException(sprintf('The keys "%s" should not be empty.', implode('", "', $emptyKeys)));
|
||||
throw new TransformationFailedException(\sprintf('The keys "%s" should not be empty.', implode('", "', $emptyKeys)));
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
@@ -40,7 +40,7 @@ class WeekToArrayTransformer implements DataTransformerInterface
|
||||
}
|
||||
|
||||
if (!\is_string($value)) {
|
||||
throw new TransformationFailedException(sprintf('Value is expected to be a string but was "%s".', get_debug_type($value)));
|
||||
throw new TransformationFailedException(\sprintf('Value is expected to be a string but was "%s".', get_debug_type($value)));
|
||||
}
|
||||
|
||||
if (0 === preg_match('/^(?P<year>\d{4})-W(?P<week>\d{2})$/', $value, $matches)) {
|
||||
@@ -70,7 +70,7 @@ class WeekToArrayTransformer implements DataTransformerInterface
|
||||
}
|
||||
|
||||
if (!\is_array($value)) {
|
||||
throw new TransformationFailedException(sprintf('Value is expected to be an array, but was "%s".', get_debug_type($value)));
|
||||
throw new TransformationFailedException(\sprintf('Value is expected to be an array, but was "%s".', get_debug_type($value)));
|
||||
}
|
||||
|
||||
if (!\array_key_exists('year', $value)) {
|
||||
@@ -82,7 +82,7 @@ class WeekToArrayTransformer implements DataTransformerInterface
|
||||
}
|
||||
|
||||
if ($additionalKeys = array_diff(array_keys($value), ['year', 'week'])) {
|
||||
throw new TransformationFailedException(sprintf('Expected only keys "year" and "week" to be present, but also got ["%s"].', implode('", "', $additionalKeys)));
|
||||
throw new TransformationFailedException(\sprintf('Expected only keys "year" and "week" to be present, but also got ["%s"].', implode('", "', $additionalKeys)));
|
||||
}
|
||||
|
||||
if (null === $value['year'] && null === $value['week']) {
|
||||
@@ -90,18 +90,18 @@ class WeekToArrayTransformer implements DataTransformerInterface
|
||||
}
|
||||
|
||||
if (!\is_int($value['year'])) {
|
||||
throw new TransformationFailedException(sprintf('Year is expected to be an integer, but was "%s".', get_debug_type($value['year'])));
|
||||
throw new TransformationFailedException(\sprintf('Year is expected to be an integer, but was "%s".', get_debug_type($value['year'])));
|
||||
}
|
||||
|
||||
if (!\is_int($value['week'])) {
|
||||
throw new TransformationFailedException(sprintf('Week is expected to be an integer, but was "%s".', get_debug_type($value['week'])));
|
||||
throw new TransformationFailedException(\sprintf('Week is expected to be an integer, but was "%s".', get_debug_type($value['week'])));
|
||||
}
|
||||
|
||||
// The 28th December is always in the last week of the year
|
||||
if (date('W', strtotime('28th December '.$value['year'])) < $value['week']) {
|
||||
throw new TransformationFailedException(sprintf('Week "%d" does not exist for year "%d".', $value['week'], $value['year']));
|
||||
throw new TransformationFailedException(\sprintf('Week "%d" does not exist for year "%d".', $value['week'], $value['year']));
|
||||
}
|
||||
|
||||
return sprintf('%d-W%02d', $value['year'], $value['week']);
|
||||
return \sprintf('%d-W%02d', $value['year'], $value['week']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,9 +52,9 @@ abstract class BaseType extends AbstractType
|
||||
|
||||
if ($view->parent) {
|
||||
if ('' !== ($parentFullName = $view->parent->vars['full_name'])) {
|
||||
$id = sprintf('%s_%s', $view->parent->vars['id'], $name);
|
||||
$fullName = sprintf('%s[%s]', $parentFullName, $name);
|
||||
$uniqueBlockPrefix = sprintf('%s_%s', $view->parent->vars['unique_block_prefix'], $blockName);
|
||||
$id = \sprintf('%s_%s', $view->parent->vars['id'], $name);
|
||||
$fullName = \sprintf('%s[%s]', $parentFullName, $name);
|
||||
$uniqueBlockPrefix = \sprintf('%s_%s', $view->parent->vars['unique_block_prefix'], $blockName);
|
||||
} else {
|
||||
$id = $name;
|
||||
$fullName = $name;
|
||||
|
||||
@@ -161,7 +161,7 @@ class ChoiceType extends AbstractType
|
||||
|
||||
// Throw exception if unknown values were submitted (multiple choices will be handled in a different event listener below)
|
||||
if (\count($unknownValues) > 0 && !$options['multiple']) {
|
||||
throw new TransformationFailedException(sprintf('The choices "%s" do not exist in the choice list.', implode('", "', array_keys($unknownValues))));
|
||||
throw new TransformationFailedException(\sprintf('The choices "%s" do not exist in the choice list.', implode('", "', array_keys($unknownValues))));
|
||||
}
|
||||
|
||||
$event->setData($knownValues);
|
||||
@@ -185,7 +185,7 @@ class ChoiceType extends AbstractType
|
||||
$message = strtr($messageTemplate, ['{{ value }}' => $clientDataAsString]);
|
||||
}
|
||||
|
||||
$form->addError(new FormError($message, $messageTemplate, ['{{ value }}' => $clientDataAsString], null, new TransformationFailedException(sprintf('The choices "%s" do not exist in the choice list.', $clientDataAsString))));
|
||||
$form->addError(new FormError($message, $messageTemplate, ['{{ value }}' => $clientDataAsString], null, new TransformationFailedException(\sprintf('The choices "%s" do not exist in the choice list.', $clientDataAsString))));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class CountryType extends AbstractType
|
||||
$resolver->setDefaults([
|
||||
'choice_loader' => function (Options $options) {
|
||||
if (!class_exists(Intl::class)) {
|
||||
throw new LogicException(sprintf('The "symfony/intl" component is required to use "%s". Try running "composer require symfony/intl".', static::class));
|
||||
throw new LogicException(\sprintf('The "symfony/intl" component is required to use "%s". Try running "composer require symfony/intl".', static::class));
|
||||
}
|
||||
|
||||
$choiceTranslationLocale = $options['choice_translation_locale'];
|
||||
|
||||
@@ -30,7 +30,7 @@ class CurrencyType extends AbstractType
|
||||
$resolver->setDefaults([
|
||||
'choice_loader' => function (Options $options) {
|
||||
if (!class_exists(Intl::class)) {
|
||||
throw new LogicException(sprintf('The "symfony/intl" component is required to use "%s". Try running "composer require symfony/intl".', static::class));
|
||||
throw new LogicException(\sprintf('The "symfony/intl" component is required to use "%s". Try running "composer require symfony/intl".', static::class));
|
||||
}
|
||||
|
||||
$choiceTranslationLocale = $options['choice_translation_locale'];
|
||||
|
||||
@@ -206,7 +206,7 @@ class DateTimeType extends AbstractType
|
||||
}
|
||||
|
||||
if ($date->getTimezone()->getName() !== $options['model_timezone']) {
|
||||
trigger_deprecation('symfony/form', '6.4', sprintf('Using a "%s" instance with a timezone ("%s") not matching the configured model timezone "%s" is deprecated.', $date::class, $date->getTimezone()->getName(), $options['model_timezone']));
|
||||
trigger_deprecation('symfony/form', '6.4', \sprintf('Using a "%s" instance with a timezone ("%s") not matching the configured model timezone "%s" is deprecated.', $date::class, $date->getTimezone()->getName(), $options['model_timezone']));
|
||||
// throw new LogicException(sprintf('Using a "%s" instance with a timezone ("%s") not matching the configured model timezone "%s" is not supported.', $date::class, $date->getTimezone()->getName(), $options['model_timezone']));
|
||||
}
|
||||
});
|
||||
@@ -321,7 +321,7 @@ class DateTimeType extends AbstractType
|
||||
|
||||
$resolver->setNormalizer('date_format', static function (Options $options, $dateFormat) {
|
||||
if (null !== $dateFormat && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) {
|
||||
throw new LogicException(sprintf('Cannot use the "date_format" option of the "%s" with an HTML5 date.', self::class));
|
||||
throw new LogicException(\sprintf('Cannot use the "date_format" option of the "%s" with an HTML5 date.', self::class));
|
||||
}
|
||||
|
||||
return $dateFormat;
|
||||
@@ -329,10 +329,10 @@ class DateTimeType extends AbstractType
|
||||
$resolver->setNormalizer('widget', static function (Options $options, $widget) {
|
||||
if ('single_text' === $widget) {
|
||||
if (null !== $options['date_widget']) {
|
||||
throw new LogicException(sprintf('Cannot use the "date_widget" option of the "%s" when the "widget" option is set to "single_text".', self::class));
|
||||
throw new LogicException(\sprintf('Cannot use the "date_widget" option of the "%s" when the "widget" option is set to "single_text".', self::class));
|
||||
}
|
||||
if (null !== $options['time_widget']) {
|
||||
throw new LogicException(sprintf('Cannot use the "time_widget" option of the "%s" when the "widget" option is set to "single_text".', self::class));
|
||||
throw new LogicException(\sprintf('Cannot use the "time_widget" option of the "%s" when the "widget" option is set to "single_text".', self::class));
|
||||
}
|
||||
} elseif (null === $widget && null === $options['date_widget'] && null === $options['time_widget']) {
|
||||
trigger_deprecation('symfony/form', '6.3', 'Not configuring the "widget" option of form type "datetime" is deprecated. It will default to "single_text" in Symfony 7.0.');
|
||||
@@ -343,7 +343,7 @@ class DateTimeType extends AbstractType
|
||||
});
|
||||
$resolver->setNormalizer('html5', static function (Options $options, $html5) {
|
||||
if ($html5 && self::HTML5_FORMAT !== $options['format']) {
|
||||
throw new LogicException(sprintf('Cannot use the "format" option of "%s" when the "html5" option is enabled.', self::class));
|
||||
throw new LogicException(\sprintf('Cannot use the "format" option of "%s" when the "html5" option is enabled.', self::class));
|
||||
}
|
||||
|
||||
return $html5;
|
||||
|
||||
@@ -61,7 +61,7 @@ class DateType extends AbstractType
|
||||
|
||||
if ('single_text' === $options['widget']) {
|
||||
if ('' !== $pattern && !str_contains($pattern, 'y') && !str_contains($pattern, 'M') && !str_contains($pattern, 'd')) {
|
||||
throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" or "d". Its current value is "%s".', $pattern));
|
||||
throw new InvalidOptionsException(\sprintf('The "format" option should contain the letters "y", "M" or "d". Its current value is "%s".', $pattern));
|
||||
}
|
||||
|
||||
$builder->addViewTransformer(new DateTimeToLocalizedStringTransformer(
|
||||
@@ -74,7 +74,7 @@ class DateType extends AbstractType
|
||||
));
|
||||
} else {
|
||||
if ('' !== $pattern && (!str_contains($pattern, 'y') || !str_contains($pattern, 'M') || !str_contains($pattern, 'd'))) {
|
||||
throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" and "d". Its current value is "%s".', $pattern));
|
||||
throw new InvalidOptionsException(\sprintf('The "format" option should contain the letters "y", "M" and "d". Its current value is "%s".', $pattern));
|
||||
}
|
||||
|
||||
$yearOptions = $monthOptions = $dayOptions = [
|
||||
@@ -190,7 +190,7 @@ class DateType extends AbstractType
|
||||
}
|
||||
|
||||
if ($date->getTimezone()->getName() !== $options['model_timezone']) {
|
||||
trigger_deprecation('symfony/form', '6.4', sprintf('Using a "%s" instance with a timezone ("%s") not matching the configured model timezone "%s" is deprecated.', $date::class, $date->getTimezone()->getName(), $options['model_timezone']));
|
||||
trigger_deprecation('symfony/form', '6.4', \sprintf('Using a "%s" instance with a timezone ("%s") not matching the configured model timezone "%s" is deprecated.', $date::class, $date->getTimezone()->getName(), $options['model_timezone']));
|
||||
// throw new LogicException(sprintf('Using a "%s" instance with a timezone ("%s") not matching the configured model timezone "%s" is not supported.', $date::class, $date->getTimezone()->getName(), $options['model_timezone']));
|
||||
}
|
||||
});
|
||||
@@ -337,7 +337,7 @@ class DateType extends AbstractType
|
||||
|
||||
$resolver->setNormalizer('html5', static function (Options $options, $html5) {
|
||||
if ($html5 && 'single_text' === $options['widget'] && self::HTML5_FORMAT !== $options['format']) {
|
||||
throw new LogicException(sprintf('Cannot use the "format" option of "%s" when the "html5" option is enabled.', self::class));
|
||||
throw new LogicException(\sprintf('Cannot use the "format" option of "%s" when the "html5" option is enabled.', self::class));
|
||||
}
|
||||
|
||||
return $html5;
|
||||
|
||||
@@ -31,7 +31,7 @@ class LanguageType extends AbstractType
|
||||
$resolver->setDefaults([
|
||||
'choice_loader' => function (Options $options) {
|
||||
if (!class_exists(Intl::class)) {
|
||||
throw new LogicException(sprintf('The "symfony/intl" component is required to use "%s". Try running "composer require symfony/intl".', static::class));
|
||||
throw new LogicException(\sprintf('The "symfony/intl" component is required to use "%s". Try running "composer require symfony/intl".', static::class));
|
||||
}
|
||||
$choiceTranslationLocale = $options['choice_translation_locale'];
|
||||
$useAlpha3Codes = $options['alpha3'];
|
||||
|
||||
@@ -30,7 +30,7 @@ class LocaleType extends AbstractType
|
||||
$resolver->setDefaults([
|
||||
'choice_loader' => function (Options $options) {
|
||||
if (!class_exists(Intl::class)) {
|
||||
throw new LogicException(sprintf('The "symfony/intl" component is required to use "%s". Try running "composer require symfony/intl".', static::class));
|
||||
throw new LogicException(\sprintf('The "symfony/intl" component is required to use "%s". Try running "composer require symfony/intl".', static::class));
|
||||
}
|
||||
|
||||
$choiceTranslationLocale = $options['choice_translation_locale'];
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
namespace Symfony\Component\Form\Extension\Core\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Event\PreSubmitEvent;
|
||||
use Symfony\Component\Form\Exception\InvalidConfigurationException;
|
||||
use Symfony\Component\Form\Exception\LogicException;
|
||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeImmutableToDateTimeTransformer;
|
||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
|
||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
|
||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
|
||||
use Symfony\Component\Form\Event\PreSubmitEvent;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
@@ -48,7 +48,7 @@ class TimeType extends AbstractType
|
||||
}
|
||||
|
||||
if (null !== $options['reference_date'] && $options['reference_date']->getTimezone()->getName() !== $options['model_timezone']) {
|
||||
throw new InvalidConfigurationException(sprintf('The configured "model_timezone" (%s) must match the timezone of the "reference_date" (%s).', $options['model_timezone'], $options['reference_date']->getTimezone()->getName()));
|
||||
throw new InvalidConfigurationException(\sprintf('The configured "model_timezone" (%s) must match the timezone of the "reference_date" (%s).', $options['model_timezone'], $options['reference_date']->getTimezone()->getName()));
|
||||
}
|
||||
|
||||
if ($options['with_minutes']) {
|
||||
@@ -69,9 +69,9 @@ class TimeType extends AbstractType
|
||||
if ($options['with_seconds']) {
|
||||
// handle seconds ignored by user's browser when with_seconds enabled
|
||||
// https://codereview.chromium.org/450533009/
|
||||
$e->setData(sprintf('%s:%s:%s', $matches['hours'], $matches['minutes'], $matches['seconds'] ?? '00'));
|
||||
$e->setData(\sprintf('%s:%s:%s', $matches['hours'], $matches['minutes'], $matches['seconds'] ?? '00'));
|
||||
} else {
|
||||
$e->setData(sprintf('%s:%s', $matches['hours'], $matches['minutes']));
|
||||
$e->setData(\sprintf('%s:%s', $matches['hours'], $matches['minutes']));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -220,7 +220,7 @@ class TimeType extends AbstractType
|
||||
}
|
||||
|
||||
if ($date->getTimezone()->getName() !== $options['model_timezone']) {
|
||||
trigger_deprecation('symfony/form', '6.4', sprintf('Using a "%s" instance with a timezone ("%s") not matching the configured model timezone "%s" is deprecated.', $date::class, $date->getTimezone()->getName(), $options['model_timezone']));
|
||||
trigger_deprecation('symfony/form', '6.4', \sprintf('Using a "%s" instance with a timezone ("%s") not matching the configured model timezone "%s" is deprecated.', $date::class, $date->getTimezone()->getName(), $options['model_timezone']));
|
||||
// throw new LogicException(sprintf('Using a "%s" instance with a timezone ("%s") not matching the configured model timezone "%s" is not supported.', $date::class, $date->getTimezone()->getName(), $options['model_timezone']));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -49,7 +49,7 @@ class TimezoneType extends AbstractType
|
||||
|
||||
if ($options['intl']) {
|
||||
if (!class_exists(Intl::class)) {
|
||||
throw new LogicException(sprintf('The "symfony/intl" component is required to use "%s" with option "intl=true". Try running "composer require symfony/intl".', static::class));
|
||||
throw new LogicException(\sprintf('The "symfony/intl" component is required to use "%s" with option "intl=true". Try running "composer require symfony/intl".', static::class));
|
||||
}
|
||||
|
||||
$choiceTranslationLocale = $options['choice_translation_locale'];
|
||||
|
||||
@@ -42,7 +42,6 @@ class WeekType extends AbstractType
|
||||
} else {
|
||||
$yearOptions = $weekOptions = [
|
||||
'error_bubbling' => true,
|
||||
'empty_data' => '',
|
||||
];
|
||||
// when the form is compound the entries of the array are ignored in favor of children data
|
||||
// so we need to handle the cascade setting here
|
||||
@@ -154,7 +153,7 @@ class WeekType extends AbstractType
|
||||
$resolver->setNormalizer('choice_translation_domain', $choiceTranslationDomainNormalizer);
|
||||
$resolver->setNormalizer('html5', static function (Options $options, $html5) {
|
||||
if ($html5 && 'single_text' !== $options['widget']) {
|
||||
throw new LogicException(sprintf('The "widget" option of "%s" must be set to "single_text" when the "html5" option is enabled.', self::class));
|
||||
throw new LogicException(\sprintf('The "widget" option of "%s" must be set to "single_text" when the "html5" option is enabled.', self::class));
|
||||
}
|
||||
|
||||
return $html5;
|
||||
|
||||
@@ -65,7 +65,7 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
|
||||
public function __construct(FormDataExtractorInterface $dataExtractor)
|
||||
{
|
||||
if (!class_exists(ClassStub::class)) {
|
||||
throw new \LogicException(sprintf('The VarDumper component is needed for using the "%s" class. Install symfony/var-dumper version 3.4 or above.', __CLASS__));
|
||||
throw new \LogicException(\sprintf('The VarDumper component is needed for using the "%s" class. Install symfony/var-dumper version 3.4 or above.', __CLASS__));
|
||||
}
|
||||
|
||||
$this->dataExtractor = $dataExtractor;
|
||||
@@ -200,10 +200,7 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __sleep(): array
|
||||
public function __serialize(): array
|
||||
{
|
||||
foreach ($this->data['forms_by_hash'] as &$form) {
|
||||
if (isset($form['type_class']) && !$form['type_class'] instanceof ClassStub) {
|
||||
@@ -211,9 +208,7 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
|
||||
}
|
||||
}
|
||||
|
||||
$this->data = $this->cloneVar($this->data);
|
||||
|
||||
return parent::__sleep();
|
||||
return ['data' => $this->data = $this->cloneVar($this->data)];
|
||||
}
|
||||
|
||||
protected function getCasters(): array
|
||||
|
||||
@@ -40,7 +40,7 @@ class DependencyInjectionExtension implements FormExtensionInterface
|
||||
public function getType(string $name): FormTypeInterface
|
||||
{
|
||||
if (!$this->typeContainer->has($name)) {
|
||||
throw new InvalidArgumentException(sprintf('The field type "%s" is not registered in the service container.', $name));
|
||||
throw new InvalidArgumentException(\sprintf('The field type "%s" is not registered in the service container.', $name));
|
||||
}
|
||||
|
||||
return $this->typeContainer->get($name);
|
||||
@@ -66,7 +66,7 @@ class DependencyInjectionExtension implements FormExtensionInterface
|
||||
|
||||
// validate the result of getExtendedTypes() to ensure it is consistent with the service definition
|
||||
if (!\in_array($name, $extendedTypes, true)) {
|
||||
throw new InvalidArgumentException(sprintf('The extended type "%s" specified for the type extension class "%s" does not match any of the actual extended types (["%s"]).', $name, $extension::class, implode('", "', $extendedTypes)));
|
||||
throw new InvalidArgumentException(\sprintf('The extended type "%s" specified for the type extension class "%s" does not match any of the actual extended types (["%s"]).', $name, $extension::class, implode('", "', $extendedTypes)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ class PasswordHasherListener
|
||||
$parent = $this->getTargetForm($form)->getParent();
|
||||
|
||||
if (!($user = $parent?->getData()) || !$user instanceof PasswordAuthenticatedUserInterface) {
|
||||
throw new InvalidConfigurationException(sprintf('The "hash_property_path" option only supports "%s" objects, "%s" given.', PasswordAuthenticatedUserInterface::class, get_debug_type($user)));
|
||||
throw new InvalidConfigurationException(\sprintf('The "hash_property_path" option only supports "%s" objects, "%s" given.', PasswordAuthenticatedUserInterface::class, get_debug_type($user)));
|
||||
}
|
||||
|
||||
return $user;
|
||||
|
||||
@@ -42,7 +42,7 @@ class FormValidator extends ConstraintValidator
|
||||
return;
|
||||
}
|
||||
|
||||
/* @var FormInterface $form */
|
||||
/** @var FormInterface $form */
|
||||
$config = $form->getConfig();
|
||||
|
||||
$validator = $this->context->getValidator()->inContext($this->context);
|
||||
@@ -95,7 +95,7 @@ class FormValidator extends ConstraintValidator
|
||||
$fieldFormConstraint = new Form();
|
||||
$fieldFormConstraint->groups = $group;
|
||||
$this->context->setNode($this->context->getValue(), $field, $this->context->getMetadata(), $this->context->getPropertyPath());
|
||||
$validator->atPath(sprintf('children[%s]', $field->getName()))->validate($field, $fieldFormConstraint, $group);
|
||||
$validator->atPath(\sprintf('children[%s]', $field->getName()))->validate($field, $fieldFormConstraint, $group);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ class FormValidator extends ConstraintValidator
|
||||
if ($field->isSubmitted()) {
|
||||
$this->resolvedGroups[$field] = $groups;
|
||||
$this->context->setNode($this->context->getValue(), $field, $this->context->getMetadata(), $this->context->getPropertyPath());
|
||||
$validator->atPath(sprintf('children[%s]', $field->getName()))->validate($field, $formConstraint);
|
||||
$validator->atPath(\sprintf('children[%s]', $field->getName()))->validate($field, $formConstraint);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -159,7 +159,7 @@ class FormValidator extends ConstraintValidator
|
||||
if (!$child->isSynchronized()) {
|
||||
$childrenSynchronized = false;
|
||||
$this->context->setNode($this->context->getValue(), $child, $this->context->getMetadata(), $this->context->getPropertyPath());
|
||||
$validator->atPath(sprintf('children[%s]', $child->getName()))->validate($child, $formConstraint);
|
||||
$validator->atPath(\sprintf('children[%s]', $child->getName()))->validate($child, $formConstraint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ class ValidatorExtension extends AbstractExtension
|
||||
{
|
||||
$this->legacyErrorMessages = $legacyErrorMessages;
|
||||
|
||||
/** @var ClassMetadata $metadata */
|
||||
$metadata = $validator->getMetadataFor(\Symfony\Component\Form\Form::class);
|
||||
|
||||
// Register the form constraints in the validator programmatically.
|
||||
@@ -43,7 +44,6 @@ class ValidatorExtension extends AbstractExtension
|
||||
// the DIC, where the XML file is loaded automatically. Thus the following
|
||||
// code must be kept synchronized with validation.xml
|
||||
|
||||
/* @var $metadata ClassMetadata */
|
||||
$metadata->addConstraint(new Form());
|
||||
$metadata->addConstraint(new Traverse(false));
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
||||
switch ($constraint::class) {
|
||||
case Length::class:
|
||||
if (is_numeric($constraint->min)) {
|
||||
return new ValueGuess(sprintf('.{%s,}', (string) $constraint->min), Guess::LOW_CONFIDENCE);
|
||||
return new ValueGuess(\sprintf('.{%s,}', (string) $constraint->min), Guess::LOW_CONFIDENCE);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -246,7 +246,7 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
||||
|
||||
case Range::class:
|
||||
if (is_numeric($constraint->min)) {
|
||||
return new ValueGuess(sprintf('.{%s,}', \strlen((string) $constraint->min)), Guess::LOW_CONFIDENCE);
|
||||
return new ValueGuess(\sprintf('.{%s,}', \strlen((string) $constraint->min)), Guess::LOW_CONFIDENCE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class MappingRule
|
||||
|
||||
foreach ($childNames as $childName) {
|
||||
if (!$target->has($childName)) {
|
||||
throw new ErrorMappingException(sprintf('The child "%s" of "%s" mapped by the rule "%s" in "%s" does not exist.', $childName, $target->getName(), $this->targetPath, $this->origin->getName()));
|
||||
throw new ErrorMappingException(\sprintf('The child "%s" of "%s" mapped by the rule "%s" in "%s" does not exist.', $childName, $target->getName(), $this->targetPath, $this->origin->getName()));
|
||||
}
|
||||
$target = $target->get($childName);
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ class ViolationMapper implements ViolationMapperInterface
|
||||
|
||||
// Test mapping rules as long as we have any
|
||||
foreach ($rules as $key => $rule) {
|
||||
/* @var MappingRule $rule */
|
||||
/** @var MappingRule $rule */
|
||||
|
||||
// Mapping rule matches completely, terminate.
|
||||
if (null !== ($form = $rule->match($chunk))) {
|
||||
@@ -317,7 +317,7 @@ class ViolationMapper implements ViolationMapperInterface
|
||||
// Cut the piece out of the property path and proceed
|
||||
$propertyPathBuilder->remove($i);
|
||||
} else {
|
||||
/* @var \Symfony\Component\PropertyAccess\PropertyPathInterface $propertyPath */
|
||||
/** @var \Symfony\Component\PropertyAccess\PropertyPathInterface $propertyPath */
|
||||
$propertyPath = $scope->getPropertyPath();
|
||||
|
||||
if (null === $propertyPath) {
|
||||
|
||||
@@ -132,7 +132,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
||||
public function getElement(int $index): string
|
||||
{
|
||||
if (!isset($this->elements[$index])) {
|
||||
throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index));
|
||||
throw new OutOfBoundsException(\sprintf('The index "%s" is not within the violation path.', $index));
|
||||
}
|
||||
|
||||
return $this->elements[$index];
|
||||
@@ -141,7 +141,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
||||
public function isProperty(int $index): bool
|
||||
{
|
||||
if (!isset($this->isIndex[$index])) {
|
||||
throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index));
|
||||
throw new OutOfBoundsException(\sprintf('The index "%s" is not within the violation path.', $index));
|
||||
}
|
||||
|
||||
return !$this->isIndex[$index];
|
||||
@@ -150,7 +150,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
||||
public function isIndex(int $index): bool
|
||||
{
|
||||
if (!isset($this->isIndex[$index])) {
|
||||
throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index));
|
||||
throw new OutOfBoundsException(\sprintf('The index "%s" is not within the violation path.', $index));
|
||||
}
|
||||
|
||||
return $this->isIndex[$index];
|
||||
@@ -176,7 +176,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
||||
public function mapsForm(int $index): bool
|
||||
{
|
||||
if (!isset($this->mapsForm[$index])) {
|
||||
throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index));
|
||||
throw new OutOfBoundsException(\sprintf('The index "%s" is not within the violation path.', $index));
|
||||
}
|
||||
|
||||
return $this->mapsForm[$index];
|
||||
|
||||
@@ -619,7 +619,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return null === $this->transformationFailure;
|
||||
}
|
||||
|
||||
public function getTransformationFailure(): ?Exception\TransformationFailedException
|
||||
public function getTransformationFailure(): ?TransformationFailedException
|
||||
{
|
||||
return $this->transformationFailure;
|
||||
}
|
||||
@@ -750,7 +750,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
$child = $this->config->getFormFactory()->createNamed($child, $type, null, $options);
|
||||
}
|
||||
} elseif ($child->getConfig()->getAutoInitialize()) {
|
||||
throw new RuntimeException(sprintf('Automatic initialization is only supported on root forms. You should set the "auto_initialize" option to false on the field "%s".', $child->getName()));
|
||||
throw new RuntimeException(\sprintf('Automatic initialization is only supported on root forms. You should set the "auto_initialize" option to false on the field "%s".', $child->getName()));
|
||||
}
|
||||
|
||||
$this->children[$child->getName()] = $child;
|
||||
@@ -812,7 +812,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return $this->children[$name];
|
||||
}
|
||||
|
||||
throw new OutOfBoundsException(sprintf('Child "%s" does not exist.', $name));
|
||||
throw new OutOfBoundsException(\sprintf('Child "%s" does not exist.', $name));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -945,7 +945,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
$value = $transformer->transform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException(sprintf('Unable to transform data for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
throw new TransformationFailedException(\sprintf('Unable to transform data for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
}
|
||||
|
||||
return $value;
|
||||
@@ -965,7 +965,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
$value = $transformers[$i]->reverseTransform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
throw new TransformationFailedException(\sprintf('Unable to reverse value for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
}
|
||||
|
||||
return $value;
|
||||
@@ -992,7 +992,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
$value = $transformer->transform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException(sprintf('Unable to transform value for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
throw new TransformationFailedException(\sprintf('Unable to transform value for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
}
|
||||
|
||||
return $value;
|
||||
@@ -1014,7 +1014,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
$value = $transformers[$i]->reverseTransform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
throw new TransformationFailedException(\sprintf('Unable to reverse value for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
@@ -102,7 +102,7 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
|
||||
return $this->children[$name];
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException(sprintf('The child with the name "%s" does not exist.', $name));
|
||||
throw new InvalidArgumentException(\sprintf('The child with the name "%s" does not exist.', $name));
|
||||
}
|
||||
|
||||
public function remove(string $name): static
|
||||
@@ -147,7 +147,7 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
|
||||
|
||||
public function getFormConfig(): FormConfigInterface
|
||||
{
|
||||
/** @var $config self */
|
||||
/** @var self $config */
|
||||
$config = parent::getFormConfig();
|
||||
|
||||
$config->children = [];
|
||||
|
||||
@@ -75,7 +75,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
self::validateName($name);
|
||||
|
||||
if (null !== $dataClass && !class_exists($dataClass) && !interface_exists($dataClass, false)) {
|
||||
throw new InvalidArgumentException(sprintf('Class "%s" not found. Is the "data_class" form option set correctly?', $dataClass));
|
||||
throw new InvalidArgumentException(\sprintf('Class "%s" not found. Is the "data_class" form option set correctly?', $dataClass));
|
||||
}
|
||||
|
||||
$this->name = (string) $name;
|
||||
@@ -636,7 +636,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
final public static function validateName(?string $name): void
|
||||
{
|
||||
if (!self::isValidName($name)) {
|
||||
throw new InvalidArgumentException(sprintf('The name "%s" contains illegal characters. Names should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").', $name));
|
||||
throw new InvalidArgumentException(\sprintf('The name "%s" contains illegal characters. Names should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").', $name));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class FormErrorIterator implements \RecursiveIterator, \SeekableIterator, \Array
|
||||
{
|
||||
foreach ($errors as $error) {
|
||||
if (!($error instanceof FormError || $error instanceof self)) {
|
||||
throw new InvalidArgumentException(sprintf('The errors must be instances of "Symfony\Component\Form\FormError" or "%s". Got: "%s".', __CLASS__, get_debug_type($error)));
|
||||
throw new InvalidArgumentException(\sprintf('The errors must be instances of "Symfony\Component\Form\FormError" or "%s". Got: "%s".', __CLASS__, get_debug_type($error)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ class FormErrorIterator implements \RecursiveIterator, \SeekableIterator, \Array
|
||||
if ($error instanceof FormError) {
|
||||
$string .= 'ERROR: '.$error->getMessage()."\n";
|
||||
} else {
|
||||
/* @var self $error */
|
||||
/** @var self $error */
|
||||
$string .= $error->getForm()->getName().":\n";
|
||||
$string .= self::indent((string) $error);
|
||||
}
|
||||
@@ -199,7 +199,7 @@ class FormErrorIterator implements \RecursiveIterator, \SeekableIterator, \Array
|
||||
public function getChildren(): self
|
||||
{
|
||||
if (!$this->hasChildren()) {
|
||||
throw new LogicException(sprintf('The current element is not iterable. Use "%s" to get the current element.', self::class.'::current()'));
|
||||
throw new LogicException(\sprintf('The current element is not iterable. Use "%s" to get the current element.', self::class.'::current()'));
|
||||
}
|
||||
|
||||
/** @var self $children */
|
||||
|
||||
@@ -33,7 +33,7 @@ class FormRegistry implements FormRegistryInterface
|
||||
*/
|
||||
private array $types = [];
|
||||
|
||||
private FormTypeGuesserInterface|null|false $guesser = false;
|
||||
private FormTypeGuesserInterface|false|null $guesser = false;
|
||||
private ResolvedFormTypeFactoryInterface $resolvedTypeFactory;
|
||||
private array $checkedTypes = [];
|
||||
|
||||
@@ -69,10 +69,10 @@ class FormRegistry implements FormRegistryInterface
|
||||
if (!$type) {
|
||||
// Support fully-qualified class names
|
||||
if (!class_exists($name)) {
|
||||
throw new InvalidArgumentException(sprintf('Could not load type "%s": class does not exist.', $name));
|
||||
throw new InvalidArgumentException(\sprintf('Could not load type "%s": class does not exist.', $name));
|
||||
}
|
||||
if (!is_subclass_of($name, FormTypeInterface::class)) {
|
||||
throw new InvalidArgumentException(sprintf('Could not load type "%s": class does not implement "Symfony\Component\Form\FormTypeInterface".', $name));
|
||||
throw new InvalidArgumentException(\sprintf('Could not load type "%s": class does not implement "Symfony\Component\Form\FormTypeInterface".', $name));
|
||||
}
|
||||
|
||||
$type = new $name();
|
||||
@@ -94,7 +94,7 @@ class FormRegistry implements FormRegistryInterface
|
||||
|
||||
if (isset($this->checkedTypes[$fqcn])) {
|
||||
$types = implode(' > ', array_merge(array_keys($this->checkedTypes), [$fqcn]));
|
||||
throw new LogicException(sprintf('Circular reference detected for form type "%s" (%s).', $fqcn, $types));
|
||||
throw new LogicException(\sprintf('Circular reference detected for form type "%s" (%s).', $fqcn, $types));
|
||||
}
|
||||
|
||||
$this->checkedTypes[$fqcn] = true;
|
||||
|
||||
@@ -64,7 +64,7 @@ class FormRenderer implements FormRendererInterface
|
||||
$resource = $this->engine->getResourceForBlockName($view, $blockName);
|
||||
|
||||
if (!$resource) {
|
||||
throw new LogicException(sprintf('No block "%s" found while rendering the form.', $blockName));
|
||||
throw new LogicException(\sprintf('No block "%s" found while rendering the form.', $blockName));
|
||||
}
|
||||
|
||||
$viewCacheKey = $view->vars[self::CACHE_KEY_VAR];
|
||||
@@ -121,7 +121,7 @@ class FormRenderer implements FormRendererInterface
|
||||
|
||||
if ($renderOnlyOnce && $view->isRendered()) {
|
||||
// This is not allowed, because it would result in rendering same IDs multiple times, which is not valid.
|
||||
throw new BadMethodCallException(sprintf('Field "%s" has already been rendered, save the result of previous render call to a variable and output that instead.', $view->vars['name']));
|
||||
throw new BadMethodCallException(\sprintf('Field "%s" has already been rendered, save the result of previous render call to a variable and output that instead.', $view->vars['name']));
|
||||
}
|
||||
|
||||
// The cache key for storing the variables and types
|
||||
@@ -208,10 +208,10 @@ class FormRenderer implements FormRendererInterface
|
||||
// Escape if no resource exists for this block
|
||||
if (!$resource) {
|
||||
if (\count($blockNameHierarchy) !== \count(array_unique($blockNameHierarchy))) {
|
||||
throw new LogicException(sprintf('Unable to render the form because the block names array contains duplicates: "%s".', implode('", "', array_reverse($blockNameHierarchy))));
|
||||
throw new LogicException(\sprintf('Unable to render the form because the block names array contains duplicates: "%s".', implode('", "', array_reverse($blockNameHierarchy))));
|
||||
}
|
||||
|
||||
throw new LogicException(sprintf('Unable to render the form as none of the following blocks exist: "%s".', implode('", "', array_reverse($blockNameHierarchy))));
|
||||
throw new LogicException(\sprintf('Unable to render the form as none of the following blocks exist: "%s".', implode('", "', array_reverse($blockNameHierarchy))));
|
||||
}
|
||||
|
||||
// Merge the passed with the existing attributes
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Symfony\Component\Form\Guess;
|
||||
use Symfony\Component\Form\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Base class for guesses made by TypeGuesserInterface implementation.
|
||||
* Base class for guesses made by FormTypeGuesserInterface implementation.
|
||||
*
|
||||
* Each instance contains a confidence value about the correctness of the guess.
|
||||
* Thus an instance with confidence HIGH_CONFIDENCE is more likely to be
|
||||
|
||||
@@ -43,7 +43,7 @@ class NativeRequestHandler implements RequestHandlerInterface
|
||||
/**
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception\UnexpectedTypeException If the $request is not null
|
||||
* @throws UnexpectedTypeException If the $request is not null
|
||||
*/
|
||||
public function handleRequest(FormInterface $form, mixed $request = null)
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ class PreloadedExtension implements FormExtensionInterface
|
||||
public function getType(string $name): FormTypeInterface
|
||||
{
|
||||
if (!isset($this->types[$name])) {
|
||||
throw new InvalidArgumentException(sprintf('The type "%s" cannot be loaded by this extension.', $name));
|
||||
throw new InvalidArgumentException(\sprintf('The type "%s" cannot be loaded by this extension.', $name));
|
||||
}
|
||||
|
||||
return $this->types[$name];
|
||||
|
||||
@@ -75,7 +75,7 @@ class ResolvedFormType implements ResolvedFormTypeInterface
|
||||
try {
|
||||
$options = $this->getOptionsResolver()->resolve($options);
|
||||
} catch (ExceptionInterface $e) {
|
||||
throw new $e(sprintf('An error has occurred resolving the options of the form "%s": ', get_debug_type($this->getInnerType())).$e->getMessage(), $e->getCode(), $e);
|
||||
throw new $e(\sprintf('An error has occurred resolving the options of the form "%s": ', get_debug_type($this->getInnerType())).$e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
|
||||
// Should be decoupled from the specific option at some point
|
||||
@@ -129,8 +129,8 @@ class ResolvedFormType implements ResolvedFormTypeInterface
|
||||
|
||||
$this->innerType->finishView($view, $form, $options);
|
||||
|
||||
/** @var FormTypeExtensionInterface $extension */
|
||||
foreach ($this->typeExtensions as $extension) {
|
||||
/* @var FormTypeExtensionInterface $extension */
|
||||
$extension->finishView($view, $form, $options);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,87 +8,87 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="29">
|
||||
<source>The uploaded file was too large. Please try to upload a smaller file.</source>
|
||||
<target>L'arxiu pujat és massa gran. Per favor, pugi un arxiu més petit.</target>
|
||||
<target>El fitxer pujat és massa gran. Pujeu un fitxer més petit.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="30">
|
||||
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
|
||||
<target>El token CSRF no és vàlid. Per favor, provi d'enviar novament el formulari.</target>
|
||||
<target>El token CSRF no és vàlid. Torneu a enviar el formulari.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="99">
|
||||
<source>This value is not a valid HTML5 color.</source>
|
||||
<target>Aquest valor no és un color HTML5 valid.</target>
|
||||
<target>Aquest valor no és un color HTML5 vàlid.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="100">
|
||||
<source>Please enter a valid birthdate.</source>
|
||||
<target>Per favor introdueix una data d'aniversari valida.</target>
|
||||
<target>Introduïu una data d'aniversari vàlida.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="101">
|
||||
<source>The selected choice is invalid.</source>
|
||||
<target>L'opció escollida és invalida.</target>
|
||||
<target>L'opció escollida no és vàlida.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="102">
|
||||
<source>The collection is invalid.</source>
|
||||
<target>La col·lecció és invalida.</target>
|
||||
<target>La col·lecció no és vàlida.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="103">
|
||||
<source>Please select a valid color.</source>
|
||||
<target>Per favor selecciona un color vàlid.</target>
|
||||
<target>Seleccioneu un color vàlid.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="104">
|
||||
<source>Please select a valid country.</source>
|
||||
<target>Per favor selecciona una ciutat vàlida.</target>
|
||||
<target>Seleccioneu una ciutat vàlida.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="105">
|
||||
<source>Please select a valid currency.</source>
|
||||
<target>Per favor selecciona una moneda vàlida.</target>
|
||||
<target>Seleccioneu una moneda vàlida.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="106">
|
||||
<source>Please choose a valid date interval.</source>
|
||||
<target>Per favor escull un interval de dates vàlides.</target>
|
||||
<target>Escolliu un interval de dates vàlides.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="107">
|
||||
<source>Please enter a valid date and time.</source>
|
||||
<target>Per favor introdueix una data i temps vàlid.</target>
|
||||
<target>Introduïu una data i hora vàlides.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="108">
|
||||
<source>Please enter a valid date.</source>
|
||||
<target>Per favor introdueix una data vàlida.</target>
|
||||
<target>Introduïu una data vàlida.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="109">
|
||||
<source>Please select a valid file.</source>
|
||||
<target>Per favor selecciona un arxiu vàlid.</target>
|
||||
<target>Seleccioneu un fitxer vàlid.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="110">
|
||||
<source>The hidden field is invalid.</source>
|
||||
<target>El camp ocult és invàlid.</target>
|
||||
<target>El camp ocult no és vàlid.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="111">
|
||||
<source>Please enter an integer.</source>
|
||||
<target>Per favor introdueix un enter.</target>
|
||||
<target>Introduïu un enter.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="112">
|
||||
<source>Please select a valid language.</source>
|
||||
<target>Per favor selecciona un idioma vàlid.</target>
|
||||
<target>Seleccioneu un idioma vàlid.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="113">
|
||||
<source>Please select a valid locale.</source>
|
||||
<target>Per favor seleccioneu una configuració regional vàlida</target>
|
||||
<target>Seleccioneu una configuració regional vàlida</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="114">
|
||||
<source>Please enter a valid money amount.</source>
|
||||
<target>Per favor introdueix una quantitat de diners vàlids.</target>
|
||||
<target>Introduïu una quantitat de diners vàlida.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="115">
|
||||
<source>Please enter a number.</source>
|
||||
<target>Per favor introdueix un número.</target>
|
||||
<target>Introduïu un número.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="116">
|
||||
<source>The password is invalid.</source>
|
||||
<target>La contrasenya es invàlida.</target>
|
||||
<target>La contrasenya no és vàlida.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="117">
|
||||
<source>Please enter a percentage value.</source>
|
||||
<target>Per favor introdueix un valor percentual.</target>
|
||||
<target>Introduïu un valor percentual.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="118">
|
||||
<source>The values do not match.</source>
|
||||
@@ -96,43 +96,43 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="119">
|
||||
<source>Please enter a valid time.</source>
|
||||
<target>Per favor introdueix un temps vàlid.</target>
|
||||
<target>Introduïu una hora vàlida.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="120">
|
||||
<source>Please select a valid timezone.</source>
|
||||
<target>Per favor selecciona una zona horària vàlida.</target>
|
||||
<target>Seleccioneu una zona horària vàlida.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="121">
|
||||
<source>Please enter a valid URL.</source>
|
||||
<target>Per favor introdueix una URL vàlida.</target>
|
||||
<target>Introduïu una URL vàlida.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="122">
|
||||
<source>Please enter a valid search term.</source>
|
||||
<target>Per favor introdueix un concepte de cerca vàlid.</target>
|
||||
<target>Introduïu un terme de cerca vàlid.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="123">
|
||||
<source>Please provide a valid phone number.</source>
|
||||
<target>Per favor introdueix un número de telèfon vàlid.</target>
|
||||
<target>Introduïu un número de telèfon vàlid.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="124">
|
||||
<source>The checkbox has an invalid value.</source>
|
||||
<target>La casella de selecció te un valor invàlid.</target>
|
||||
<target>La casella de selecció te un valor no vàlid.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="125">
|
||||
<source>Please enter a valid email address.</source>
|
||||
<target>Per favor introdueix un correu electrònic vàlid.</target>
|
||||
<target>Introduïu un correu electrònic vàlid.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="126">
|
||||
<source>Please select a valid option.</source>
|
||||
<target>Per favor selecciona una opció vàlida.</target>
|
||||
<target>Seleccioneu una opció vàlida.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="127">
|
||||
<source>Please select a valid range.</source>
|
||||
<target>Per favor selecciona un rang vàlid.</target>
|
||||
<target>Seleccioneu un rang vàlid.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="128">
|
||||
<source>Please enter a valid week.</source>
|
||||
<target>Per favor introdueix una setmana vàlida.</target>
|
||||
<target>Introduïu una setmana vàlida.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="101">
|
||||
<source>The selected choice is invalid.</source>
|
||||
<target>A escolha seleccionada é inválida.</target>
|
||||
<target>A escolha selecionada é inválida.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="102">
|
||||
<source>The collection is invalid.</source>
|
||||
|
||||
@@ -112,7 +112,7 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable
|
||||
public function offsetGet(mixed $key): mixed
|
||||
{
|
||||
if (!isset($this->elements[$key])) {
|
||||
throw new \OutOfBoundsException(sprintf('The offset "%s" does not exist.', $key));
|
||||
throw new \OutOfBoundsException(\sprintf('The offset "%s" does not exist.', $key));
|
||||
}
|
||||
|
||||
return $this->elements[$key];
|
||||
|
||||
@@ -57,15 +57,12 @@ class OrderedHashMapIterator implements \Iterator
|
||||
$this->managedCursors[$this->cursorId] = &$this->cursor;
|
||||
}
|
||||
|
||||
public function __sleep(): array
|
||||
public function __serialize(): array
|
||||
{
|
||||
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function __wakeup()
|
||||
public function __unserialize(array $data): void
|
||||
{
|
||||
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user