diff --git a/src/Symfony/Component/Serializer/Exception/Exception.php b/src/Symfony/Component/Serializer/Exception/Exception.php deleted file mode 100644 index fc0606e2ff19..000000000000 --- a/src/Symfony/Component/Serializer/Exception/Exception.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Serializer\Exception; - -/** - * Base exception. - * - * @deprecated since version 2.7, to be removed in 3.0. Use ExceptionInterface instead. - */ -interface Exception -{ -} diff --git a/src/Symfony/Component/Serializer/Exception/ExceptionInterface.php b/src/Symfony/Component/Serializer/Exception/ExceptionInterface.php index ff67edbb022a..99ed63246c5d 100644 --- a/src/Symfony/Component/Serializer/Exception/ExceptionInterface.php +++ b/src/Symfony/Component/Serializer/Exception/ExceptionInterface.php @@ -16,6 +16,6 @@ * * @author Johannes M. Schmitt */ -interface ExceptionInterface extends Exception +interface ExceptionInterface { } diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index dfd21b46446b..ec5c4a593f84 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -13,11 +13,9 @@ use Symfony\Component\Serializer\Exception\CircularReferenceException; use Symfony\Component\Serializer\Exception\InvalidArgumentException; -use Symfony\Component\Serializer\Exception\LogicException; use Symfony\Component\Serializer\Exception\RuntimeException; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface; use Symfony\Component\Serializer\Mapping\AttributeMetadataInterface; -use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter; use Symfony\Component\Serializer\NameConverter\NameConverterInterface; /** @@ -140,37 +138,6 @@ public function setIgnoredAttributes(array $ignoredAttributes) return $this; } - /** - * Set attributes to be camelized on denormalize. - * - * @deprecated Deprecated since version 2.7, to be removed in 3.0. Use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter instead. - * - * @param array $camelizedAttributes - * - * @return self - * - * @throws LogicException - */ - public function setCamelizedAttributes(array $camelizedAttributes) - { - 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); - - if ($this->nameConverter && !$this->nameConverter instanceof CamelCaseToSnakeCaseNameConverter) { - throw new LogicException(sprintf('%s cannot be called if a custom Name Converter is defined.', __METHOD__)); - } - - $attributes = array(); - foreach ($camelizedAttributes as $camelizedAttribute) { - $attributes[] = lcfirst(preg_replace_callback('/(^|_|\.)+(.)/', function ($match) { - return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); - }, $camelizedAttribute)); - } - - $this->nameConverter = new CamelCaseToSnakeCaseNameConverter($attributes); - - return $this; - } - /** * Detects if the configured circular reference limit is reached. * @@ -221,22 +188,6 @@ protected function handleCircularReference($object) throw new CircularReferenceException(sprintf('A circular reference has been detected (configured limit: %d).', $this->circularReferenceLimit)); } - /** - * Format an attribute name, for example to convert a snake_case name to camelCase. - * - * @deprecated Deprecated since version 2.7, to be removed in 3.0. Use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter instead. - * - * @param string $attributeName - * - * @return string - */ - protected function formatAttribute($attributeName) - { - 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); - - return $this->nameConverter ? $this->nameConverter->normalize($attributeName) : $attributeName; - } - /** * Gets attributes to normalize using groups. * diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php index 9da90047b875..2814e4d86a3f 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php @@ -99,79 +99,11 @@ public function testDenormalizeWithObject() $this->assertEquals('bar', $obj->getBar()); } - /** - * @group legacy - */ - public function testLegacyDenormalizeOnCamelCaseFormat() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $this->normalizer->setCamelizedAttributes(array('camel_case')); - $obj = $this->normalizer->denormalize( - array('camel_case' => 'camelCase'), - __NAMESPACE__.'\GetSetDummy' - ); - - $this->assertEquals('camelCase', $obj->getCamelCase()); - } - public function testDenormalizeNull() { $this->assertEquals(new GetSetDummy(), $this->normalizer->denormalize(null, __NAMESPACE__.'\GetSetDummy')); } - /** - * @group legacy - */ - public function testLegacyCamelizedAttributesNormalize() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $obj = new GetCamelizedDummy('dunglas.fr'); - $obj->setFooBar('les-tilleuls.coop'); - $obj->setBar_foo('lostinthesupermarket.fr'); - - $this->normalizer->setCamelizedAttributes(array('kevin_dunglas')); - $this->assertEquals($this->normalizer->normalize($obj), array( - 'kevin_dunglas' => 'dunglas.fr', - 'fooBar' => 'les-tilleuls.coop', - 'bar_foo' => 'lostinthesupermarket.fr', - )); - - $this->normalizer->setCamelizedAttributes(array('foo_bar')); - $this->assertEquals($this->normalizer->normalize($obj), array( - 'kevinDunglas' => 'dunglas.fr', - 'foo_bar' => 'les-tilleuls.coop', - 'bar_foo' => 'lostinthesupermarket.fr', - )); - } - - /** - * @group legacy - */ - public function testLegacyCamelizedAttributesDenormalize() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $obj = new GetCamelizedDummy('dunglas.fr'); - $obj->setFooBar('les-tilleuls.coop'); - $obj->setBar_foo('lostinthesupermarket.fr'); - - $this->normalizer->setCamelizedAttributes(array('kevin_dunglas')); - $this->assertEquals($this->normalizer->denormalize(array( - 'kevin_dunglas' => 'dunglas.fr', - 'fooBar' => 'les-tilleuls.coop', - 'bar_foo' => 'lostinthesupermarket.fr', - ), __NAMESPACE__.'\GetCamelizedDummy'), $obj); - - $this->normalizer->setCamelizedAttributes(array('foo_bar')); - $this->assertEquals($this->normalizer->denormalize(array( - 'kevinDunglas' => 'dunglas.fr', - 'foo_bar' => 'les-tilleuls.coop', - 'bar_foo' => 'lostinthesupermarket.fr', - ), __NAMESPACE__.'\GetCamelizedDummy'), $obj); - } - public function testConstructorDenormalize() { $obj = $this->normalizer->denormalize( diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php index 3efa05dfc592..e7a43371575e 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php @@ -96,21 +96,6 @@ public function testDenormalizeWithObject() $this->assertEquals('bar', $obj->bar); } - /** - * @group legacy - */ - public function testLegacyDenormalizeOnCamelCaseFormat() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $this->normalizer->setCamelizedAttributes(array('camel_case')); - $obj = $this->normalizer->denormalize( - array('camel_case' => 'camelCase'), - __NAMESPACE__.'\ObjectDummy' - ); - $this->assertEquals('camelCase', $obj->getCamelCase()); - } - public function testDenormalizeNull() { $this->assertEquals(new ObjectDummy(), $this->normalizer->denormalize(null, __NAMESPACE__.'\ObjectDummy')); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php index 3ce91f3eee83..a92beaf9acca 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php @@ -62,73 +62,6 @@ public function testDenormalize() $this->assertEquals('bar', $obj->getBar()); } - /** - * @group legacy - */ - public function testLegacyDenormalizeOnCamelCaseFormat() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $this->normalizer->setCamelizedAttributes(array('camel_case')); - $obj = $this->normalizer->denormalize( - array('camel_case' => 'value'), - __NAMESPACE__.'\PropertyDummy' - ); - $this->assertEquals('value', $obj->getCamelCase()); - } - - /** - * @group legacy - */ - public function testLegacyCamelizedAttributesNormalize() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $obj = new PropertyCamelizedDummy('dunglas.fr'); - $obj->fooBar = 'les-tilleuls.coop'; - $obj->bar_foo = 'lostinthesupermarket.fr'; - - $this->normalizer->setCamelizedAttributes(array('kevin_dunglas')); - $this->assertEquals($this->normalizer->normalize($obj), array( - 'kevin_dunglas' => 'dunglas.fr', - 'fooBar' => 'les-tilleuls.coop', - 'bar_foo' => 'lostinthesupermarket.fr', - )); - - $this->normalizer->setCamelizedAttributes(array('foo_bar')); - $this->assertEquals($this->normalizer->normalize($obj), array( - 'kevinDunglas' => 'dunglas.fr', - 'foo_bar' => 'les-tilleuls.coop', - 'bar_foo' => 'lostinthesupermarket.fr', - )); - } - - /** - * @group legacy - */ - public function testLegacyCamelizedAttributesDenormalize() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $obj = new PropertyCamelizedDummy('dunglas.fr'); - $obj->fooBar = 'les-tilleuls.coop'; - $obj->bar_foo = 'lostinthesupermarket.fr'; - - $this->normalizer->setCamelizedAttributes(array('kevin_dunglas')); - $this->assertEquals($this->normalizer->denormalize(array( - 'kevin_dunglas' => 'dunglas.fr', - 'fooBar' => 'les-tilleuls.coop', - 'bar_foo' => 'lostinthesupermarket.fr', - ), __NAMESPACE__.'\PropertyCamelizedDummy'), $obj); - - $this->normalizer->setCamelizedAttributes(array('foo_bar')); - $this->assertEquals($this->normalizer->denormalize(array( - 'kevinDunglas' => 'dunglas.fr', - 'foo_bar' => 'les-tilleuls.coop', - 'bar_foo' => 'lostinthesupermarket.fr', - ), __NAMESPACE__.'\PropertyCamelizedDummy'), $obj); - } - public function testConstructorDenormalize() { $obj = $this->normalizer->denormalize(