Skip to content

Commit fc94db0

Browse files
authored
chore: missing deprecations (#6480)
1 parent 1033064 commit fc94db0

File tree

78 files changed

+688
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+688
-68
lines changed

src/Action/NotExposedAction.php

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
/**
2020
* An action which always returns HTTP 404 Not Found with an explanation for why the operation is not exposed.
21+
*
22+
* @deprecated use ApiPlatform\Symfony\Action\NotExposedAction
2123
*/
2224
final class NotExposedAction
2325
{

src/Action/NotFoundAction.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
/**
1919
* An action which always returns HTTP 404 Not Found. Useful for disabling an operation.
20+
*
21+
* @deprecated use ApiPlatform\Symfony\Action\NotFoundAction
2022
*/
2123
final class NotFoundAction
2224
{

src/Action/PlaceholderAction.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* Placeholder returning the data passed in parameter.
1818
*
1919
* @author Kévin Dunglas <[email protected]>
20+
*
21+
* @deprecated use ApiPlatform\Symfony\Action\PlaceholderAction
2022
*/
2123
final class PlaceholderAction
2224
{

src/Elasticsearch/Metadata/Resource/Factory/ElasticsearchProviderResourceMetadataCollectionFactory.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@
2121
use ApiPlatform\Metadata\Operation;
2222
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
2323
use ApiPlatform\Metadata\Resource\ResourceMetadataCollection;
24-
use ApiPlatform\Metadata\Util\Inflector;
2524
use Elasticsearch\Client;
2625
use Elasticsearch\Common\Exceptions\Missing404Exception;
2726
use Elasticsearch\Common\Exceptions\NoNodesAvailableException;
2827

2928
final class ElasticsearchProviderResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface
3029
{
31-
public function __construct(private readonly ?Client $client, private readonly ResourceMetadataCollectionFactoryInterface $decorated, private readonly bool $triggerDeprecation = true, private readonly ?InflectorInterface $inflector = new Inflector()) // @phpstan-ignore-line
30+
public function __construct(private readonly ?Client $client, private readonly ResourceMetadataCollectionFactoryInterface $decorated, private readonly bool $triggerDeprecation = true, private readonly ?InflectorInterface $inflector = null) // @phpstan-ignore-line
3231
{
32+
if ($client) {
33+
trigger_deprecation('api-platform/core', '4.0', sprintf('Using $client at "%s" is deprecated and the argument will be removed.', self::class));
34+
}
3335
}
3436

3537
/**

src/Exception/DeserializationException.php

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
*
2121
* @author Samuel ROZE <[email protected]>
2222
* @author Kévin Dunglas <[email protected]>
23+
*
24+
* @deprecated
2325
*/
2426
class DeserializationException extends \Exception implements ExceptionInterface, SerializerExceptionInterface
2527
{

src/Exception/ErrorCodeSerializableInterface.php

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
/**
1717
* An exception which has a serializable application-specific error code.
18+
*
19+
* @deprecated
1820
*/
1921
interface ErrorCodeSerializableInterface
2022
{

src/Exception/ExceptionInterface.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* Base exception interface.
1818
*
1919
* @author Kévin Dunglas <[email protected]>
20+
*
21+
* @deprecated use ApiPlatform\Metadata\Exception\ExceptionInterface
2022
*/
2123
interface ExceptionInterface extends \Throwable
2224
{

src/Exception/InvalidArgumentException.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* Invalid argument exception.
1818
*
1919
* @author Kévin Dunglas <[email protected]>
20+
*
21+
* @deprecated use ApiPlatform\Metadata\Exception\InvalidArgumentException
2022
*/
2123
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
2224
{

src/Exception/InvalidIdentifierException.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* Identifier is not valid exception.
1818
*
1919
* @author Antoine Bluchet <[email protected]>
20+
*
21+
* @deprecated use ApiPlatform\Metadata\Exception\InvalidIdentifierException
2022
*/
2123
class InvalidIdentifierException extends \Exception implements ExceptionInterface
2224
{

src/Exception/InvalidResourceException.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* Invalid resource exception.
1818
*
1919
* @author Paul Le Corre <[email protected]>
20+
*
21+
* @deprecated
2022
*/
2123
class InvalidResourceException extends \Exception implements ExceptionInterface
2224
{

src/Exception/InvalidUriVariableException.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* Identifier is not valid exception.
1818
*
1919
* @author Antoine Bluchet <[email protected]>
20+
*
21+
* @deprecated use ApiPlatform\Metadata\Exception\InvalidUriVariableException
2022
*/
2123
class InvalidUriVariableException extends \Exception implements ExceptionInterface
2224
{

src/Exception/InvalidValueException.php

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
namespace ApiPlatform\Exception;
1515

16+
/**
17+
* @deprecated
18+
*/
1619
class InvalidValueException extends InvalidArgumentException
1720
{
1821
}

src/Exception/ItemNotFoundException.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* Item not found exception.
1818
*
1919
* @author Amrouche Hamza <[email protected]>
20+
*
21+
* @deprecated use ApiPlatform\Metadata\Exception\ItemNotFoundException
2022
*/
2123
class ItemNotFoundException extends InvalidArgumentException
2224
{

src/Exception/NotExposedHttpException.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
/**
1919
* @author Vincent Chalamon <[email protected]>
20+
*
21+
* @deprecated use ApiPlatform\Metadata\Exception\NotExposedHttpException
2022
*/
2123
class NotExposedHttpException extends NotFoundHttpException
2224
{

src/Exception/OperationNotFoundException.php

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
/**
1717
* Operation not found exception.
18+
*
19+
* @deprecated use ApiPlatform\Metadata\Exception\OperationNotFoundException
1820
*/
1921
class OperationNotFoundException extends \InvalidArgumentException implements ExceptionInterface
2022
{

src/Exception/PropertyNotFoundException.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* Property not found exception.
1818
*
1919
* @author Kévin Dunglas <[email protected]>
20+
*
21+
* @deprecated use ApiPlatform\Metadata\Exception\PropertyNotFoundException
2022
*/
2123
class PropertyNotFoundException extends \Exception implements ExceptionInterface
2224
{

src/Exception/ResourceClassNotFoundException.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* Resource class not found exception.
1818
*
1919
* @author Kévin Dunglas <[email protected]>
20+
*
21+
* @deprecated use ApiPlatform\Metadata\Exception\ResourceClassNotFoundException
2022
*/
2123
class ResourceClassNotFoundException extends \Exception implements ExceptionInterface
2224
{

src/Exception/ResourceClassNotSupportedException.php

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
/**
1717
* Resource class not supported exception.
1818
*
19+
* @deprecated
20+
*
1921
* @author Kévin Dunglas <[email protected]>
2022
*/
2123
class ResourceClassNotSupportedException extends \Exception implements ExceptionInterface

src/Exception/RuntimeException.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* Runtime exception.
1818
*
1919
* @author Kévin Dunglas <[email protected]>
20+
*
21+
* @deprecated use ApiPlatform\Metadata\Exception\RuntimeException
2022
*/
2123
class RuntimeException extends \RuntimeException implements ExceptionInterface
2224
{

src/GraphQl/Resolver/Factory/CollectionResolverFactory.php

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
* @author Alan Poulain <[email protected]>
3333
* @author Kévin Dunglas <[email protected]>
3434
* @author Vincent Chalamon <[email protected]>
35+
*
36+
* @deprecated
3537
*/
3638
final class CollectionResolverFactory implements ResolverFactoryInterface
3739
{

src/GraphQl/Resolver/Factory/ItemMutationResolverFactory.php

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
*
3636
* @author Alan Poulain <[email protected]>
3737
* @author Vincent Chalamon <[email protected]>
38+
*
39+
* @deprecated
3840
*/
3941
final class ItemMutationResolverFactory implements ResolverFactoryInterface
4042
{

src/GraphQl/Resolver/Factory/ItemResolverFactory.php

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
* @author Alan Poulain <[email protected]>
3333
* @author Kévin Dunglas <[email protected]>
3434
* @author Vincent Chalamon <[email protected]>
35+
*
36+
* @deprecated
3537
*/
3638
final class ItemResolverFactory implements ResolverFactoryInterface
3739
{

src/GraphQl/Resolver/Factory/ItemSubscriptionResolverFactory.php

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
* Creates a function resolving a GraphQL subscription of an item.
2929
*
3030
* @author Alan Poulain <[email protected]>
31+
*
32+
* @deprecated
3133
*/
3234
final class ItemSubscriptionResolverFactory implements ResolverFactoryInterface
3335
{

src/GraphQl/Resolver/Stage/DeserializeStage.php

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
* Deserialize stage of GraphQL resolvers.
2424
*
2525
* @author Alan Poulain <[email protected]>
26+
*
27+
* @deprecated
2628
*/
2729
final class DeserializeStage implements DeserializeStageInterface
2830
{

src/GraphQl/Resolver/Stage/DeserializeStageInterface.php

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* Deserialize stage of GraphQL resolvers.
2020
*
2121
* @author Alan Poulain <[email protected]>
22+
*
23+
* @deprecated
2224
*/
2325
interface DeserializeStageInterface
2426
{

src/GraphQl/Resolver/Stage/ReadStage.php

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
* Read stage of GraphQL resolvers.
2828
*
2929
* @author Alan Poulain <[email protected]>
30+
*
31+
* @deprecated
3032
*/
3133
final class ReadStage implements ReadStageInterface
3234
{

src/GraphQl/Resolver/Stage/ReadStageInterface.php

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* Read stage of GraphQL resolvers.
2020
*
2121
* @author Alan Poulain <[email protected]>
22+
*
23+
* @deprecated
2224
*/
2325
interface ReadStageInterface
2426
{

src/GraphQl/Resolver/Stage/SecurityPostDenormalizeStage.php

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* Security post denormalize stage of GraphQL resolvers.
2323
*
2424
* @author Vincent Chalamon <[email protected]>
25+
*
26+
* @deprecated
2527
*/
2628
final class SecurityPostDenormalizeStage implements SecurityPostDenormalizeStageInterface
2729
{

src/GraphQl/Resolver/Stage/SecurityPostDenormalizeStageInterface.php

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
* Security post deserialization stage of GraphQL resolvers.
2121
*
2222
* @author Vincent Chalamon <[email protected]>
23+
*
24+
* @deprecated
2325
*/
2426
interface SecurityPostDenormalizeStageInterface
2527
{

src/GraphQl/Resolver/Stage/SecurityPostValidationStageInterface.php

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
*
2222
* @author Vincent Chalamon <[email protected]>
2323
* @author Grégoire Pineau <[email protected]>
24+
*
25+
* @deprecated
2426
*/
2527
interface SecurityPostValidationStageInterface
2628
{

src/GraphQl/Resolver/Stage/SecurityStage.php

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* Security stage of GraphQL resolvers.
2323
*
2424
* @author Alan Poulain <[email protected]>
25+
*
26+
* @deprecated
2527
*/
2628
final class SecurityStage implements SecurityStageInterface
2729
{

src/GraphQl/Resolver/Stage/SecurityStageInterface.php

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
*
2222
* @author Alan Poulain <[email protected]>
2323
* @author Vincent Chalamon <[email protected]>
24+
*
25+
* @deprecated
2426
*/
2527
interface SecurityStageInterface
2628
{

src/GraphQl/Resolver/Stage/SerializeStage.php

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
* Serialize stage of GraphQL resolvers.
3131
*
3232
* @author Alan Poulain <[email protected]>
33+
*
34+
* @deprecated
3335
*/
3436
final class SerializeStage implements SerializeStageInterface
3537
{

src/GraphQl/Resolver/Stage/SerializeStageInterface.php

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* Serialize stage of GraphQL resolvers.
2020
*
2121
* @author Alan Poulain <[email protected]>
22+
*
23+
* @deprecated
2224
*/
2325
interface SerializeStageInterface
2426
{

src/GraphQl/Resolver/Stage/ValidateStage.php

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
* Validate stage of GraphQL resolvers.
2121
*
2222
* @author Alan Poulain <[email protected]>
23+
*
24+
* @deprecated
2325
*/
2426
final class ValidateStage implements ValidateStageInterface
2527
{

src/GraphQl/Resolver/Stage/ValidateStageInterface.php

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
* Validate stage of GraphQL resolvers.
2121
*
2222
* @author Alan Poulain <[email protected]>
23+
*
24+
* @deprecated
2325
*/
2426
interface ValidateStageInterface
2527
{

src/GraphQl/Resolver/Stage/WriteStage.php

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* Write stage of GraphQL resolvers.
2222
*
2323
* @author Alan Poulain <[email protected]>
24+
*
25+
* @deprecated
2426
*/
2527
final class WriteStage implements WriteStageInterface
2628
{

src/GraphQl/Resolver/Stage/WriteStageInterface.php

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* Write stage of GraphQL resolvers.
2020
*
2121
* @author Alan Poulain <[email protected]>
22+
*
23+
* @deprecated
2224
*/
2325
interface WriteStageInterface
2426
{

src/GraphQl/Subscription/SubscriptionManager.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace ApiPlatform\GraphQl\Subscription;
1515

16+
use ApiPlatform\GraphQl\Resolver\Stage\SerializeStage;
1617
use ApiPlatform\GraphQl\Resolver\Stage\SerializeStageInterface;
1718
use ApiPlatform\GraphQl\Resolver\Util\IdentifierTrait;
1819
use ApiPlatform\Metadata\GraphQl\Operation;
@@ -37,8 +38,11 @@ final class SubscriptionManager implements OperationAwareSubscriptionManagerInte
3738
use ResourceClassInfoTrait;
3839
use SortTrait;
3940

40-
public function __construct(private readonly CacheItemPoolInterface $subscriptionsCache, private readonly SubscriptionIdentifierGeneratorInterface $subscriptionIdentifierGenerator, private readonly ?SerializeStageInterface $serializeStage, private readonly IriConverterInterface $iriConverter, private readonly ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, private readonly ?ProcessorInterface $normalizeProcessor = null)
41+
public function __construct(private readonly CacheItemPoolInterface $subscriptionsCache, private readonly SubscriptionIdentifierGeneratorInterface $subscriptionIdentifierGenerator, private readonly SerializeStageInterface|ProcessorInterface|null $serializeStage = null, private readonly ?IriConverterInterface $iriConverter = null, private readonly ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null)
4142
{
43+
if (!$serializeStage instanceof ProcessorInterface) {
44+
trigger_deprecation('api-platform/core', '4.0', sprintf('Using an instanceof "%s" is deprecated, use "%s" instead.', SerializeStageInterface::class, ProcessorInterface::class));
45+
}
4246
}
4347

4448
public function retrieveSubscriptionId(array $context, ?array $result, ?Operation $operation = null): ?string
@@ -85,9 +89,9 @@ public function getPushPayloads(object $object): array
8589
$resolverContext = ['fields' => $subscriptionFields, 'is_collection' => false, 'is_mutation' => false, 'is_subscription' => true];
8690
/** @var Operation */
8791
$operation = (new Subscription())->withName('update_subscription')->withShortName($shortName);
88-
if ($this->normalizeProcessor) {
89-
$data = $this->normalizeProcessor->process($object, $operation, [], $resolverContext);
90-
} elseif ($this->serializeStage) {
92+
if ($this->serializeStage instanceof ProcessorInterface) {
93+
$data = $this->serializeStage->process($object, $operation, [], $resolverContext);
94+
} elseif ($this->serializeStage instanceof SerializeStage) {
9195
$data = ($this->serializeStage)($object, $resourceClass, $operation, $resolverContext);
9296
} else {
9397
throw new \LogicException();

0 commit comments

Comments
 (0)