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

api-platform / core / 12691826531

09 Jan 2025 02:22PM UTC coverage: 61.963% (-0.2%) from 62.121%
12691826531

push

github

web-flow
 chore: add missing deprecation notices to ParameterValidator  (#6655)

Co-authored-by: soyuka <soyuka@users.noreply.github.com>

2 of 11 new or added lines in 11 files covered. (18.18%)

25 existing lines in 4 files now uncovered.

11475 of 18519 relevant lines covered (61.96%)

68.04 hits per line

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

0.0
/src/ParameterValidator/Exception/ValidationException.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\ParameterValidator\Exception;
15

16
use ApiPlatform\Metadata\Exception\ProblemExceptionInterface;
17

18
/**
19
 * Filter validation exception.
20
 *
21
 * @deprecated use \ApiPlatform\Metadata\Parameter::$constraints instead
22
 *
23
 * @author Julien DENIAU <julien.deniau@gmail.com>
24
 */
25
final class ValidationException extends \Exception implements ValidationExceptionInterface, ProblemExceptionInterface
26
{
27
    /**
28
     * @param string[] $constraintViolationList
29
     */
30
    public function __construct(private readonly array $constraintViolationList, string $message = '', int $code = 0, ?\Exception $previous = null)
31
    {
32
        parent::__construct($message ?: $this->__toString(), $code, $previous);
×
33

NEW
34
        trigger_deprecation('api-platform/core', '3.4', 'The class "%s" is deprecated, use "\ApiPlatform\Metadata\Parameter::$constraints" instead.', __CLASS__);
×
35
    }
36

37
    public function getConstraintViolationList(): array
38
    {
39
        return $this->constraintViolationList;
×
40
    }
41

42
    public function __toString(): string
43
    {
44
        return implode("\n", $this->constraintViolationList);
×
45
    }
46

47
    public function getType(): string
48
    {
49
        return '/parameter_validation/'.$this->code;
×
50
    }
51

52
    public function getTitle(): ?string
53
    {
54
        return $this->message ?: $this->__toString();
×
55
    }
56

57
    public function getStatus(): ?int
58
    {
59
        return 400;
×
60
    }
61

62
    public function getDetail(): ?string
63
    {
64
        return $this->message ?: $this->__toString();
×
65
    }
66

67
    public function getInstance(): ?string
68
    {
69
        return null;
×
70
    }
71
}
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