Skip to content

Commit ea7fe34

Browse files
[Serializer] code cleanup
1 parent d7f0d76 commit ea7fe34

File tree

3 files changed

+8
-36
lines changed

3 files changed

+8
-36
lines changed

Debug/TraceableEncoder.php

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

5656
/**
5757
* {@inheritDoc}
58-
*
59-
* @param array $context
6058
*/
61-
public function supportsEncoding(string $format /*, array $context = [] */): bool
59+
public function supportsEncoding(string $format, array $context = []): bool
6260
{
6361
if (!$this->encoder instanceof EncoderInterface) {
6462
return false;
6563
}
6664

67-
$context = \func_num_args() > 1 ? func_get_arg(1) : [];
68-
6965
return $this->encoder->supportsEncoding($format, $context);
7066
}
7167

@@ -91,17 +87,13 @@ public function decode(string $data, string $format, array $context = []): mixed
9187

9288
/**
9389
* {@inheritDoc}
94-
*
95-
* @param array $context
9690
*/
97-
public function supportsDecoding(string $format /*, array $context = [] */): bool
91+
public function supportsDecoding(string $format, array $context = []): bool
9892
{
9993
if (!$this->encoder instanceof DecoderInterface) {
10094
return false;
10195
}
10296

103-
$context = \func_num_args() > 1 ? func_get_arg(1) : [];
104-
10597
return $this->encoder->supportsDecoding($format, $context);
10698
}
10799

Debug/TraceableNormalizer.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,13 @@ public function normalize(mixed $object, string $format = null, array $context =
5757

5858
/**
5959
* {@inheritDoc}
60-
*
61-
* @param array $context
6260
*/
63-
public function supportsNormalization(mixed $data, string $format = null /*, array $context = [] */): bool
61+
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
6462
{
6563
if (!$this->normalizer instanceof NormalizerInterface) {
6664
return false;
6765
}
6866

69-
$context = \func_num_args() > 2 ? func_get_arg(2) : [];
70-
7167
return $this->normalizer->supportsNormalization($data, $format, $context);
7268
}
7369

@@ -93,17 +89,13 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
9389

9490
/**
9591
* {@inheritDoc}
96-
*
97-
* @param array $context
9892
*/
99-
public function supportsDenormalization(mixed $data, string $type, string $format = null /*, array $context = [] */): bool
93+
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
10094
{
10195
if (!$this->normalizer instanceof DenormalizerInterface) {
10296
return false;
10397
}
10498

105-
$context = \func_num_args() > 3 ? func_get_arg(3) : [];
106-
10799
return $this->normalizer->supportsDenormalization($data, $type, $format, $context);
108100
}
109101

Tests/Debug/TraceableSerializerTest.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,7 @@ public function normalize(mixed $object, string $format = null, array $context =
145145
return 'normalized';
146146
}
147147

148-
/**
149-
* @param array $context
150-
*/
151-
public function supportsNormalization(mixed $data, string $format = null /*, array $context = [] */): bool
148+
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
152149
{
153150
return true;
154151
}
@@ -158,10 +155,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
158155
return 'denormalized';
159156
}
160157

161-
/**
162-
* @param array $context
163-
*/
164-
public function supportsDenormalization(mixed $data, string $type, string $format = null /*, array $context = [] */): bool
158+
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
165159
{
166160
return true;
167161
}
@@ -171,10 +165,7 @@ public function encode(mixed $data, string $format, array $context = []): string
171165
return 'encoded';
172166
}
173167

174-
/**
175-
* @param array $context
176-
*/
177-
public function supportsEncoding(string $format /*, array $context = [] */): bool
168+
public function supportsEncoding(string $format, array $context = []): bool
178169
{
179170
return true;
180171
}
@@ -184,10 +175,7 @@ public function decode(string $data, string $format, array $context = []): mixed
184175
return 'decoded';
185176
}
186177

187-
/**
188-
* @param array $context
189-
*/
190-
public function supportsDecoding(string $format /*, array $context = [] */): bool
178+
public function supportsDecoding(string $format, array $context = []): bool
191179
{
192180
return true;
193181
}

0 commit comments

Comments
 (0)