diff --git a/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php b/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php index 47d69d3abadc5..73ab1dfdd6800 100644 --- a/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php +++ b/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php @@ -19,7 +19,7 @@ * @author Kévin Dunglas * @author Aurélien Pillevesse */ -class CamelCaseToSnakeCaseNameConverter implements NameConverterInterface +class CamelCaseToSnakeCaseNameConverter implements NameConverterInterface, AdvancedNameConverterInterface { /** * Require all properties to be written in snake_case. @@ -41,7 +41,7 @@ public function __construct( * @param string|null $format * @param array $context */ - public function normalize(string $propertyName/* , ?string $class = null, ?string $format = null, array $context = [] */): string + public function normalize(string $propertyName, ?string $class = null, ?string $format = null, array $context = []): string { if (null === $this->attributes || \in_array($propertyName, $this->attributes, true)) { return strtolower(preg_replace('/[A-Z]/', '_\\0', lcfirst($propertyName))); @@ -55,12 +55,8 @@ public function normalize(string $propertyName/* , ?string $class = null, ?strin * @param string|null $format * @param array $context */ - public function denormalize(string $propertyName/* , ?string $class = null, ?string $format = null, array $context = [] */): string + public function denormalize(string $propertyName, ?string $class = null, ?string $format = null, array $context = []): string { - $class = 1 < \func_num_args() ? func_get_arg(1) : null; - $format = 2 < \func_num_args() ? func_get_arg(2) : null; - $context = 3 < \func_num_args() ? func_get_arg(3) : []; - if (($context[self::REQUIRE_SNAKE_CASE_PROPERTIES] ?? false) && $propertyName !== $this->normalize($propertyName, $class, $format, $context)) { throw new UnexpectedPropertyException($propertyName); } diff --git a/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php b/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php index eec3b42ce5e16..6c5be4033fc45 100644 --- a/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php +++ b/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php @@ -18,7 +18,7 @@ /** * @author Fabien Bourigault */ -final class MetadataAwareNameConverter implements NameConverterInterface +final class MetadataAwareNameConverter implements NameConverterInterface, AdvancedNameConverterInterface { /** * @var array>