diff --git a/validation/severity.rst b/validation/severity.rst index 23b81145ee9..7a8c22298fd 100644 --- a/validation/severity.rst +++ b/validation/severity.rst @@ -137,7 +137,7 @@ method. Each constraint exposes the attached payload as a public property:: // Symfony\Component\Validator\ConstraintViolation $constraintViolation = ...; $constraint = $constraintViolation->getConstraint(); - $severity = isset($constraint->payload['severity']) ? $constraint->payload['severity'] : null; + $severity = $constraint->payload['severity'] ?? null; For example, you can leverage this to customize the ``form_errors`` block so that the severity is added as an additional HTML class: