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

Skip to content

Commit 8c28bed

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

29 files changed

Lines changed: 242 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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,9 @@ 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 [Error::class => false];
57+
}
5358
}

src/GraphQl/Serializer/Exception/RuntimeExceptionNormalizer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,9 @@ 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 [Error::class => false];
51+
}
4752
}

src/GraphQl/Serializer/Exception/ValidationExceptionNormalizer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,9 @@ 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 [Error::class => false];
84+
}
8085
}

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+
return [];
65+
}
66+
67+
5968
/**
6069
* {@inheritdoc}
6170
*

src/GraphQl/Serializer/ObjectNormalizer.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ 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+
return [];
53+
}
54+
4755
/**
4856
* {@inheritdoc}
4957
*/

src/Hal/Serializer/EntrypointNormalizer.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ 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+
return [];
85+
}
86+
7787
public function hasCacheableSupportsMethod(): bool
7888
{
7989
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+
return [];
55+
}
56+
57+
4958
/**
5059
* {@inheritdoc}
5160
*/

src/Hal/Serializer/ObjectNormalizer.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ 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+
return [];
48+
}
49+
4250
/**
4351
* {@inheritdoc}
4452
*/

0 commit comments

Comments
 (0)