Skip to content

Commit

Permalink
chore: remove deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Jul 19, 2024
1 parent d5821d3 commit 7ff051f
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 486 deletions.
16 changes: 1 addition & 15 deletions AbstractCollectionNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*
* @author Baptiste Meyer <[email protected]>
*/
abstract class AbstractCollectionNormalizer implements NormalizerInterface, NormalizerAwareInterface, CacheableSupportsMethodInterface
abstract class AbstractCollectionNormalizer implements NormalizerInterface, NormalizerAwareInterface
{
use ContextTrait {
initContext as protected;
Expand All @@ -54,20 +54,6 @@ public function supportsNormalization(mixed $data, ?string $format = null, array
return static::FORMAT === $format && is_iterable($data);
}

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

return true;
}

public function getSupportedTypes(?string $format): array
{
/*
Expand Down
19 changes: 2 additions & 17 deletions AbstractConstraintViolationListNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter;
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationListInterface;

Expand All @@ -28,7 +27,7 @@
*
* @internal
*/
abstract class AbstractConstraintViolationListNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface
abstract class AbstractConstraintViolationListNormalizer implements NormalizerInterface
{
public const FORMAT = null; // Must be overridden

Expand All @@ -44,7 +43,7 @@ public function __construct(?array $serializePayloadFields = null, private reado
*/
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
{
if (!isset($context['rfc_7807_compliant_errors']) && !($context['api_error_resource'] ?? false)) {
if (!($context['api_error_resource'] ?? false)) {
return false;
}

Expand All @@ -56,20 +55,6 @@ public function getSupportedTypes($format): array
return $format === static::FORMAT ? [ConstraintViolationListInterface::class => true] : [];
}

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

return true;
}

protected function getMessagesAndViolations(ConstraintViolationListInterface $constraintViolationList): array
{
$violations = $messages = [];
Expand Down
17 changes: 0 additions & 17 deletions AbstractItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,6 @@ public function getSupportedTypes(?string $format): array
];
}

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

return true;
}

/**
* {@inheritdoc}
*
Expand Down
47 changes: 0 additions & 47 deletions CacheableSupportsMethodInterface.php

This file was deleted.

22 changes: 8 additions & 14 deletions Filter/PropertyFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace ApiPlatform\Serializer\Filter;

use ApiPlatform\OpenApi\Model\Parameter;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
Expand Down Expand Up @@ -167,24 +168,17 @@ public function getDescription(string $resourceClass): array
'is_collection' => true,
'required' => false,
'description' => 'Allows you to reduce the response to contain only the properties you need. If your desired property is nested, you can address it using nested arrays. Example: '.$example,
'swagger' => [
'description' => 'Allows you to reduce the response to contain only the properties you need. If your desired property is nested, you can address it using nested arrays. Example: '.$example,
'name' => "$this->parameterName[]",
'type' => 'array',
'items' => [
'type' => 'string',
],
],
'openapi' => [
'description' => 'Allows you to reduce the response to contain only the properties you need. If your desired property is nested, you can address it using nested arrays. Example: '.$example,
'name' => "$this->parameterName[]",
'schema' => [
'openapi' => new Parameter(
in: 'query',
name: "$this->parameterName[]",
description: 'Allows you to reduce the response to contain only the properties you need. If your desired property is nested, you can address it using nested arrays. Example: '.$example,
schema: [
'type' => 'array',
'items' => [
'type' => 'string',
],
],
],
]
),
],
];
}
Expand Down
Loading

0 comments on commit 7ff051f

Please sign in to comment.