1<?php
2
3declare(strict_types=1);
4
5namespace JMS\Serializer\Exception;
6
7use Symfony\Component\Validator\ConstraintViolationListInterface;
8
9class ValidationFailedException extends RuntimeException
10{
11    /**
12     * @var ConstraintViolationListInterface
13     */
14    private $list;
15
16    public function __construct(ConstraintViolationListInterface $list)
17    {
18        parent::__construct(sprintf('Validation failed with %d error(s).', \count($list)));
19
20        $this->list = $list;
21    }
22
23    public function getConstraintViolationList(): ConstraintViolationListInterface
24    {
25        return $this->list;
26    }
27}
28