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

api-platform / core / 6774876659

06 Nov 2023 06:18PM UTC coverage: 37.409%. Remained the same
6774876659

push

github

soyuka
Merge 3.2

10 of 15 new or added lines in 7 files covered. (66.67%)

1 existing line in 1 file now uncovered.

10322 of 27592 relevant lines covered (37.41%)

20.6 hits per line

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

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

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

19
/**
20
 * Converts {@see \Symfony\Component\Validator\ConstraintViolationListInterface} the API Problem spec (RFC 7807).
21
 *
22
 * @author Kévin Dunglas <dunglas@gmail.com>
23
 */
24
final class ConstraintViolationListNormalizer extends AbstractConstraintViolationListNormalizer
25
{
26
    public const FORMAT = 'json';
27

28
    private array $defaultContext = [];
29

30
    public function __construct(array $serializePayloadFields = null, NameConverterInterface $nameConverter = null, array $defaultContext = [])
31
    {
32
        parent::__construct($serializePayloadFields, $nameConverter);
87✔
33

34
        $this->defaultContext = array_merge($this->defaultContext, $defaultContext);
87✔
35
    }
36

37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function normalize(mixed $object, string $format = null, array $context = []): array
41
    {
NEW
42
        return $this->getViolations($object);
×
43
    }
44
}
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