From 251304e424f26a2dad7cd1d594a17ec23e333f93 Mon Sep 17 00:00:00 2001 From: wkania Date: Wed, 17 Feb 2021 19:13:44 +0100 Subject: [PATCH] [Validator] Use null coalescing operator instead of ternary operator --- validation/severity.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: