Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Elasticsearch/Serializer/ItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,19 @@ public function supportsNormalization(mixed $data, string $format = null, array
return DocumentNormalizer::FORMAT !== $format && $this->decorated->supportsNormalization($data, $format);
}

public function getSupportedTypes($format): array
{
// @deprecated remove condition when support for symfony versions under 6.3 is dropped
if (!method_exists($this->decorated, 'getSupportedTypes')) {
return [
DocumentNormalizer::FORMAT => null,
'*' => $this->decorated instanceof CacheableSupportsMethodInterface && $this->decorated->hasCacheableSupportsMethod(),
];
}

return DocumentNormalizer::FORMAT !== $format ? $this->decorated->getSupportedTypes($format) : [];
}

/**
* {@inheritdoc}
*
Expand Down
7 changes: 7 additions & 0 deletions src/GraphQl/Serializer/Exception/ErrorNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,11 @@ public function supportsNormalization(mixed $data, string $format = null, array
{
return $data instanceof Error;
}

public function getSupportedTypes($format): array
{
return [
Error::class => true,
];
}
}
7 changes: 7 additions & 0 deletions src/GraphQl/Serializer/Exception/HttpExceptionNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,11 @@ public function supportsNormalization(mixed $data, string $format = null, array
{
return $data instanceof Error && $data->getPrevious() instanceof HttpExceptionInterface;
}

public function getSupportedTypes($format): array
{
return [
Error::class => false,
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,11 @@ public function supportsNormalization(mixed $data, string $format = null, array
{
return $data instanceof Error && $data->getPrevious() instanceof \RuntimeException;
}

public function getSupportedTypes($format): array
{
return [
Error::class => false,
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,11 @@ public function supportsNormalization(mixed $data, string $format = null, array
{
return $data instanceof Error && $data->getPrevious() instanceof ValidationException;
}

public function getSupportedTypes($format): array
{
return [
Error::class => false,
];
}
}
5 changes: 5 additions & 0 deletions src/GraphQl/Serializer/ItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public function supportsNormalization(mixed $data, string $format = null, array
return self::FORMAT === $format && parent::supportsNormalization($data, $format, $context);
}

public function getSupportedTypes($format): array
{
return self::FORMAT === $format ? parent::getSupportedTypes($format) : [];
}

/**
* {@inheritdoc}
*
Expand Down
14 changes: 14 additions & 0 deletions src/GraphQl/Serializer/ObjectNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,25 @@ public function supportsNormalization(mixed $data, string $format = null, array
return self::FORMAT === $format && $this->decorated->supportsNormalization($data, $format, $context);
}

public function getSupportedTypes($format): array
{
// @deprecated remove condition when support for symfony versions under 6.3 is dropped
if (!method_exists($this->decorated, 'getSupportedTypes')) {
return [
'*' => $this->decorated instanceof CacheableSupportsMethodInterface && $this->decorated->hasCacheableSupportsMethod(),
];
}

return self::FORMAT === $format ? $this->decorated->getSupportedTypes($format) : [];
}

/**
* {@inheritdoc}
*/
public function hasCacheableSupportsMethod(): bool
{
trigger_deprecation('api-platform/core', '3.1', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);

return $this->decorated instanceof CacheableSupportsMethodInterface && $this->decorated->hasCacheableSupportsMethod();
}

Expand Down
7 changes: 7 additions & 0 deletions src/Hal/Serializer/EntrypointNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,15 @@ public function supportsNormalization(mixed $data, string $format = null, array
return self::FORMAT === $format && $data instanceof Entrypoint;
}

public function getSupportedTypes($format): array
{
return self::FORMAT === $format ? [Entrypoint::class => true] : [];
}

public function hasCacheableSupportsMethod(): bool
{
trigger_deprecation('api-platform/core', '3.1', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);

return true;
}
}
5 changes: 5 additions & 0 deletions src/Hal/Serializer/ItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public function supportsNormalization(mixed $data, string $format = null, array
return self::FORMAT === $format && parent::supportsNormalization($data, $format, $context);
}

public function getSupportedTypes($format): array
{
return self::FORMAT === $format ? parent::getSupportedTypes($format) : [];
}

/**
* {@inheritdoc}
*/
Expand Down
14 changes: 14 additions & 0 deletions src/Hal/Serializer/ObjectNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,25 @@ public function supportsNormalization(mixed $data, string $format = null, array
return self::FORMAT === $format && $this->decorated->supportsNormalization($data, $format, $context);
}

public function getSupportedTypes($format): array
{
// @deprecated remove condition when support for symfony versions under 6.3 is dropped
if (!method_exists($this->decorated, 'getSupportedTypes')) {
return [
'*' => $this->decorated instanceof CacheableSupportsMethodInterface && $this->decorated->hasCacheableSupportsMethod(),
];
}

return self::FORMAT === $format ? $this->decorated->getSupportedTypes($format) : [];
}

/**
* {@inheritdoc}
*/
public function hasCacheableSupportsMethod(): bool
{
trigger_deprecation('api-platform/core', '3.1', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);

return $this->decorated instanceof CacheableSupportsMethodInterface && $this->decorated->hasCacheableSupportsMethod();
}

Expand Down
12 changes: 12 additions & 0 deletions src/Hydra/Serializer/CollectionFiltersNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,20 @@ public function supportsNormalization(mixed $data, string $format = null, array
return $this->collectionNormalizer->supportsNormalization($data, $format, $context);
}

public function getSupportedTypes($format): array
{
// @deprecated remove condition when support for symfony versions under 6.3 is dropped
if (!method_exists($this->collectionNormalizer, 'getSupportedTypes')) {
return ['*' => $this->collectionNormalizer instanceof CacheableSupportsMethodInterface && $this->collectionNormalizer->hasCacheableSupportsMethod()];
}

return $this->collectionNormalizer->getSupportedTypes($format);
}

public function hasCacheableSupportsMethod(): bool
{
trigger_deprecation('api-platform/core', '3.1', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);

return $this->collectionNormalizer instanceof CacheableSupportsMethodInterface && $this->collectionNormalizer->hasCacheableSupportsMethod();
}

Expand Down
7 changes: 7 additions & 0 deletions src/Hydra/Serializer/DocumentationNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,15 @@ public function supportsNormalization(mixed $data, string $format = null, array
return self::FORMAT === $format && $data instanceof Documentation;
}

public function getSupportedTypes($format): array
{
return self::FORMAT === $format ? [Documentation::class => true] : [];
}

public function hasCacheableSupportsMethod(): bool
{
trigger_deprecation('api-platform/core', '3.1', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);

return true;
}
}
7 changes: 7 additions & 0 deletions src/Hydra/Serializer/EntrypointNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,15 @@ public function supportsNormalization(mixed $data, string $format = null, array
return self::FORMAT === $format && $data instanceof Entrypoint;
}

public function getSupportedTypes($format): array
{
return self::FORMAT === $format ? [Entrypoint::class => true] : [];
}

public function hasCacheableSupportsMethod(): bool
{
trigger_deprecation('api-platform/core', '3.1', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);

return true;
}
}
14 changes: 14 additions & 0 deletions src/Hydra/Serializer/ErrorNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,22 @@ public function supportsNormalization(mixed $data, string $format = null, array
return self::FORMAT === $format && ($data instanceof \Exception || $data instanceof FlattenException);
}

public function getSupportedTypes($format): array
{
if (self::FORMAT === $format) {
return [
\Exception::class => true,
FlattenException::class => true,
];
}

return [];
}

public function hasCacheableSupportsMethod(): bool
{
trigger_deprecation('api-platform/core', '3.1', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);

return true;
}
}
14 changes: 14 additions & 0 deletions src/Hydra/Serializer/PartialCollectionViewNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,22 @@ public function supportsNormalization(mixed $data, string $format = null, array
return $this->collectionNormalizer->supportsNormalization($data, $format, $context);
}

public function getSupportedTypes($format): array
{
// @deprecated remove condition when support for symfony versions under 6.3 is dropped
if (!method_exists($this->collectionNormalizer, 'getSupportedTypes')) {
return [
'*' => $this->collectionNormalizer instanceof CacheableSupportsMethodInterface && $this->collectionNormalizer->hasCacheableSupportsMethod(),
];
}

return $this->collectionNormalizer->getSupportedTypes($format);
}

public function hasCacheableSupportsMethod(): bool
{
trigger_deprecation('api-platform/core', '3.1', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);

return $this->collectionNormalizer instanceof CacheableSupportsMethodInterface && $this->collectionNormalizer->hasCacheableSupportsMethod();
}

Expand Down
7 changes: 7 additions & 0 deletions src/JsonApi/Serializer/ConstraintViolationListNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,15 @@ public function supportsNormalization(mixed $data, string $format = null, array
return self::FORMAT === $format && $data instanceof ConstraintViolationListInterface;
}

public function getSupportedTypes($format): array
{
return (self::FORMAT === $format) ? [ConstraintViolationListInterface::class => true] : [];
}

public function hasCacheableSupportsMethod(): bool
{
trigger_deprecation('api-platform/core', '3.1', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);

return true;
}

Expand Down
7 changes: 7 additions & 0 deletions src/JsonApi/Serializer/EntrypointNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,15 @@ public function supportsNormalization(mixed $data, string $format = null, array
return self::FORMAT === $format && $data instanceof Entrypoint;
}

public function getSupportedTypes($format): array
{
return self::FORMAT === $format ? [Entrypoint::class => true] : [];
}

public function hasCacheableSupportsMethod(): bool
{
trigger_deprecation('api-platform/core', '3.1', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);

return true;
}
}
14 changes: 14 additions & 0 deletions src/JsonApi/Serializer/ErrorNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,22 @@ public function supportsNormalization(mixed $data, string $format = null, array
return self::FORMAT === $format && ($data instanceof \Exception || $data instanceof FlattenException);
}

public function getSupportedTypes($format): array
{
if (self::FORMAT === $format) {
return [
\Exception::class => true,
FlattenException::class => true,
];
}

return [];
}

public function hasCacheableSupportsMethod(): bool
{
trigger_deprecation('api-platform/core', '3.1', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);

return true;
}
}
5 changes: 5 additions & 0 deletions src/JsonApi/Serializer/ItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ public function supportsNormalization(mixed $data, string $format = null, array
return self::FORMAT === $format && parent::supportsNormalization($data, $format, $context);
}

public function getSupportedTypes($format): array
{
return self::FORMAT === $format ? parent::getSupportedTypes($format) : [];
}

/**
* {@inheritdoc}
*/
Expand Down
14 changes: 14 additions & 0 deletions src/JsonApi/Serializer/ObjectNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,22 @@ public function supportsNormalization(mixed $data, string $format = null, array
return self::FORMAT === $format && $this->decorated->supportsNormalization($data, $format, $context);
}

public function getSupportedTypes($format): array
{
// @deprecated remove condition when support for symfony versions under 6.3 is dropped
if (!method_exists($this->decorated, 'getSupportedTypes')) {
return [
'*' => $this->decorated instanceof CacheableSupportsMethodInterface && $this->decorated->hasCacheableSupportsMethod(),
];
}

return self::FORMAT === $format ? $this->decorated->getSupportedTypes($format) : [];
}

public function hasCacheableSupportsMethod(): bool
{
trigger_deprecation('api-platform/core', '3.1', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);

return $this->decorated instanceof CacheableSupportsMethodInterface && $this->decorated->hasCacheableSupportsMethod();
}

Expand Down
5 changes: 5 additions & 0 deletions src/JsonLd/Serializer/ItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public function supportsNormalization(mixed $data, string $format = null, array
return self::FORMAT === $format && parent::supportsNormalization($data, $format, $context);
}

public function getSupportedTypes($format): array
{
return self::FORMAT === $format ? parent::getSupportedTypes($format) : [];
}

/**
* {@inheritdoc}
*
Expand Down
14 changes: 14 additions & 0 deletions src/JsonLd/Serializer/ObjectNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,22 @@ public function supportsNormalization(mixed $data, string $format = null, array
return self::FORMAT === $format && $this->decorated->supportsNormalization($data, $format, $context);
}

public function getSupportedTypes($format): array
{
// @deprecated remove condition when support for symfony versions under 6.3 is dropped
if (!method_exists($this->decorated, 'getSupportedTypes')) {
return [
'*' => $this->decorated instanceof CacheableSupportsMethodInterface && $this->decorated->hasCacheableSupportsMethod(),
];
}

return self::FORMAT === $format ? $this->decorated->getSupportedTypes($format) : [];
}

public function hasCacheableSupportsMethod(): bool
{
trigger_deprecation('api-platform/core', '3.1', 'The "%s()" method is deprecated, use "getSupportedTypes()" instead.', __METHOD__);

return $this->decorated instanceof CacheableSupportsMethodInterface && $this->decorated->hasCacheableSupportsMethod();
}

Expand Down
Loading