Upgrade 1-11.38

This commit is contained in:
xesmyd
2026-03-30 14:10:30 +02:00
parent f2a7e6d1fc
commit ac648ef29d
24665 changed files with 69682 additions and 2205004 deletions
@@ -56,28 +56,44 @@ class FormValidator extends ConstraintValidator
// Validate the data against the constraints defined
// in the form
$constraints = $config->getOption('constraints', array());
foreach ($constraints as $constraint) {
// For the "Valid" constraint, validate the data in all groups
if ($constraint instanceof Valid) {
$validator->atPath('data')->validate($form->getData(), $constraint, $groups);
continue;
}
if ($groups instanceof GroupSequence) {
$validator->atPath('data')->validate($form->getData(), $constraints, $groups);
// Otherwise validate a constraint only once for the first
// matching group
foreach ($groups as $group) {
if (in_array($group, $constraint->groups)) {
$validator->atPath('data')->validate($form->getData(), $constraint, $group);
if (count($this->context->getViolations()) > 0) {
break;
}
}
}
} else {
foreach ($constraints as $constraint) {
// For the "Valid" constraint, validate the data in all groups
if ($constraint instanceof Valid) {
$validator->atPath('data')->validate($form->getData(), $constraint, $groups);
// Prevent duplicate validation
continue 2;
continue;
}
// Otherwise validate a constraint only once for the first
// matching group
foreach ($groups as $group) {
if (in_array($group, $constraint->groups)) {
$validator->atPath('data')->validate($form->getData(), $constraint, $group);
// Prevent duplicate validation
continue 2;
}
}
}
}
} else {
$childrenSynchronized = true;
/** @var FormInterface $child */
foreach ($form as $child) {
if (!$child->isSynchronized()) {
$childrenSynchronized = false;
@@ -119,8 +135,6 @@ class FormValidator extends ConstraintValidator
/**
* Returns the validation groups of the given form.
*
* @param FormInterface $form The form
*
* @return array The validation groups
*/
private static function getValidationGroups(FormInterface $form)
@@ -23,14 +23,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
*/
class FormTypeValidatorExtension extends BaseValidatorExtension
{
/**
* @var ValidatorInterface
*/
private $validator;
/**
* @var ViolationMapper
*/
private $violationMapper;
public function __construct(ValidatorInterface $validator)
@@ -73,8 +73,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
/**
* Guesses a field class name for a given constraint.
*
* @param Constraint $constraint The constraint to guess for
*
* @return TypeGuess|null The guessed field class and options
*/
public function guessTypeForConstraint(Constraint $constraint)
@@ -151,8 +149,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
case 'Symfony\Component\Validator\Constraints\Count':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), Guess::LOW_CONFIDENCE);
case 'Symfony\Component\Validator\Constraints\True':
case 'Symfony\Component\Validator\Constraints\False':
case 'Symfony\Component\Validator\Constraints\IsTrue':
case 'Symfony\Component\Validator\Constraints\IsFalse':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CheckboxType', array(), Guess::MEDIUM_CONFIDENCE);
@@ -162,8 +158,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
/**
* Guesses whether a field is required based on the given constraint.
*
* @param Constraint $constraint The constraint to guess for
*
* @return ValueGuess|null The guess whether the field is required
*/
public function guessRequiredForConstraint(Constraint $constraint)
@@ -171,7 +165,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
switch (get_class($constraint)) {
case 'Symfony\Component\Validator\Constraints\NotNull':
case 'Symfony\Component\Validator\Constraints\NotBlank':
case 'Symfony\Component\Validator\Constraints\True':
case 'Symfony\Component\Validator\Constraints\IsTrue':
return new ValueGuess(true, Guess::HIGH_CONFIDENCE);
}
@@ -180,8 +173,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
/**
* Guesses a field's maximum length based on the given constraint.
*
* @param Constraint $constraint The constraint to guess for
*
* @return ValueGuess|null The guess for the maximum length
*/
public function guessMaxLengthForConstraint(Constraint $constraint)
@@ -210,8 +201,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
/**
* Guesses a field's pattern based on the given constraint.
*
* @param Constraint $constraint The constraint to guess for
*
* @return ValueGuess|null The guess for the pattern
*/
public function guessPatternForConstraint(Constraint $constraint)
@@ -254,7 +243,7 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
* @param \Closure $closure The closure that returns a guess
* for a given constraint
* @param mixed $defaultValue The default value assumed if no other value
* can be guessed.
* can be guessed
*
* @return Guess|null The guessed value with the highest confidence
*/
@@ -19,21 +19,15 @@ use Symfony\Component\Form\Exception\ErrorMappingException;
*/
class MappingRule
{
/**
* @var FormInterface
*/
private $origin;
/**
* @var string
*/
private $propertyPath;
/**
* @var string
*/
private $targetPath;
/**
* @param FormInterface $origin
* @param string $propertyPath
* @param string $targetPath
*/
public function __construct(FormInterface $origin, $propertyPath, $targetPath)
{
$this->origin = $origin;
@@ -19,9 +19,6 @@ use Symfony\Component\PropertyAccess\PropertyPath;
*/
class RelativePath extends PropertyPath
{
/**
* @var FormInterface
*/
private $root;
/**
@@ -269,8 +269,6 @@ class ViolationMapper implements ViolationMapperInterface
}
/**
* @param FormInterface $form
*
* @return bool
*/
private function acceptsErrors(FormInterface $form)
@@ -24,10 +24,8 @@ interface ViolationMapperInterface
* the given form.
*
* @param ConstraintViolation $violation The violation to map
* @param FormInterface $form The root form of the tree
* to map it to.
* @param bool $allowNonSynchronized Whether to allow
* mapping to non-synchronized forms.
* @param FormInterface $form The root form of the tree to map it to
* @param bool $allowNonSynchronized Whether to allow mapping to non-synchronized forms
*/
public function mapViolation(ConstraintViolation $violation, FormInterface $form, $allowNonSynchronized = false);
}
@@ -48,8 +48,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
/**
* Creates a new violation path from a string.
*
* @param string $violationPath The property path of a {@link \Symfony\Component\Validator\ConstraintViolation}
* object.
* @param string $violationPath The property path of a {@link \Symfony\Component\Validator\ConstraintViolation} object
*/
public function __construct($violationPath)
{
@@ -210,7 +209,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
*
* @return bool Whether the element maps to a form
*
* @throws OutOfBoundsException If the offset is invalid.
* @throws OutOfBoundsException if the offset is invalid
*/
public function mapsForm($index)
{