• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

api-platform / core / 10670975328

02 Sep 2024 05:13PM UTC coverage: 72.507% (-0.02%) from 72.524%
10670975328

push

github

web-flow
fix: deprecate url generator interface namespace (#6575)

0 of 1 new or added line in 1 file covered. (0.0%)

3149 of 4343 relevant lines covered (72.51%)

76.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/deprecation.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
$deprecatedClassesWithAliases = [
×
15
    ApiPlatform\HttpCache\EventListener\AddHeadersListener::class => ApiPlatform\Symfony\EventListener\AddHeadersListener::class,
×
16
    ApiPlatform\HttpCache\EventListener\AddTagsListener::class => ApiPlatform\Symfony\EventListener\AddTagsListener::class,
×
17
    ApiPlatform\Exception\FilterValidationException::class => ApiPlatform\ParameterValidator\Exception\ValidationException::class,
×
18
    ApiPlatform\Api\QueryParameterValidator\Validator\ArrayItems::class => ApiPlatform\ParameterValidator\Validator\ArrayItems::class,
×
19
    ApiPlatform\Api\QueryParameterValidator\Validator\Bounds::class => ApiPlatform\ParameterValidator\Validator\Bounds::class,
×
20
    ApiPlatform\Api\QueryParameterValidator\Validator\Enum::class => ApiPlatform\ParameterValidator\Validator\Enum::class,
×
21
    ApiPlatform\Api\QueryParameterValidator\Validator\Length::class => ApiPlatform\ParameterValidator\Validator\Length::class,
×
22
    ApiPlatform\Api\QueryParameterValidator\Validator\MultipleOf::class => ApiPlatform\ParameterValidator\Validator\MultipleOf::class,
×
23
    ApiPlatform\Api\QueryParameterValidator\Validator\Pattern::class => ApiPlatform\ParameterValidator\Validator\Pattern::class,
×
24
    ApiPlatform\Api\QueryParameterValidator\Validator\Required::class => ApiPlatform\ParameterValidator\Validator\Required::class,
×
25
];
×
26

27
$movedClasses = [
×
28
    ApiPlatform\Action\EntrypointAction::class => ApiPlatform\Symfony\Action\EntrypointAction::class,
×
29
    ApiPlatform\Action\NotExposedAction::class => ApiPlatform\Symfony\Action\NotExposedAction::class,
×
30
    ApiPlatform\Action\NotFoundAction::class => ApiPlatform\Symfony\Action\NotFoundAction::class,
×
31
    ApiPlatform\Action\PlaceholderAction::class => ApiPlatform\Symfony\Action\PlaceholderAction::class,
×
32
    ApiPlatform\Api\Entrypoint::class => ApiPlatform\Documentation\Entrypoint::class,
×
NEW
33
    ApiPlatform\Api\UrlGeneratorInterface::class => ApiPlatform\Metadata\UrlGeneratorInterface::class,
×
34
    ApiPlatform\Exception\ExceptionInterface::class => ApiPlatform\Metadata\Exception\ExceptionInterface::class,
×
35
    ApiPlatform\Exception\InvalidArgumentException::class => ApiPlatform\Metadata\Exception\InvalidArgumentException::class,
×
36
    ApiPlatform\Exception\InvalidIdentifierException::class => ApiPlatform\Metadata\Exception\InvalidIdentifierException::class,
×
37
    ApiPlatform\Exception\InvalidUriVariableException::class => ApiPlatform\Metadata\Exception\InvalidUriVariableException::class,
×
38
    ApiPlatform\Exception\ItemNotFoundException::class => ApiPlatform\Metadata\Exception\ItemNotFoundException::class,
×
39
    ApiPlatform\Exception\NotExposedHttpException::class => ApiPlatform\Metadata\Exception\NotExposedHttpException::class,
×
40
    ApiPlatform\Exception\OperationNotFoundException::class => ApiPlatform\Metadata\Exception\OperationNotFoundException::class,
×
41
    ApiPlatform\Exception\PropertyNotFoundException::class => ApiPlatform\Metadata\Exception\PropertyNotFoundException::class,
×
42
    ApiPlatform\Exception\ResourceClassNotFoundException::class => ApiPlatform\Metadata\Exception\ResourceClassNotFoundException::class,
×
43
    ApiPlatform\Exception\RuntimeException::class => ApiPlatform\Metadata\Exception\RuntimeException::class,
×
44
    ApiPlatform\GraphQl\Type\TypeBuilderInterface::class => ApiPlatform\GraphQl\Type\ContextAwareTypeBuilderInterface::class,
×
45
    ApiPlatform\GraphQl\Type\TypeBuilderEnumInterface::class => ApiPlatform\GraphQl\Type\ContextAwareTypeBuilderInterface::class,
×
46
    ApiPlatform\Operation\DashPathSegmentNameGenerator::class => ApiPlatform\Metadata\Operation\DashPathSegmentNameGenerator::class,
×
47
    ApiPlatform\Operation\UnderscorePathSegmentNameGenerator::class => ApiPlatform\Metadata\Operation\UnderscorePathSegmentNameGenerator::class,
×
48
    ApiPlatform\Operation\PathSegmentNameGeneratorInterface::class => ApiPlatform\Metadata\Operation\PathSegmentNameGeneratorInterface::class,
×
49
    ApiPlatform\Symfony\Bundle\Command\OpenApiCommand::class => ApiPlatform\OpenApi\Command\OpenApiCommand::class,
×
50
    ApiPlatform\Util\ClientTrait::class => ApiPlatform\Symfony\Bundle\Test\ClientTrait::class,
×
51
    ApiPlatform\Util\RequestAttributesExtractor::class => ApiPlatform\State\Util\RequestAttributesExtractor::class,
×
52
    ApiPlatform\Symfony\Util\RequestAttributesExtractor::class => ApiPlatform\State\Util\RequestAttributesExtractor::class,
×
53
    ApiPlatform\Doctrine\EventListener\PublishMercureUpdatesListener::class => ApiPlatform\Doctrine\Common\EventListener\PublishMercureUpdatesListener::class,
×
54
    ApiPlatform\Doctrine\EventListener\PurgeHttpCacheListener::class => ApiPlatform\Doctrine\Common\EventListener\PurgeHttpCacheListener::class,
×
55
];
×
56

57
$removedClasses = [
×
58
    ApiPlatform\Action\ExceptionAction::class => true,
×
59
    ApiPlatform\Exception\DeserializationException::class => true,
×
60
    ApiPlatform\Exception\ErrorCodeSerializableInterface::class => true,
×
61
    ApiPlatform\Exception\FilterValidationException::class => true,
×
62
    ApiPlatform\Exception\InvalidResourceException::class => true,
×
63
    ApiPlatform\Exception\InvalidValueException::class => true,
×
64
    ApiPlatform\Exception\ResourceClassNotSupportedException::class => true,
×
65
    ApiPlatform\GraphQl\Resolver\Factory\CollectionResolverFactory::class => true,
×
66
    ApiPlatform\GraphQl\Resolver\Factory\ItemMutationResolverFactory::class => true,
×
67
    ApiPlatform\GraphQl\Resolver\Factory\ItemResolverFactory::class => true,
×
68
    ApiPlatform\GraphQl\Resolver\Factory\ItemSubscriptionResolverFactory::class => true,
×
69
    ApiPlatform\GraphQl\Resolver\Stage\DeserializeStage::class => true,
×
70
    ApiPlatform\GraphQl\Resolver\Stage\DeserializeStageInterface::class => true,
×
71
    ApiPlatform\GraphQl\Resolver\Stage\ReadStage::class => true,
×
72
    ApiPlatform\GraphQl\Resolver\Stage\ReadStageInterface::class => true,
×
73
    ApiPlatform\GraphQl\Resolver\Stage\SecurityPostDenormalizeStage::class => true,
×
74
    ApiPlatform\GraphQl\Resolver\Stage\SecurityPostDenormalizeStageInterface::class => true,
×
75
    ApiPlatform\GraphQl\Resolver\Stage\SecurityPostValidationStage::class => true,
×
76
    ApiPlatform\GraphQl\Resolver\Stage\SecurityPostValidationStageInterface::class => true,
×
77
    ApiPlatform\GraphQl\Resolver\Stage\SecurityStage::class => true,
×
78
    ApiPlatform\GraphQl\Resolver\Stage\SecurityStageInterface::class => true,
×
79
    ApiPlatform\GraphQl\Resolver\Stage\SerializeStage::class => true,
×
80
    ApiPlatform\GraphQl\Resolver\Stage\SerializeStageInterface::class => true,
×
81
    ApiPlatform\GraphQl\Resolver\Stage\ValidateStage::class => true,
×
82
    ApiPlatform\GraphQl\Resolver\Stage\ValidateStageInterface::class => true,
×
83
    ApiPlatform\GraphQl\Resolver\Stage\WriteStage::class => true,
×
84
    ApiPlatform\GraphQl\Resolver\Stage\WriteStageInterface::class => true,
×
85
    ApiPlatform\HttpCache\EventListener\AddHeadersListener::class => true,
×
86
    ApiPlatform\HttpCache\EventListener\AddTagsListener::class => true,
×
87
    ApiPlatform\Hydra\EventListener\AddLinkHeaderListener::class => true,
×
88
    ApiPlatform\Hydra\Serializer\ErrorNormalizer::class => true,
×
89
    ApiPlatform\JsonSchema\TypeFactory::class => true,
×
90
    ApiPlatform\JsonSchema\TypeFactoryInterface::class => true,
×
91
    ApiPlatform\Problem\Serializer\ErrorNormalizer::class => true,
×
92
    ApiPlatform\Serializer\CacheableSupportsMethodInterface::class => true,
×
93
    ApiPlatform\OpenApi\Serializer\CacheableSupportsMethodInterface::class => true,
×
94
    ApiPlatform\Symfony\EventListener\AddHeadersListener::class => true,
×
95
    ApiPlatform\Symfony\EventListener\AddLinkHeaderListener::class => true,
×
96
    ApiPlatform\Symfony\EventListener\AddTagsListener::class => true,
×
97
    ApiPlatform\Symfony\EventListener\DenyAccessListener::class => true,
×
98
    ApiPlatform\Symfony\EventListener\QueryParameterValidateListener::class => true,
×
99
    ApiPlatform\Symfony\Validator\EventListener\ValidationExceptionListener::class => true,
×
100
    ApiPlatform\Symfony\Validator\Exception\ConstraintViolationListAwareExceptionInterface::class => true,
×
101
    ApiPlatform\Symfony\Validator\Exception\ValidationException::class => true,
×
102
    ApiPlatform\Symfony\Validator\State\QueryParameterValidateProvider::class => true,
×
103
    ApiPlatform\Util\ErrorFormatGuesser::class => true,
×
104
];
×
105

106
spl_autoload_register(function ($className) use ($deprecatedClassesWithAliases, $movedClasses, $removedClasses): void {
×
107
    if (isset($removedClasses[$className])) {
×
108
        trigger_deprecation('api-platform/core', '4.0', sprintf('The class %s is deprecated and will be removed.', $className));
×
109

110
        return;
×
111
    }
112

113
    if (isset($movedClasses[$className])) {
×
114
        trigger_deprecation('api-platform/core', '4.0', sprintf('The class %s is deprecated, use %s instead.', $className, $movedClasses[$className]));
×
115

116
        return;
×
117
    }
118

119
    if (isset($deprecatedClassesWithAliases[$className])) {
×
120
        trigger_deprecation('api-platform/core', '4.0', sprintf('The class %s is deprecated, use %s instead.', $className, $deprecatedClassesWithAliases[$className]));
×
121

122
        class_alias($deprecatedClassesWithAliases[$className], $className);
×
123

124
        return;
×
125
    }
126
});
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc