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

Skip to content

Commit ab72f80

Browse files
committed
Merge context aware interfaces into regular ones
1 parent 0d6e859 commit ab72f80

36 files changed

+146
-58
lines changed

UPGRADE-6.1.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
UPGRADE FROM 6.0 to 6.1
2+
=======================
3+
4+
Serializer
5+
----------
6+
7+
* Deprecate `ContextAwareNormalizerInterface`, use `NormalizerInterface` instead
8+
* Deprecate `ContextAwareDenormalizerInterface`, use `DenormalizerInterface` instead
9+
* Deprecate `ContextAwareEncoderInterface`, use `EncoderInterface` instead
10+
* Deprecate `ContextAwareDecoderInterface`, use `DecoderInterface` instead

src/Symfony/Component/Serializer/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
CHANGELOG
22
=========
33

4+
6.1
5+
---
6+
7+
* Deprecate `ContextAwareNormalizerInterface`, use `NormalizerInterface` instead
8+
* Deprecate `ContextAwareDenormalizerInterface`, use `DenormalizerInterface` instead
9+
* Deprecate `ContextAwareEncoderInterface`, use `EncoderInterface` instead
10+
* Deprecate `ContextAwareDecoderInterface`, use `DecoderInterface` instead
11+
412
6.0
513
---
614

src/Symfony/Component/Serializer/Encoder/ContextAwareDecoderInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* Adds the support of an extra $context parameter for the supportsDecoding method.
1616
*
1717
* @author Kévin Dunglas <[email protected]>
18+
*
19+
* @deprecated since symfony/serializer 6.1, use DecoderInterface instead
1820
*/
1921
interface ContextAwareDecoderInterface extends DecoderInterface
2022
{

src/Symfony/Component/Serializer/Encoder/ContextAwareEncoderInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* Adds the support of an extra $context parameter for the supportsEncoding method.
1616
*
1717
* @author Kévin Dunglas <[email protected]>
18+
*
19+
* @deprecated since symfony/serializer 6.1, use EncoderInterface instead
1820
*/
1921
interface ContextAwareEncoderInterface extends EncoderInterface
2022
{

src/Symfony/Component/Serializer/Encoder/CsvEncoder.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,10 @@ public function encode(mixed $data, string $format, array $context = []): string
123123

124124
/**
125125
* {@inheritdoc}
126+
*
127+
* @param array $context
126128
*/
127-
public function supportsEncoding(string $format): bool
129+
public function supportsEncoding(string $format /*, array $context = [] */): bool
128130
{
129131
return self::FORMAT === $format;
130132
}
@@ -209,8 +211,10 @@ public function decode(string $data, string $format, array $context = []): mixed
209211

210212
/**
211213
* {@inheritdoc}
214+
*
215+
* @param array $context
212216
*/
213-
public function supportsDecoding(string $format): bool
217+
public function supportsDecoding(string $format /*, array $context = [] */): bool
214218
{
215219
return self::FORMAT === $format;
216220
}

src/Symfony/Component/Serializer/Encoder/DecoderInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ public function decode(string $data, string $format, array $context = []);
4040
* Checks whether the deserializer can decode from given format.
4141
*
4242
* @param string $format Format name
43+
* @param array $context Options that decoders have access to
4344
*
4445
* @return bool
4546
*/
46-
public function supportsDecoding(string $format);
47+
public function supportsDecoding(string $format /*, array $context = [] */);
4748
}

src/Symfony/Component/Serializer/Encoder/EncoderInterface.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public function encode(mixed $data, string $format, array $context = []): string
3232
/**
3333
* Checks whether the serializer can encode to given format.
3434
*
35-
* @param string $format Format name
35+
* @param string $format Format name
36+
* @param array $context Options that normalizers/encoders have access to
3637
*/
37-
public function supportsEncoding(string $format): bool;
38+
public function supportsEncoding(string $format /*, array $context = [] */): bool;
3839
}

src/Symfony/Component/Serializer/Encoder/JsonDecode.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ public function decode(string $data, string $format, array $context = []): mixed
9595

9696
/**
9797
* {@inheritdoc}
98+
*
99+
* @param array $context
98100
*/
99-
public function supportsDecoding(string $format): bool
101+
public function supportsDecoding(string $format /*, array $context = [] */): bool
100102
{
101103
return JsonEncoder::FORMAT === $format;
102104
}

src/Symfony/Component/Serializer/Encoder/JsonEncode.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ public function encode(mixed $data, string $format, array $context = []): string
5757

5858
/**
5959
* {@inheritdoc}
60+
*
61+
* @param array $context
6062
*/
61-
public function supportsEncoding(string $format): bool
63+
public function supportsEncoding(string $format /*, array $context = [] */): bool
6264
{
6365
return JsonEncoder::FORMAT === $format;
6466
}

src/Symfony/Component/Serializer/Encoder/JsonEncoder.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,20 @@ public function decode(string $data, string $format, array $context = []): mixed
4747

4848
/**
4949
* {@inheritdoc}
50+
*
51+
* @param array $context
5052
*/
51-
public function supportsEncoding(string $format): bool
53+
public function supportsEncoding(string $format /*, array $context = [] */): bool
5254
{
5355
return self::FORMAT === $format;
5456
}
5557

5658
/**
5759
* {@inheritdoc}
60+
*
61+
* @param array $context
5862
*/
59-
public function supportsDecoding(string $format): bool
63+
public function supportsDecoding(string $format /*, array $context = [] */): bool
6064
{
6165
return self::FORMAT === $format;
6266
}

0 commit comments

Comments
 (0)