[Validator] Added ConstraintViolation::getConstraint()

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This PR adds a `getConstraint()` method to the `ConstraintViolation` in order to access the constraint causing the violation.

Related to #7276, #7273 and #9691.
Btw this class is internal, so BC concerns don't apply here.