Skip to content

[Serializer] MetadataAwareNameConverter: Do not assume that property names are strings #31031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function denormalize($propertyName, string $class = null, string $format
return self::$denormalizeCache[$class][$propertyName] ?? $this->denormalizeFallback($propertyName, $class, $format, $context);
}

private function getCacheValueForNormalization(string $propertyName, string $class): ?string
private function getCacheValueForNormalization($propertyName, string $class)
{
if (!$this->metadataFactory->hasMetadataFor($class)) {
return null;
Expand All @@ -83,12 +83,12 @@ private function getCacheValueForNormalization(string $propertyName, string $cla
return $attributesMetadata[$propertyName]->getSerializedName() ?? null;
}

private function normalizeFallback(string $propertyName, string $class = null, string $format = null, array $context = []): string
private function normalizeFallback($propertyName, string $class = null, string $format = null, array $context = [])
{
return $this->fallbackNameConverter ? $this->fallbackNameConverter->normalize($propertyName, $class, $format, $context) : $propertyName;
}

private function getCacheValueForDenormalization(string $propertyName, string $class): ?string
private function getCacheValueForDenormalization($propertyName, string $class)
{
if (!isset(self::$attributesMetadataCache[$class])) {
self::$attributesMetadataCache[$class] = $this->getCacheValueForAttributesMetadata($class);
Expand All @@ -97,7 +97,7 @@ private function getCacheValueForDenormalization(string $propertyName, string $c
return self::$attributesMetadataCache[$class][$propertyName] ?? null;
}

private function denormalizeFallback(string $propertyName, string $class = null, string $format = null, array $context = []): string
private function denormalizeFallback($propertyName, string $class = null, string $format = null, array $context = [])
{
return $this->fallbackNameConverter ? $this->fallbackNameConverter->denormalize($propertyName, $class, $format, $context) : $propertyName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public function attributeProvider()
['foo', 'baz'],
['bar', 'qux'],
['quux', 'quux'],
[0, 0],
];
}

Expand All @@ -111,6 +112,7 @@ public function fallbackAttributeProvider()
['foo', 'baz'],
['bar', 'qux'],
['quux', 'QUUX'],
[0, 0],
];
}
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy