Update user type check from switch to match expression

This commit is contained in:
2025-03-28 12:20:57 +01:00
parent a67db4d113
commit 9bf7690aa7
@@ -13,12 +13,10 @@ class UserDisplayNameMapTransformer implements PropertyTransformerInterface
*/
public function transform(mixed $value, object|array $source, array $context): mixed
{
switch ($source->getType()) {
case UserType::Individual:
return $this->individualDisplayName($source);
case UserType::Organization:
return $this->organizationDisplayName($source);
}
return match ($source->getType()) {
UserType::Individual => $this->individualDisplayName($source),
UserType::Organization => $this->organizationDisplayName($source),
};
}
private function individualDisplayName(User $user): string