23
23
*
24
24
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
25
25
*
26
- * @final
27
26
* @internal
28
27
*/
29
28
class TraceableSerializer implements SerializerInterface, NormalizerInterface, DenormalizerInterface, EncoderInterface, DecoderInterface
30
29
{
31
30
public const DEBUG_TRACE_ID = 'debug_trace_id ' ;
32
31
32
+ /**
33
+ * @param SerializerInterface&NormalizerInterface&DenormalizerInterface&EncoderInterface&DecoderInterface $serializer
34
+ */
33
35
public function __construct (
34
- private SerializerInterface & NormalizerInterface & DenormalizerInterface & EncoderInterface & DecoderInterface $ serializer ,
36
+ private SerializerInterface $ serializer ,
35
37
private SerializerDataCollector $ dataCollector ,
36
38
) {
37
39
}
38
40
39
41
/**
40
42
* {@inheritdoc}
41
43
*/
42
- final public function serialize (mixed $ data , string $ format , array $ context = []): string
44
+ public function serialize (mixed $ data , string $ format , array $ context = []): string
43
45
{
44
46
$ context [self ::DEBUG_TRACE_ID ] = $ traceId = uniqid ();
45
47
@@ -55,7 +57,7 @@ final public function serialize(mixed $data, string $format, array $context = []
55
57
/**
56
58
* {@inheritdoc}
57
59
*/
58
- final public function deserialize (mixed $ data , string $ type , string $ format , array $ context = []): mixed
60
+ public function deserialize (mixed $ data , string $ type , string $ format , array $ context = []): mixed
59
61
{
60
62
$ context [self ::DEBUG_TRACE_ID ] = $ traceId = uniqid ();
61
63
@@ -71,7 +73,7 @@ final public function deserialize(mixed $data, string $type, string $format, arr
71
73
/**
72
74
* {@inheritdoc}
73
75
*/
74
- final public function normalize (mixed $ object , string $ format = null , array $ context = []): array |string |int |float |bool |\ArrayObject |null
76
+ public function normalize (mixed $ object , string $ format = null , array $ context = []): array |string |int |float |bool |\ArrayObject |null
75
77
{
76
78
$ context [self ::DEBUG_TRACE_ID ] = $ traceId = uniqid ();
77
79
@@ -87,7 +89,7 @@ final public function normalize(mixed $object, string $format = null, array $con
87
89
/**
88
90
* {@inheritdoc}
89
91
*/
90
- final public function denormalize (mixed $ data , string $ type , string $ format = null , array $ context
57AE
= []): mixed
92
+ public function denormalize (mixed $ data , string $ type , string $ format = null , array $ context = []): mixed
91
93
{
92
94
$ context [self ::DEBUG_TRACE_ID ] = $ traceId = uniqid ();
93
95
@@ -103,7 +105,7 @@ final public function denormalize(mixed $data, string $type, string $format = nu
103
105
/**
104
106
* {@inheritdoc}
105
107
*/
106
- final public function encode (mixed $ data , string $ format , array $ context = []): string
108
+ public function encode (mixed $ data , string $ format , array $ context = []): string
107
109
{
108
110
$ context [self ::DEBUG_TRACE_ID ] = $ traceId = uniqid ();
109
111
@@ -119,7 +121,7 @@ final public function encode(mixed $data, string $format, array $context = []):
119
121
/**
120
122
* {@inheritdoc}
121
123
*/
122
- final public function decode (string $ data , string $ format , array $ context = []): mixed
124
+ public function decode (string $ data , string $ format , array $ context = []): mixed
123
125
{
124
126
$ context [self ::DEBUG_TRACE_ID ] = $ traceId = uniqid ();
125
127
@@ -134,49 +136,33 @@ final public function decode(string $data, string $format, array $context = []):
134
136
135
137
/**
136
138
* {@inheritdoc}
137
- *
138
- * @param array $context
139
139
*/
140
- final public function supportsNormalization (mixed $ data , string $ format = null /* , array $context = [] */ ): bool
140
+ public function supportsNormalization (mixed $ data , string $ format = null , array $ context = []): bool
141
141
{
142
- $ context = \func_num_args () > 2 ? \func_get_arg (2 ) : [];
143
-
144
142
return $ this ->serializer ->supportsNormalization ($ data , $ format , $ context );
145
143
}
146
144
147
145
/**
148
146
* {@inheritdoc}
149
- *
150
- * @param array $context
151
147
*/
152
- final public function supportsDenormalization (mixed $ data , string $ type , string $ format = null /* , array $context = [] */ ): bool
148
+ public function supportsDenormalization (mixed $ data , string $ type , string $ format = null , array $ context = []): bool
153
149
{
154
- $ context = \func_num_args () > 3 ? \func_get_arg (3 ) : [];
155
-
156
150
return $ this ->serializer ->supportsDenormalization ($ data , $ type , $ format , $ context );
157
151
}
158
152
159
153
/**
160
154
* {@inheritdoc}
161
- *
162
- * @param array $context
163
155
*/
164
- final public function supportsEncoding (string $ format /* , array $context = [] */ ): bool
156
+ public function supportsEncoding (string $ format , array $ context = []): bool
165
157
{
166
- $ context = \func_num_args () > 1 ? \func_get_arg (1 ) : [];
167
-
168
158
return $ this ->serializer ->supportsEncoding ($ format , $ context );
169
159
}
170
160
171
161
/**
172
162
* {@inheritdoc}
173
- *
174
- * @param array $context
175
163
*/
176
- final public function supportsDecoding (string $ format /* , array $context = [] */ ): bool
164
+ public function supportsDecoding (string $ format , array $ context = []): bool
177
165
{
178
- $ context = \func_num_args () > 1 ? \func_get_arg (1 ) : [];
179
-
180
166
return $ this ->serializer ->supportsDecoding ($ format , $ context );
181
167
}
182
168
}
0 commit comments