Skip to content

Commit 6055971

Browse files
committed
minor #14997 [Validator] Use null coalescing operator instead of ternary operator (wkania)
This PR was merged into the 4.4 branch. Discussion ---------- [Validator] Use null coalescing operator instead of ternary operator <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `5.x` for features of unreleased versions). --> Commits ------- 251304e [Validator] Use null coalescing operator instead of ternary operator
2 parents ea5fa9e + 251304e commit 6055971

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

validation/severity.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ method. Each constraint exposes the attached payload as a public property::
137137
// Symfony\Component\Validator\ConstraintViolation
138138
$constraintViolation = ...;
139139
$constraint = $constraintViolation->getConstraint();
140-
$severity = isset($constraint->payload['severity']) ? $constraint->payload['severity'] : null;
140+
$severity = $constraint->payload['severity'] ?? null;
141141

142142
For example, you can leverage this to customize the ``form_errors`` block
143143
so that the severity is added as an additional HTML class:

0 commit comments

Comments
 (0)