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

api-platform / core / 6417366242

05 Oct 2023 09:43AM UTC coverage: 37.131% (+0.05%) from 37.083%
6417366242

push

github

web-flow
fix(validation): normalize constraint violation list (#5866)

27 of 27 new or added lines in 4 files covered. (100.0%)

10156 of 27352 relevant lines covered (37.13%)

20.01 hits per line

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

50.0
/src/Hal/Serializer/ConstraintViolationListNormalizer.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\Hal\Serializer;
15

16
use ApiPlatform\Serializer\AbstractConstraintViolationListNormalizer;
17
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
18

19
/**
20
 * Converts {@see \Symfony\Component\Validator\ConstraintViolationListInterface} to a Hal error representation.
21
 */
22
final class ConstraintViolationListNormalizer extends AbstractConstraintViolationListNormalizer
23
{
24
    public const FORMAT = 'json';
25

26
    public function __construct(array $serializePayloadFields = null, NameConverterInterface $nameConverter = null)
27
    {
28
        parent::__construct($serializePayloadFields, $nameConverter);
81✔
29
    }
30

31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
35
    {
36
        return $this->getViolations($object);
×
37
    }
38
}
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

© 2025 Coveralls, Inc