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

api-platform / core / 20847864477

09 Jan 2026 09:47AM UTC coverage: 29.1% (+0.005%) from 29.095%
20847864477

Pull #7649

github

web-flow
Merge b342dd5db into d640d106b
Pull Request #7649: feat(validator): uuid/ulid parameter validation

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

15050 existing lines in 491 files now uncovered.

16996 of 58406 relevant lines covered (29.1%)

81.8 hits per line

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

92.31
/src/Symfony/Validator/Serializer/ValidationExceptionNormalizer.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\Validator\Serializer;
15

16
use ApiPlatform\Validator\Exception\ValidationException;
17
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
18
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
19

20
class ValidationExceptionNormalizer implements NormalizerInterface
21
{
22
    public function __construct(private readonly NormalizerInterface $decorated, private readonly ?NameConverterInterface $nameConverter)
23
    {
UNCOV
24
    }
2,409✔
25

26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
30
    {
UNCOV
31
        $messages = [];
117✔
UNCOV
32
        foreach ($data->getConstraintViolationList() as $violation) {
117✔
UNCOV
33
            $class = \is_object($root = $violation->getRoot()) ? $root::class : null;
114✔
34

UNCOV
35
            if ($this->nameConverter) {
114✔
UNCOV
36
                $propertyPath = $this->nameConverter->normalize($violation->getPropertyPath(), $class, $format);
114✔
37
            } else {
38
                $propertyPath = $violation->getPropertyPath();
×
39
            }
40

UNCOV
41
            $messages[] = ($propertyPath ? "{$propertyPath}: " : '').$violation->getMessage();
114✔
42
        }
43

UNCOV
44
        $str = implode("\n", $messages);
117✔
UNCOV
45
        $data->setDetail($str);
117✔
46

UNCOV
47
        return $this->decorated->normalize($data, $format, $context);
117✔
48
    }
49

50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
54
    {
UNCOV
55
        return $data instanceof ValidationException && $this->decorated->supportsNormalization($data, $format, $context);
117✔
56
    }
57

58
    /**
59
     * {@inheritdoc}
60
     */
61
    public function getSupportedTypes(?string $format): array
62
    {
UNCOV
63
        return [ValidationException::class => false];
2,140✔
64
    }
65
}
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