Skip to content

Commit e3f3980

Browse files
committed
[Serializer] Deprecate AbstractNormalizer::formatAttribute()
1 parent e4f34a7 commit e3f3980

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,22 @@ public function setCamelizedAttributes(array $camelizedAttributes)
141141
return $this;
142142
}
143143

144+
/**
145+
* Format an attribute name, for example to convert a snake_case name to camelCase.
146+
*
147+
* @deprecated since 2.7, to be removed in 3.0. Use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter instead.
148+
*
149+
* @param string $attributeName
150+
*
151+
* @return string
152+
*/
153+
protected function formatAttribute($attributeName)
154+
{
155+
trigger_error('The setCamelizedAttributes() has been deprecated. Use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter instead.', E_USER_DEPRECATED);
156+
157+
return $this->nameConverter ? $this->nameConverter->normalize($attributeName) : $attributeName;
158+
}
159+
144160
/**
145161
* Detects if the configured circular reference limit is reached.
146162
*

0 commit comments

Comments
 (0)