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

Skip to content

Commit 16e7f32

Browse files
committed
feat(serializer): support for getSupportedTypes (symfony 6.3)
1 parent 0fe4f4d commit 16e7f32

29 files changed

Lines changed: 265 additions & 0 deletions

src/Elasticsearch/Serializer/ItemNormalizer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ public function supportsNormalization(mixed $data, string $format = null, array
9090
return DocumentNormalizer::FORMAT !== $format && $this->decorated->supportsNormalization($data, $format);
9191
}
9292

93+
public function getSupportedTypes($format): array
94+
{
95+
return $this->decorated->getSupportedTypes($format);
96+
}
97+
9398
/**
9499
* {@inheritdoc}
95100
*

src/GraphQl/Serializer/Exception/ErrorNormalizer.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,11 @@ public function supportsNormalization(mixed $data, string $format = null, array
3939
{
4040
return $data instanceof Error;
4141
}
42+
43+
public function getSupportedTypes($format): array
44+
{
45+
return [
46+
Error::class => false,
47+
];
48+
}
4249
}

src/GraphQl/Serializer/Exception/HttpExceptionNormalizer.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,11 @@ public function supportsNormalization(mixed $data, string $format = null, array
5050
{
5151
return $data instanceof Error && $data->getPrevious() instanceof HttpExceptionInterface;
5252
}
53+
54+
public function getSupportedTypes($format): array
55+
{
56+
return [
57+
Error::class => false,
58+
];
59+
}
5360
}

src/GraphQl/Serializer/Exception/RuntimeExceptionNormalizer.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,11 @@ public function supportsNormalization(mixed $data, string $format = null, array
4444
{
4545
return $data instanceof Error && $data->getPrevious() instanceof \RuntimeException;
4646
}
47+
48+
public function getSupportedTypes($format): array
49+
{
50+
return [
51+
Error::class => false,
52+
];
53+
}
4754
}

src/GraphQl/Serializer/Exception/ValidationExceptionNormalizer.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,11 @@ public function supportsNormalization(mixed $data, string $format = null, array
7777
{
7878
return $data instanceof Error && $data->getPrevious() instanceof ValidationException;
7979
}
80+
81+
public function getSupportedTypes($format): array
82+
{
83+
return [
84+
Error::class => false,
85+
];
86+
}
8087
}

src/GraphQl/Serializer/ItemNormalizer.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ public function supportsNormalization(mixed $data, string $format = null, array
5656
return self::FORMAT === $format && parent::supportsNormalization($data, $format, $context);
5757
}
5858

59+
public function getSupportedTypes($format): array
60+
{
61+
if (self::FORMAT === $format) {
62+
return parent::getSupportedTypes($format);
63+
}
64+
65+
return [];
66+
}
67+
5968
/**
6069
* {@inheritdoc}
6170
*

src/GraphQl/Serializer/ObjectNormalizer.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ public function supportsNormalization(mixed $data, string $format = null, array
4444
return self::FORMAT === $format && $this->decorated->supportsNormalization($data, $format, $context);
4545
}
4646

47+
public function getSupportedTypes($format): array
48+
{
49+
if (self::FORMAT === $format) {
50+
return $this->decorated->getSupportedTypes($format);
51+
}
52+
53+
return [];
54+
}
55+
4756
/**
4857
* {@inheritdoc}
4958
*/

src/Hal/Serializer/EntrypointNormalizer.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ public function supportsNormalization(mixed $data, string $format = null, array
7474
return self::FORMAT === $format && $data instanceof Entrypoint;
7575
}
7676

77+
public function getSupportedTypes($format): array
78+
{
79+
if (self::FORMAT === $format) {
80+
return [
81+
Entrypoint::class => $this->hasCacheableSupportsMethod(),
82+
];
83+
}
84+
85+
return [];
86+
}
87+
7788
public function hasCacheableSupportsMethod(): bool
7889
{
7990
return true;

src/Hal/Serializer/ItemNormalizer.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ public function supportsNormalization(mixed $data, string $format = null, array
4646
return self::FORMAT === $format && parent::supportsNormalization($data, $format, $context);
4747
}
4848

49+
public function getSupportedTypes($format): array
50+
{
51+
if (self::FORMAT === $format) {
52+
return parent::getSupportedTypes($format);
53+
}
54+
55+
return [];
56+
}
57+
4958
/**
5059
* {@inheritdoc}
5160
*/

src/Hal/Serializer/ObjectNormalizer.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ public function supportsNormalization(mixed $data, string $format = null, array
3939
return self::FORMAT === $format && $this->decorated->supportsNormalization($data, $format, $context);
4040
}
4141

42+
public function getSupportedTypes($format): array
43+
{
44+
if (self::FORMAT === $format) {
45+
return $this->decorated->getSupportedTypes($format);
46+
}
47+
48+
return [];
49+
}
50+
4251
/**
4352
* {@inheritdoc}
4453
*/

0 commit comments

Comments
 (0)