8000 Removed deprecations in Serializer component · symfony/symfony@e90e9b2 · GitHub
[go: up one dir, main page]

Skip to content

Commit e90e9b2

Browse files
dostendunglas
authored andcommitted
Removed deprecations in Serializer component
1 parent 4949477 commit e90e9b2

File tree

6 files changed

+1
-221
lines changed

6 files changed

+1
-221
lines changed

src/Symfony/Component/Serializer/Exception/Exception.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/Symfony/Component/Serializer/Exception/ExceptionInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
*
1717
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
1818
*/
19-
interface ExceptionInterface extends Exception
19+
interface ExceptionInterface
2020
{
2121
}

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

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@
1313

1414
use Symfony\Component\Serializer\Exception\CircularReferenceException;
1515
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
16-
use Symfony\Component\Serializer\Exception\LogicException;
1716
use Symfony\Component\Serializer\Exception\RuntimeException;
1817
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
1918
use Symfony\Component\Serializer\Mapping\AttributeMetadataInterface;
20-
use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter;
2119
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
2220

2321
/**
@@ -140,37 +138,6 @@ public function setIgnoredAttributes(array $ignoredAttributes)
140138
return $this;
141139
}
142140

143-
/**
144-
* Set attributes to be camelized on denormalize.
145-
*
146-
* @deprecated Deprecated since version 2.7, to be removed in 3.0. Use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter instead.
147-
*
148-
* @param array $camelizedAttributes
149-
*
150-
* @return self
151-
*
152-
* @throws LogicException
153-
*/
154-
public function setCamelizedAttributes(array $camelizedAttributes)
155-
{
156-
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);
157-
158-
if ($this->nameConverter && !$this->nameConverter instanceof CamelCaseToSnakeCaseNameConverter) {
159-
throw new LogicException(sprintf('%s cannot be called if a custom Name Converter is defined.', __METHOD__));
160-
}
161-
162-
$attributes = array();
163-
foreach ($camelizedAttributes as $camelizedAttribute) {
164-
$attributes[] = lcfirst(preg_replace_callback('/(^|_|\.)+(.)/', function ($match) {
165-
return ('.' === $match[1] ? '_' : '').strtoupper($match[2]);
166-
}, $camelizedAttribute));
167-
}
168-
169-
$this->nameConverter = new CamelCaseToSnakeCaseNameConverter($attributes);
170-
171-
return $this;
172-
}
173-
174141
/**
175142
* Detects if the configured circular reference limit is reached.
176143
*
@@ -221,22 +188,6 @@ protected function handleCircularReference($object)
221188
throw new CircularReferenceException(sprintf('A circular reference has been detected (configured limit: %d).', $this->circularReferenceLimit));
222189
}
223190

224-
/**
225-
* Format an attribute name, for example to convert a snake_case name to camelCase.
226-
*
227-
* @deprecated Deprecated since version 2.7, to be removed in 3.0. Use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter instead.
228-
*
229-
* @param string $attributeName
230-
*
231-
* @return string
232-
*/
233-
protected function formatAttribute($attributeName)
234-
{
235-
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);
236-
237-
return $this->nameConverter ? $this->nameConverter->normalize($attributeName) : $attributeName;
238-
}
239-
240191
/**
241192
* Gets attributes to normalize using groups.
242193
*

src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -99,79 +99,11 @@ public function testDenormalizeWithObject()
9999
$this->assertEquals('bar', $obj->getBar());
100100
}
101101

102-
/**
103-
* @group legacy
104-
*/
105-
public function testLegacyDenormalizeOnCamelCaseFormat()
106-
{
107-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
108-
109-
$this->normalizer->setCamelizedAttributes(array('camel_case'));
110-
$obj = $this->normalizer->denormalize(
111-
array('camel_case' => 'camelCase'),
112-
__NAMESPACE__.'\GetSetDummy'
113-
);
114-
115-
$this->assertEquals('camelCase', $obj->getCamelCase());
116-
}
117-
118102
public function testDenormalizeNull()
119103
{
120104
$this->assertEquals(new GetSetDummy(), $this->normalizer->denormalize(null, __NAMESPACE__.'\GetSetDummy'));
121105
}
122106

123-
/**
124-
* @group legacy
125-
*/
126-
public function testLegacyCamelizedAttributesNormalize()
127-
{
128-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
129-
130-
$obj = new GetCamelizedDummy('dunglas.fr');
131-
$obj->setFooBar('les-tilleuls.coop');
132-
$obj->setBar_foo('lostinthesupermarket.fr');
133-
134-
$this->normalizer->setCamelizedAttributes(array('kevin_dunglas'));
135-
$this->assertEquals($this->normalizer->normalize($obj), array(
136-
'kevin_dunglas' => 'dunglas.fr',
137-
'fooBar' => 'les-tilleuls.coop',
138-
'bar_foo' => 'lostinthesupermarket.fr',
139-
));
140-
141-
$this->normalizer->setCamelizedAttributes(array('foo_bar'));
142-
$this->assertEquals($this->normalizer->normalize($obj), array(
143-
'kevinDunglas' => 'dunglas.fr',
144-
'foo_bar' => 'les-tilleuls.coop',
145-
'bar_foo' => 'lostinthesupermarket.fr',
146-
));
147-
}
148-
149-
/**
150-
* @group legacy
151-
*/
152-
public function testLegacyCamelizedAttributesDenormalize()
153-
{
154-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
155-
156-
$obj = new GetCamelizedDummy('dunglas.fr');
157-
$obj->setFooBar('les-tilleuls.coop');
158-
$obj->setBar_foo('lostinthesupermarket.fr');
159-
160-
$this->normalizer->setCamelizedAttributes(array('kevin_dunglas'));
161-
$this->assertEquals($this->normalizer->denormalize(array(
162-
'kevin_dunglas' => 'dunglas.fr',
163-
'fooBar' => 'les-tilleuls.coop',
164-
'bar_foo' => 'lostinthesupermarket.fr',
165-
), __NAMESPACE__.'\GetCamelizedDummy'), $obj);
166-
167-
$this->normalizer->setCamelizedAttributes(array('foo_bar'));
168-
$this->assertEquals($this->normalizer->denormalize(array(
169-
'kevinDunglas' => 'dunglas.fr',
170-
'foo_bar' => 'les-tilleuls.coop',
171-
'bar_foo' => 'lostinthesupermarket.fr',
172-
), __NAMESPACE__.'\GetCamelizedDummy'), $obj);
173-
}
174-
175107
public function testConstructorDenormalize()
176108
{
177109
$obj = $this->normalizer->denormalize(

src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,6 @@ public function testDenormalizeWithObject()
9696
$this->assertEquals('bar', $obj->bar);
9797
}
9898

99-
/**
100-
* @group legacy
101-
*/
102-
public function testLegacyDenormalizeOnCamelCaseFormat()
103-
{
104-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
105-
106-
$this->normalizer->setCamelizedAttributes(array('camel_case'));
107-
$obj = $this->normalizer->denormalize(
108-
array('camel_case' => 'camelCase'),
109-
__NAMESPACE__.'\ObjectDummy'
110-
);
111-
$this->assertEquals('camelCase', $obj->getCamelCase());
112-
}
113-
11499
public function testDenormalizeNull()
115100
{
116101
$this->assertEquals(new ObjectDummy(), $this->normalizer->denormalize(null, __NAMESPACE__.'\ObjectDummy'));

src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -62,73 +62,6 @@ public function testDenormalize()
6262
$this->assertEquals('bar', $obj->getBar());
6363
}
6464

65-
/**
66-
* @group legacy
67-
*/
68-
public function testLegacyDenormalizeOnCamelCaseFormat()
69-
{
70-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
71-
72-
$this->normalizer->setCamelizedAttributes(array('camel_case'));
73-
$obj = $this->normalizer->denormalize(
74-
array('camel_case' => 'value'),
75-
__NAMESPACE__.'\PropertyDummy'
76-
);
77-
$this->assertEquals('value', $obj->getCamelCase());
78-
}
79-
80-
/**
81-
* @group legacy
82-
*/
83-
public function testLegacyCamelizedAttributesNormalize()
84-
{
85-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
86-
87-
$obj = new PropertyCamelizedDummy('dunglas.fr');
88-
$obj->fooBar = 'les-tilleuls.coop';
89-
$obj->bar_foo = 'lostinthesupermarket.fr';
90-
91-
$this->normalizer->setCamelizedAttributes(array('kevin_dunglas'));
92-
$this->assertEquals($this->normalizer->normalize($obj), array(
93-
'kevin_dunglas' => 'dunglas.fr',
94-
'fooBar' => 'les-tilleuls.coop',
95-
'bar_foo' => 'lostinthesupermarket.fr',
96-
));
97-
98-
$this->normalizer->setCamelizedAttributes(array('foo_bar'));
99-
$this->assertEquals($this->normalizer->normalize($obj), array(
100-
'kevinDunglas' => 'dunglas.fr',
101-
'foo_bar' => 'les-tilleuls.coop',
102-
'bar_foo' => 'lostinthesupermarket.fr',
103-
));
104-
}
105-
106-
/**
107-
* @group legacy
108-
*/
109-
public function testLegacyCamelizedAttributesDenormalize()
110-
{
111-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
112-
113-
$obj = new PropertyCamelizedDummy('dunglas.fr');
114-
$obj->fooBar = 'les-tilleuls.coop';
115-
$obj->bar_foo = 'lostinthesupermarket.fr';
116-
117-
$this->normalizer->setCamelizedAttributes(array('kevin_dunglas'));
118-
$this->assertEquals($this->normalizer->denormalize(array(
119-
'kevin_dunglas' => 'dunglas.fr',
120-
'fooBar' => 'les-tilleuls.coop',
121-
'bar_foo' => 'lostinthesupermarket.fr',
122-
), __NAMESPACE__.'\PropertyCamelizedDummy'), $obj);
123-
124-
$this->normalizer->setCamelizedAttributes(array('foo_bar'));
125-
$this->assertEquals($this->normalizer->denormalize(array(
126-
'kevinDunglas' => 'dunglas.fr',
127-
'foo_bar' => 'les-tilleuls.coop',
128-
'bar_foo' => 'lostinthesupermarket.fr',
129-
), __NAMESPACE__.'\PropertyCamelizedDummy'), $obj);
130-
}
131-
13265
public function testConstructorDenormalize()
13366
{
13467
$obj = $this->normalizer->denormalize(

0 commit comments

Comments
 (0)
0