Skip to content

Commit e7b1e86

Browse files
committed
[Serializer] Prevent using both setCamelizedAttributes() and a name converter
1 parent 02abe50 commit e7b1e86

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ public function setCamelizedAttributes(array $camelizedAttributes)
129129
{
130130
trigger_error(sprintf('%s is deprecated since version 2.7 and will be removed in 3.0. Use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter instead.', __METHOD__), E_USER_DEPRECATED);
131131

132+
if ($this->nameConverter) {
133+
throw new \LogicException(sprintf('%s cannot be called if a custom Name Converter is defined.', __METHOD__));
134+
}
135+
132136
$attributes = array();
133137
foreach ($camelizedAttributes as $camelizedAttribute) {
134138
$attributes[] = lcfirst(preg_replace_callback('/(^|_|\.)+(.)/', function ($match) {

0 commit comments

Comments
 (0)