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

api-platform / core / 10670547877

02 Sep 2024 04:30PM UTC coverage: 72.524% (-1.8%) from 74.332%
10670547877

push

github

web-flow
fix(doctrine): move event listeners to doctrine/common (#6573)

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

81 existing lines in 4 files now uncovered.

3149 of 4342 relevant lines covered (72.52%)

76.7 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,
×
33
    ApiPlatform\Exception\ExceptionInterface::class => ApiPlatform\Metadata\Exception\ExceptionInterface::class,
×
34
    ApiPlatform\Exception\InvalidArgumentException::class => ApiPlatform\Metadata\Exception\InvalidArgumentException::class,
×
35
    ApiPlatform\Exception\InvalidIdentifierException::class => ApiPlatform\Metadata\Exception\InvalidIdentifierException::class,
×
36
    ApiPlatform\Exception\InvalidUriVariableException::class => ApiPlatform\Metadata\Exception\InvalidUriVariableException::class,
×
37
    ApiPlatform\Exception\ItemNotFoundException::class => ApiPlatform\Metadata\Exception\ItemNotFoundException::class,
×
38
    ApiPlatform\Exception\NotExposedHttpException::class => ApiPlatform\Metadata\Exception\NotExposedHttpException::class,
×
39
    ApiPlatform\Exception\OperationNotFoundException::class => ApiPlatform\Metadata\Exception\OperationNotFoundException::class,
×
40
    ApiPlatform\Exception\PropertyNotFoundException::class => ApiPlatform\Metadata\Exception\PropertyNotFoundException::class,
×
41
    ApiPlatform\Exception\ResourceClassNotFoundException::class => ApiPlatform\Metadata\Exception\ResourceClassNotFoundException::class,
×
42
    ApiPlatform\Exception\RuntimeException::class => ApiPlatform\Metadata\Exception\RuntimeException::class,
×
43
    ApiPlatform\GraphQl\Type\TypeBuilderInterface::class => ApiPlatform\GraphQl\Type\ContextAwareTypeBuilderInterface::class,
×
44
    ApiPlatform\GraphQl\Type\TypeBuilderEnumInterface::class => ApiPlatform\GraphQl\Type\ContextAwareTypeBuilderInterface::class,
×
45
    ApiPlatform\Operation\DashPathSegmentNameGenerator::class => ApiPlatform\Metadata\Operation\DashPathSegmentNameGenerator::class,
×
46
    ApiPlatform\Operation\UnderscorePathSegmentNameGenerator::class => ApiPlatform\Metadata\Operation\UnderscorePathSegmentNameGenerator::class,
×
47
    ApiPlatform\Operation\PathSegmentNameGeneratorInterface::class => ApiPlatform\Metadata\Operation\PathSegmentNameGeneratorInterface::class,
×
48
    ApiPlatform\Symfony\Bundle\Command\OpenApiCommand::class => ApiPlatform\OpenApi\Command\OpenApiCommand::class,
×
49
    ApiPlatform\Util\ClientTrait::class => ApiPlatform\Symfony\Bundle\Test\ClientTrait::class,
×
50
    ApiPlatform\Util\RequestAttributesExtractor::class => ApiPlatform\State\Util\RequestAttributesExtractor::class,
×
51
    ApiPlatform\Symfony\Util\RequestAttributesExtractor::class => ApiPlatform\State\Util\RequestAttributesExtractor::class,
×
NEW
52
    ApiPlatform\Doctrine\EventListener\PublishMercureUpdatesListener::class => ApiPlatform\Doctrine\Common\EventListener\PublishMercureUpdatesListener::class,
×
NEW
53
    ApiPlatform\Doctrine\EventListener\PurgeHttpCacheListener::class => ApiPlatform\Doctrine\Common\EventListener\PurgeHttpCacheListener::class,
×
UNCOV
54
];
×
55

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

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

109
        return;
×
110
    }
111

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

115
        return;
×
116
    }
117

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

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

123
        return;
×
124
    }
125
});
×
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