Closed
Closed
Copy link
Description
Description
While testing some constraints implemented using the symfony validator component I found the ConstraintViolationAssertion
is marked as internal. This causes some complains on tools like psalm on level 3.
The use case occurs on simple validations like:
public function testInvalidValues($value, $valueAsString)
{
$constraint = new Blank([
'message' => 'myMessage',
]);
$this->validator->validate($value, $constraint);
$this->buildViolation('myMessage')
->setParameter('{{ value }}', $valueAsString)
->setCode(Blank::NOT_BLANK_ERROR)
->assertRaised();
}
the buildViolation
method generate an instance of ConstraintViolationAssertion
and calling on any method there could be unsafe cause it is marked as internal.
The code that should be removed is: https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php#L296-L298
I can do the PR if it is ok.