From 8282deffff5133dbab0730c4ed9cb24974102d7e Mon Sep 17 00:00:00 2001 From: soyuka Date: Sun, 16 Aug 2026 12:18:24 +0200 Subject: [PATCH] fix(metadata): drop unreachable array guards on serializer attributes getEffectiveSerializerAttributes() always returns array|null, so the !is_array() branches could never run. Unlike serializer groups, Symfony's AbstractNormalizer does not coerce a scalar "attributes" context, so there is no string form to normalise here. --- .../Factory/SerializerPropertyMetadataFactory.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Metadata/Property/Factory/SerializerPropertyMetadataFactory.php b/src/Metadata/Property/Factory/SerializerPropertyMetadataFactory.php index d7412a59268..d80cc055923 100644 --- a/src/Metadata/Property/Factory/SerializerPropertyMetadataFactory.php +++ b/src/Metadata/Property/Factory/SerializerPropertyMetadataFactory.php @@ -58,14 +58,6 @@ public function create(string $resourceClass, string $property, array $options = [$normalizationAttributes, $denormalizationAttributes] = $this->getEffectiveSerializerAttributes($options); - if ($normalizationAttributes && !\is_array($normalizationAttributes)) { - $normalizationAttributes = [$normalizationAttributes]; - } - - if ($denormalizationAttributes && !\is_array($denormalizationAttributes)) { - $denormalizationAttributes = [$denormalizationAttributes]; - } - $ignoredAttributes = $options['ignored_attributes'] ?? []; } catch (ResourceClassNotFoundException) { // TODO: for input/output classes, the serializer groups must be read from the actual resource class