Skip to content

Commit 28984f1

Browse files
committed
[Serializer] Remove BC layer
1 parent 2a2c825 commit 28984f1

36 files changed

+70
-426
lines changed

.github/expected-missing-return-types.diff

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11875,24 +11875,24 @@ index b684fddb2f..ade2242791 100644
1187511875
{
1187611876
return $this->data;
1187711877
diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
11878-
index 079b1e7a9e..e3cfe43e67 100644
11878+
index efe4a6e0e1..fbf291af7e 100644
1187911879
--- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
1188011880
+++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
11881-
@@ -221,5 +221,5 @@ abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerIn
11881+
@@ -211,5 +211,5 @@ abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerIn
1188211882
* @throws LogicException if the 'allow_extra_attributes' context variable is false and no class metadata factory is provided
1188311883
*/
1188411884
- protected function getAllowedAttributes(string|object $classOrObject, array $context, bool $attributesAsString = false)
1188511885
+ protected function getAllowedAttributes(string|object $classOrObject, array $context, bool $attributesAsString = false): array|bool
1188611886
{
1188711887
$allowExtraAttributes = $context[self::ALLOW_EXTRA_ATTRIBUTES] ?? $this->defaultContext[self::ALLOW_EXTRA_ATTRIBUTES];
11888-
@@ -271,5 +271,5 @@ abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerIn
11888+
@@ -261,5 +261,5 @@ abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerIn
1188911889
* @return bool
1189011890
*/
1189111891
- protected function isAllowedAttribute(object|string $classOrObject, string $attribute, string $format = null, array $context = [])
1189211892
+ protected function isAllowedAttribute(object|string $classOrObject, string $attribute, string $format = null, array $context = []): bool
1189311893
{
1189411894
$ignoredAttributes = $context[self::IGNORED_ATTRIBUTES] ?? $this->defaultContext[self::IGNORED_ATTRIBUTES];
11895-
@@ -322,5 +322,5 @@ abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerIn
11895+
@@ -312,5 +312,5 @@ abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerIn
1189611896
* @throws MissingConstructorArgumentsException
1189711897
*/
1189811898
- protected function instantiateObject(array &$data, string $class, array &$context, \ReflectionClass $reflectionClass, array|bool $allowedAttributes, string $format = null)
@@ -11980,7 +11980,7 @@ index 48e8c3fb54..a71c3ea476 100644
1198011980
+ public function setDenormalizer(DenormalizerInterface $denormalizer): void;
1198111981
}
1198211982
diff --git a/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php b/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php
11983-
index 4edb70096d..8c844785db 100644
11983+
index 7faa516980..cb1855c209 100644
1198411984
--- a/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php
1198511985
+++ b/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php
1198611986
@@ -47,5 +47,5 @@ interface DenormalizerInterface
@@ -11998,10 +11998,10 @@ index 4edb70096d..8c844785db 100644
1199811998

1199911999
/**
1200012000
diff --git a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
12001-
index 063d34ea59..fb10337d35 100644
12001+
index 52a2daca91..99e06f844e 100644
1200212002
--- a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
1200312003
+++ b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
12004-
@@ -147,5 +147,5 @@ class GetSetMethodNormalizer extends AbstractObjectNormalizer
12004+
@@ -137,5 +137,5 @@ class GetSetMethodNormalizer extends AbstractObjectNormalizer
1200512005
* @return void
1200612006
*/
1200712007
- protected function setAttributeValue(object $object, string $attribute, mixed $value, string $format = null, array $context = [])
@@ -12030,7 +12030,7 @@ index 40a4fa0e8c..a1e2749aae 100644
1203012030
{
1203112031
$this->normalizer = $normalizer;
1203212032
diff --git a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php b/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php
12033-
index 40779de316..105cf99b06 100644
12033+
index b956e260b3..6382cde0c8 100644
1203412034
--- a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php
1203512035
+++ b/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php
1203612036
@@ -39,5 +39,5 @@ interface NormalizerInterface
@@ -12048,21 +12048,21 @@ index 40779de316..105cf99b06 100644
1204812048

1204912049
/**
1205012050
diff --git a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php
12051-
index 357c36426e..f4423f47f4 100644
12051+
index 2e61947c28..6b604baa04 100644
1205212052
--- a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php
1205312053
+++ b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php
12054-
@@ -146,5 +146,5 @@ class ObjectNormalizer extends AbstractObjectNormalizer
12054+
@@ -136,5 +136,5 @@ class ObjectNormalizer extends AbstractObjectNormalizer
1205512055
* @return void
1205612056
*/
1205712057
- protected function setAttributeValue(object $object, string $attribute, mixed $value, string $format = null, array $context = [])
1205812058
+ protected function setAttributeValue(object $object, string $attribute, mixed $value, string $format = null, array $context = []): void
1205912059
{
1206012060
try {
1206112061
diff --git a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php
12062-
index ec12db9bb2..d3b7f036a8 100644
12062+
index 39810e10c9..57e2adbdd5 100644
1206312063
--- a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php
1206412064
+++ b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php
12065-
@@ -187,5 +187,5 @@ class PropertyNormalizer extends AbstractObjectNormalizer
12065+
@@ -177,5 +177,5 @@ class PropertyNormalizer extends AbstractObjectNormalizer
1206612066
* @return void
1206712067
*/
1206812068
- protected function setAttributeValue(object $object, string $attribute, mixed $value, string $format = null, array $context = [])

src/Symfony/Component/Messenger/Transport/Serialization/Normalizer/FlattenExceptionNormalizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Symfony\Component\ErrorHandler\Exception\FlattenException;
1515
use Symfony\Component\Messenger\Transport\Serialization\Serializer;
16-
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
16+
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
1717
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
1818
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
1919

@@ -22,7 +22,7 @@
2222
*
2323
* @author Pascal Luna <[email protected]>
2424
*/
25-
final class FlattenExceptionNormalizer implements DenormalizerInterface, ContextAwareNormalizerInterface
25+
final class FlattenExceptionNormalizer implements DenormalizerInterface, NormalizerInterface
2626
{
2727
use NormalizerAwareTrait;
2828

src/Symfony/Component/Serializer/Debug/TraceableNormalizer.php

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,16 @@
2727
*
2828
* @internal
2929
*/
30-
class TraceableNormalizer implements NormalizerInterface, DenormalizerInterface, SerializerAwareInterface, NormalizerAwareInterface, DenormalizerAwareInterface, CacheableSupportsMethodInterface
30+
class TraceableNormalizer implements NormalizerInterface, DenormalizerInterface, SerializerAwareInterface, NormalizerAwareInterface, DenormalizerAwareInterface
3131
{
3232
public function __construct(
3333
private NormalizerInterface|DenormalizerInterface $normalizer,
3434
private SerializerDataCollector $dataCollector,
3535
) {
36-
if (!method_exists($normalizer, 'getSupportedTypes')) {
37-
trigger_deprecation('symfony/serializer', '6.3', 'Not implementing the "NormalizerInterface::getSupportedTypes()" in "%s" is deprecated.', get_debug_type($normalizer));
38-
}
3936
}
4037

4138
public function getSupportedTypes(?string $format): array
4239
{
43-
// @deprecated remove condition in 7.0
44-
if (!method_exists($this->normalizer, 'getSupportedTypes')) {
45-
return ['*' => $this->normalizer instanceof CacheableSupportsMethodInterface && $this->normalizer->hasCacheableSupportsMethod()];
46-
}
47-
4840
return $this->normalizer->getSupportedTypes($format);
4941
}
5042

@@ -127,16 +119,6 @@ public function setDenormalizer(DenormalizerInterface $denormalizer): void
127119
$this->normalizer->setDenormalizer($denormalizer);
128120
}
129121

130-
/**
131-
* @deprecated since Symfony 6.3, use "getSupportedTypes()" instead
132-
*/
133-
public function hasCacheableSupportsMethod(): bool
134-
{
135-
trigger_deprecation('symfony/serializer', '6.3', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);
136-
137-
return $this->normalizer instanceof CacheableSupportsMethodInterface && $this->normalizer->hasCacheableSupportsMethod();
138-
}
139-
140122
/**
141123
* Proxies all method calls to the original normalizer.
142124
*/

src/Symfony/Component/Serializer/Debug/TraceableSerializer.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Symfony\Component\Serializer\DataCollector\SerializerDataCollector;
1515
use Symfony\Component\Serializer\Encoder\DecoderInterface;
1616
use Symfony\Component\Serializer\Encoder\EncoderInterface;
17-
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
1817
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
1918
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
2019
use Symfony\Component\Serializer\SerializerInterface;
@@ -34,9 +33,6 @@ public function __construct(
3433
private SerializerInterface&NormalizerInterface&DenormalizerInterface&EncoderInterface&DecoderInterface $serializer,
3534
private SerializerDataCollector $dataCollector,
3635
) {
37-
if (!method_exists($serializer, 'getSupportedTypes')) {
38-
trigger_deprecation('symfony/serializer', '6.3', 'Not implementing the "NormalizerInterface::getSupportedTypes()" in "%s" is deprecated.', get_debug_type($serializer));
39-
}
4036
}
4137

4238
public function serialize(mixed $data, string $format, array $context = []): string
@@ -131,11 +127,6 @@ public function decode(string $data, string $format, array $context = []): mixed
131127

132128
public function getSupportedTypes(?string $format): array
133129
{
134-
// @deprecated remove condition in 7.0
135-
if (!method_exists($this->serializer, 'getSupportedTypes')) {
136-
return ['*' => $this->serializer instanceof CacheableSupportsMethodInterface && $this->serializer->hasCacheableSupportsMethod()];
137-
}
138-
139130
return $this->serializer->getSupportedTypes($format);
140131
}
141132

src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,8 @@ public function getMaxDepth(): ?int
110110
return $this->maxDepth;
111111
}
112112

113-
public function setSerializedName(string $serializedName = null): void
113+
public function setSerializedName(?string $serializedName): void
114114
{
115-
if (1 > \func_num_args()) {
116-
trigger_deprecation('symfony/serializer', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
117-
}
118-
119115
$this->serializedName = $serializedName;
120116
}
121117

src/Symfony/Component/Serializer/Mapping/ClassMetadata.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,8 @@ public function getClassDiscriminatorMapping(): ?ClassDiscriminatorMapping
9090
return $this->classDiscriminatorMapping;
9191
}
9292

93-
public function setClassDiscriminatorMapping(ClassDiscriminatorMapping $mapping = null): void
93+
public function setClassDiscriminatorMapping(?ClassDiscriminatorMapping $mapping): void
9494
{
95-
if (1 > \func_num_args()) {
96-
trigger_deprecation('symfony/serializer', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
97-
}
9895
$this->classDiscriminatorMapping = $mapping;
9996
}
10097

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*
2929
* @author Kévin Dunglas <[email protected]>
3030
*/
31-
abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerInterface, SerializerAwareInterface, CacheableSupportsMethodInterface
31+
abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerInterface, SerializerAwareInterface
3232
{
3333
use ObjectToPopulateTrait;
3434
use SerializerAwareTrait;
@@ -156,16 +156,6 @@ public function __construct(ClassMetadataFactoryInterface $classMetadataFactory
156156
}
157157
}
158158

159-
/**
160-
* @deprecated since Symfony 6.3, use "getSupportedTypes()" instead
161-
*/
162-
public function hasCacheableSupportsMethod(): bool
163-
{
164-
trigger_deprecation('symfony/serializer', '6.3', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);
165-
166-
return false;
167-
}
168-
169159
/**
170160
* Detects if the configured circular reference limit is reached.
171161
*

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

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,12 @@
2323
*
2424
* @final
2525
*/
26-
class ArrayDenormalizer implements ContextAwareDenormalizerInterface, DenormalizerAwareInterface, CacheableSupportsMethodInterface
26+
class ArrayDenormalizer implements DenormalizerInterface, DenormalizerAwareInterface
2727
{
2828
use DenormalizerAwareTrait;
2929

3030
public function setDenormalizer(DenormalizerInterface $denormalizer): void
3131
{
32-
if (!method_exists($denormalizer, 'getSupportedTypes')) {
33-
trigger_deprecation('symfony/serializer', '6.3', 'Not implementing the "DenormalizerInterface::getSupportedTypes()" in "%s" is deprecated.', get_debug_type($denormalizer));
34-
}
35-
3632
$this->denormalizer = $denormalizer;
3733
}
3834

@@ -82,14 +78,4 @@ public function supportsDenormalization(mixed $data, string $type, string $forma
8278
return str_ends_with($type, '[]')
8379
&& $this->denormalizer->supportsDenormalization($data, substr($type, 0, -2), $format, $context);
8480
}
85-
86-
/**
87-
* @deprecated since Symfony 6.3, use "getSupportedTypes()" instead
88-
*/
89-
public function hasCacheableSupportsMethod(): bool
90-
{
91-
trigger_deprecation('symfony/serializer', '6.3', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);
92-
93-
return $this->denormalizer instanceof CacheableSupportsMethodInterface && $this->denormalizer->hasCacheableSupportsMethod();
94-
}
9581
}

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @author Alexandre Daubois <[email protected]>
2222
*/
23-
final class BackedEnumNormalizer implements NormalizerInterface, DenormalizerInterface, CacheableSupportsMethodInterface
23+
final class BackedEnumNormalizer implements NormalizerInterface, DenormalizerInterface
2424
{
2525
/**
2626
* If true, will denormalize any invalid value into null.
@@ -88,14 +88,4 @@ public function supportsDenormalization(mixed $data, string $type, string $forma
8888
{
8989
return is_subclass_of($type, \BackedEnum::class);
9090
}
91-
92-
/**
93-
* @deprecated since Symfony 6.3, use "getSupportedTypes()" instead
94-
*/
95-
public function hasCacheableSupportsMethod(): bool
96-
{
97-
trigger_deprecation('symfony/serializer', '6.3', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);
98-
99-
return true;
100-
}
10191
}

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

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

0 commit comments

Comments
 (0)