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

api-platform / core / 19799301771

30 Nov 2025 01:04PM UTC coverage: 25.229% (-0.03%) from 25.257%
19799301771

push

github

web-flow
fix(metadata): repeatable attribute mutators (#7542)

14557 of 57700 relevant lines covered (25.23%)

28.11 hits per line

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

100.0
/src/Symfony/Bundle/DependencyInjection/Compiler/MetadataAwareNameConverterPass.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
namespace ApiPlatform\Symfony\Bundle\DependencyInjection\Compiler;
15

16
use ApiPlatform\Metadata\Exception\RuntimeException;
17
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
18
use Symfony\Component\DependencyInjection\ContainerBuilder;
19
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
20
use Symfony\Component\DependencyInjection\Reference;
21

22
/**
23
 * Injects the metadata aware name converter if available.
24
 *
25
 * @internal
26
 *
27
 * @author Antoine Bluchet <soyuka@gmail.com>
28
 */
29
final class MetadataAwareNameConverterPass implements CompilerPassInterface
30
{
31
    /**
32
     * {@inheritdoc}
33
     *
34
     * @throws RuntimeException
35
     * @throws InvalidArgumentException
36
     */
37
    public function process(ContainerBuilder $container): void
38
    {
39
        if (!$container->hasDefinition('serializer.name_converter.metadata_aware')) {
14✔
40
            return;
2✔
41
        }
42

43
        if ($container->hasAlias('api_platform.name_converter')) {
12✔
44
            $nameConverter = (string) $container->getAlias('api_platform.name_converter');
10✔
45

46
            $container->setParameter('.serializer.name_converter', $nameConverter);
10✔
47
            $container->getDefinition('serializer.name_converter.metadata_aware')->setArgument(1, new Reference($nameConverter));
10✔
48
        }
49

50
        $container->setAlias('api_platform.name_converter', 'serializer.name_converter.metadata_aware');
12✔
51
    }
52
}
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