Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 25b94bc

Browse files
committed
[Serializer] Trigger depreciations on hasCacheableSupportsMethod calls
1 parent fb0db56 commit 25b94bc

12 files changed

+38
-14
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class BackedEnumNormalizer implements NormalizerInterface, DenormalizerInt
2525
public function getSupportedTypes(): array
2626
{
2727
return [
28-
\BackedEnum::class => $this->hasCacheableSupportsMethod(),
28+
\BackedEnum::class => true,
2929
];
3030
}
3131

@@ -70,6 +70,8 @@ public function supportsDenormalization(mixed $data, string $type, string $forma
7070

7171
public function hasCacheableSupportsMethod(): bool
7272
{
73+
trigger_deprecation('symfony/serializer', '6.3', 'CacheableSupportsMethodInterface::hasCacheableSupportsMethod() is deprecated, use "getSupportedTypes()" return value instead.');
74+
7375
return true;
7476
}
7577
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(array $defaultContext = [], NameConverterInterface $
4242
public function getSupportedTypes(): ?array
4343
{
4444
return [
45-
ConstraintViolationListInterface::class => $this->hasCacheableSupportsMethod(),
45+
ConstraintViolationListInterface::class => __CLASS__ == static::class,
4646
];
4747
}
4848

@@ -118,6 +118,8 @@ public function supportsNormalization(mixed $data, string $format = null /* , ar
118118

119119
public function hasCacheableSupportsMethod(): bool
120120
{
121+
trigger_deprecation('symfony/serializer', '6.3', 'CacheableSupportsMethodInterface::hasCacheableSupportsMethod() is deprecated, use "getSupportedTypes()" return value instead.');
122+
121123
return __CLASS__ === static::class;
122124
}
123125
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CustomNormalizer implements NormalizerInterface, DenormalizerInterface, Se
2525
public function getSupportedTypes(): array
2626
{
2727
return [
28-
NormalizableInterface::class => $this->hasCacheableSupportsMethod(),
28+
NormalizableInterface::class => __CLASS__ === static::class,
2929
];
3030
}
3131

@@ -69,6 +69,8 @@ public function supportsDenormalization(mixed $data, string $type, string $forma
6969

7070
public function hasCacheableSupportsMethod(): bool
7171
{
72+
trigger_deprecation('symfony/serializer', '6.3', 'CacheableSupportsMethodInterface::hasCacheableSupportsMethod() is deprecated, use "getSupportedTypes()" return value instead.');
73+
7274
return __CLASS__ === static::class;
7375
}
7476
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ public function supportsDenormalization(mixed $data, string $type, string $forma
125125

126126
public function hasCacheableSupportsMethod(): bool
127127
{
128+
trigger_deprecation('symfony/serializer', '6.3', 'CacheableSupportsMethodInterface::hasCacheableSupportsMethod() is deprecated, use "getSupportedTypes()" return value instead.');
129+
128130
return __CLASS__ === static::class;
129131
}
130132

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(array $defaultContext = [])
3636
public function getSupportedTypes(): array
3737
{
3838
return [
39-
\DateInterval::class => $this->hasCacheableSupportsMethod(),
39+
\DateInterval::class => __CLASS__ === static::class,
4040
];
4141
}
4242

@@ -62,6 +62,8 @@ public function supportsNormalization(mixed $data, string $format = null /* , ar
6262

6363
public function hasCacheableSupportsMethod(): bool
6464
{
65+
trigger_deprecation('symfony/serializer', '6.3', 'CacheableSupportsMethodInterface::hasCacheableSupportsMethod() is deprecated, use "getSupportedTypes()" return value instead.');
66+
6567
return __CLASS__ === static::class;
6668
}
6769

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ public function supportsDenormalization(mixed $data, string $type, string $forma
131131

132132
public function hasCacheableSupportsMethod(): bool
133133
{
134+
trigger_deprecation('symfony/serializer', '6.3', 'CacheableSupportsMethodInterface::hasCacheableSupportsMethod() is deprecated, use "getSupportedTypes()" return value instead.');
135+
134136
return __CLASS__ === static::class;
135137
}
136138

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DateTimeZoneNormalizer implements NormalizerInterface, DenormalizerInterfa
2525
public function getSupportedTypes(): array
2626
{
2727
return [
28-
\DateTimeZone::class => $this->hasCacheableSupportsMethod(),
28+
\DateTimeZone::class => __CLASS__ === static::class,
2929
];
3030
}
3131

@@ -75,6 +75,8 @@ public function supportsDenormalization(mixed $data, string $type, string $forma
7575

7676
public function hasCacheableSupportsMethod(): bool
7777
{
78+
trigger_deprecation('symfony/serializer', '6.3', 'CacheableSupportsMethodInterface::hasCacheableSupportsMethod() is deprecated, use "getSupportedTypes()" return value instead.');
79+
7880
return __CLASS__ === static::class;
7981
}
8082
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function normalize(mixed $object, string $format = null, array $context =
4141
public function getSupportedTypes(): array
4242
{
4343
return [
44-
FormInterface::class => $this->hasCacheableSupportsMethod(),
44+
FormInterface::class => __CLASS__ == self::class,
4545
];
4646
}
4747

@@ -85,6 +85,8 @@ private function convertFormChildrenToArray(FormInterface $data): array
8585

8686
public function hasCacheableSupportsMethod(): bool
8787
{
88+
trigger_deprecation('symfony/serializer', '6.3', 'CacheableSupportsMethodInterface::hasCacheableSupportsMethod() is deprecated, use "getSupportedTypes()" return value instead.');
89+
8890
return __CLASS__ === static::class;
8991
}
9092
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function normalize(mixed $object, string $format = null, array $context =
4141
public function getSupportedTypes(): array
4242
{
4343
return [
44-
\JsonSerializable::class => $this->hasCacheableSupportsMethod(),
44+
\JsonSerializable::class => __CLASS__ === static::class,
4545
];
4646
}
4747

@@ -68,6 +68,8 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
6868

6969
public function hasCacheableSupportsMethod(): bool
7070
{
71+
trigger_deprecation('symfony/serializer', '6.3', 'CacheableSupportsMethodInterface::hasCacheableSupportsMethod() is deprecated, use "getSupportedTypes()" return value instead.');
72+
7173
return __CLASS__ === static::class;
7274
}
7375
}

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ public function __construct(PropertyNormalizer $normalizer)
4545
public function getSupportedTypes(): array
4646
{
4747
return [
48-
Message::class => $this->hasCacheableSupportsMethod(),
49-
Headers::class => $this->hasCacheableSupportsMethod(),
50-
HeaderInterface::class => $this->hasCacheableSupportsMethod(),
51-
Address::class => $this->hasCacheableSupportsMethod(),
52-
AbstractPart::class => $this->hasCacheableSupportsMethod(),
48+
Message::class => true,
49+
Headers::class => true,
50+
HeaderInterface::class => true,
51+
Address::class => true,
52+
AbstractPart::class => true,
5353
];
5454
}
5555

@@ -114,6 +114,8 @@ public function supportsDenormalization(mixed $data, string $type, string $forma
114114

115115
public function hasCacheableSupportsMethod(): bool
116116
{
117+
trigger_deprecation('symfony/serializer', '6.3', 'CacheableSupportsMethodInterface::hasCacheableSupportsMethod() is deprecated, use "getSupportedTypes()" return value instead.');
118+
117119
return __CLASS__ === static::class;
118120
}
119121
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(bool $debug = false, array $defaultContext = [])
4343
public function getSupportedTypes(): array
4444
{
4545
return [
46-
FlattenException::class => $this->hasCacheableSupportsMethod(),
46+
FlattenException::class => __CLASS__ === self::class,
4747
];
4848
}
4949

@@ -80,6 +80,8 @@ public function supportsNormalization(mixed $data, string $format = null /* , ar
8080

8181
public function hasCacheableSupportsMethod(): bool
8282
{
83+
trigger_deprecation('symfony/serializer', '6.3', 'CacheableSupportsMethodInterface::hasCacheableSupportsMethod() is deprecated, use "getSupportedTypes()" return value instead.');
84+
8385
return true;
8486
}
8587
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(array $defaultContext = [])
4444
public function getSupportedTypes(): array
4545
{
4646
return [
47-
AbstractUid::class => $this->hasCacheableSupportsMethod(),
47+
AbstractUid::class => true,
4848
];
4949
}
5050

@@ -101,6 +101,8 @@ public function supportsDenormalization(mixed $data, string $type, string $forma
101101

102102
public function hasCacheableSupportsMethod(): bool
103103
{
104+
trigger_deprecation('symfony/serializer', '6.3', 'CacheableSupportsMethodInterface::hasCacheableSupportsMethod() is deprecated, use "getSupportedTypes()" return value instead.');
105+
104106
return __CLASS__ === static::class;
105107
}
106108
}

0 commit comments

Comments
 (0)