Skip to content

Commit bd7bcf5

Browse files
javiereguiluzderrabus
authored andcommitted
Simplify some code with null coalesce operator
1 parent ee4a4ff commit bd7bcf5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ContainerAwareEventManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function dispatchEvent($eventName, EventArgs $eventArgs = null)
5454
return;
5555
}
5656

57-
$eventArgs = null === $eventArgs ? EventArgs::getEmptyInstance() : $eventArgs;
57+
$eventArgs = $eventArgs ?? EventArgs::getEmptyInstance();
5858

5959
if (!isset($this->initialized[$eventName])) {
6060
$this->initializeListeners($eventName);

Validator/Constraints/UniqueEntityValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function validate($entity, Constraint $constraint)
163163
return;
164164
}
165165

166-
$errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0];
166+
$errorPath = $constraint->errorPath ?? $fields[0];
167167
$invalidValue = $criteria[$errorPath] ?? $criteria[$fields[0]];
168168

169169
$this->context->buildViolation($constraint->message)

0 commit comments

Comments
 (0)