In following code (condensed from a project) the validation for $constraint2
returns no error, which is not the behaviour I expect (should also return errors):
use SymfonyComponentValidatorValidation;
use SymfonyComponentValidatorConstraintsType;
use SymfonyComponentValidatorConstraintsAtLeastOneOf;
$config = 1; //Integer
$constraint1 = new AtLeastOneOf([ new Type('string') ]);
$constraint2 = new AtLeastOneOf([ new AtLeastOneOf([ new Type('string') ]) ]);
$validator = Validation::createValidator();
echo "Constraint 1: ".(count($validator->validate($config,$constraint1))).'<br>';
echo "Constraint 2: ".(count($validator->validate($config,$constraint2))).'<br>';
Output:
Constraint 1: 1
Constraint 2: 0
The problem seems to be the nested AtLeastOneOf validator, but I do not understand why it does validate to no errors.