From 9bf7690aa773f0f2decd5c9ea2097d8f709b4457 Mon Sep 17 00:00:00 2001 From: Daniel Subiabre Date: Fri, 28 Mar 2025 12:20:57 +0100 Subject: [PATCH] Update user type check from switch to match expression --- .../Transformer/UserDisplayNameMapTransformer.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Mapping/Transformer/UserDisplayNameMapTransformer.php b/src/Mapping/Transformer/UserDisplayNameMapTransformer.php index 187c505..ec30087 100644 --- a/src/Mapping/Transformer/UserDisplayNameMapTransformer.php +++ b/src/Mapping/Transformer/UserDisplayNameMapTransformer.php @@ -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