Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Would it be possible to remove @internal from ConstraintViolationAssertion ? #42310

Copy link
Copy link
Closed
@jordisala1991

Description

@jordisala1991
Issue body actions

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.