Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5003f09

Browse filesBrowse files
committed
[Serializer] Remove support for deprecated signatures
1 parent d8594de commit 5003f09
Copy full SHA for 5003f09

File tree

3 files changed

+5
-73
lines changed
Filter options

3 files changed

+5
-73
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
+1-14Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -302,21 +302,8 @@ protected function getConstructor(array &$data, $class, array &$context, \Reflec
302302
*
303303
* @throws RuntimeException
304304
*/
305-
protected function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes/*, $format = null*/)
305+
protected function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, ?string $format = null)
306306
{
307-
if (func_num_args() >= 6) {
308-
$format = func_get_arg(5);
309-
} else {
310-
if (__CLASS__ !== get_class($this)) {
311-
$r = new \ReflectionMethod($this, __FUNCTION__);
312-
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
313-
@trigger_error(sprintf('Method %s::%s() will have a 6th `$format = null` argument in version 4.0. Not defining it is deprecated since 3.2.', get_class($this), __FUNCTION__), E_USER_DEPRECATED);
314-
}
315-
}
316-
317-
$format = null;
318-
}
319-
320307
if (
321308
isset($context[static::OBJECT_TO_POPULATE]) &&
322309
is_object($context[static::OBJECT_TO_POPULATE]) &&

‎src/Symfony/Component/Serializer/Serializer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Serializer.php
+4-56Lines changed: 4 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -177,42 +177,16 @@ public function denormalize($data, $type, $format = null, array $context = array
177177
/**
178178
* {@inheritdoc}
179179
*/
180-
public function supportsNormalization($data, $format = null/*, array $context = array()*/)
180+
public function supportsNormalization($data, $format = null, array $context = array())
181181
{
182-
if (func_num_args() > 2) {
183-
$context = func_get_arg(2);
184-
} else {
185-
if (__CLASS__ !== get_class($this)) {
186-
$r = new \ReflectionMethod($this, __FUNCTION__);
187-
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
188-
@trigger_error(sprintf('Method %s() will have a third `$context = array()` argument in version 4.0. Not defining it is deprecated since 3.3.', __METHOD__), E_USER_DEPRECATED);
189-
}
190-
}
191-
192-
$context = array();
193-
}
194-
195182
return null !== $this->getNormalizer($data, $format, $context);
196183
}
197184

198185
/**
199186
* {@inheritdoc}
200187
*/
201-
public function supportsDenormalization($data, $type, $format = null/*, array $context = array()*/)
188+
public function supportsDenormalization($data, $type, $format = null, array $context = array())
202189
{
203-
if (func_num_args() > 3) {
204-
$context = func_get_arg(3);
205-
} else {
206-
if (__CLASS__ !== get_class($this)) {
207-
$r = new \ReflectionMethod($this, __FUNCTION__);
208-
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
209-
@trigger_error(sprintf('Method %s() will have a fourth `$context = array()` argument in version 4.0. Not defining it is deprecated since 3.3.', __METHOD__), E_USER_DEPRECATED);
210-
}
211-
}
212-
213-
$context = array();
214-
}
215-
216190
return null !== $this->getDenormalizer($data, $type, $format, $context);
217191
}
218192

@@ -298,42 +272,16 @@ private function denormalizeObject($data, $class, $format, array $context = arra
298272
/**
299273
* {@inheritdoc}
300274
*/
301-
public function supportsEncoding($format/*, array $context = array()*/)
275+
public function supportsEncoding($format, array $context = array())
302276
{
303-
if (func_num_args() > 1) {
304-
$context = func_get_arg(1);
305-
} else {
306-
if (__CLASS__ !== get_class($this)) {
307-
$r = new \ReflectionMethod($this, __FUNCTION__);
308-
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
309-
@trigger_error(sprintf('Method %s() will have a second `$context = array()` argument in version 4.0. Not defining it is deprecated since 3.3.', __METHOD__), E_USER_DEPRECATED);
310-
}
311-
}
312-
313-
$context = array();
314-
}
315-
316277
return $this->encoder->supportsEncoding($format, $context);
317278
}
318279

319280
/**
320281
* {@inheritdoc}
321282
*/
322-
public function supportsDecoding($format/*, array $context = array()*/)
283+
public function supportsDecoding($format, array $context = array())
323284
{
324-
if (func_num_args() > 1) {
325-
$context = func_get_arg(1);
326-
} else {
327-
if (__CLASS__ !== get_class($this)) {
328-
$r = new \ReflectionMethod($this, __FUNCTION__);
329-
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
330-
@trigger_error(sprintf('Method %s() will have a second `$context = array()` argument in version 4.0. Not defining it is deprecated since 3.3.', __METHOD__), E_USER_DEPRECATED);
331-
}
332-
}
333-
334-
$context = array();
335-
}
336-
337285
return $this->decoder->supportsDecoding($format, $context);
338286
}
339287
}

‎src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ public function testDenormalize()
2626
$this->assertSame('baz', $normalizedData->baz);
2727
}
2828

29-
/**
30-
* @group legacy
31-
*/
3229
public function testInstantiateObjectDenormalizer()
3330
{
3431
$data = array('foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.