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

api-platform / core / 20969151198

13 Jan 2026 07:07PM UTC coverage: 0.0% (-29.1%) from 29.095%
20969151198

Pull #7669

github

web-flow
Merge 872bbc755 into c8493bbe7
Pull Request #7669: ci - fix testMapPutAllowCreate

0 of 57775 relevant lines covered (0.0%)

0.0 hits per line

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

0.0
/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
    {
24
    }
×
25

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

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

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

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

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

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

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