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

api-platform / core / 14408211113

11 Apr 2025 04:58PM UTC coverage: 61.931% (+0.9%) from 61.025%
14408211113

Pull #7085

github

web-flow
Merge 2461e799a into c5fb664d1
Pull Request #7085: [fix] inverse ternary operator statements

1 of 1 new or added line in 1 file covered. (100.0%)

168 existing lines in 28 files now uncovered.

11482 of 18540 relevant lines covered (61.93%)

68.58 hits per line

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

0.0
/src/Api/QueryParameterValidator/Validator/Bounds.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\Api\QueryParameterValidator\Validator;
15

16
use ApiPlatform\ParameterValidator\Validator\CheckFilterDeprecationsTrait;
17
use ApiPlatform\ParameterValidator\Validator\ValidatorInterface;
18

19
/**
20
 * @deprecated use \ApiPlatform\ParameterValidator\Validator\Bounds instead
21
 */
22
final class Bounds implements ValidatorInterface
23
{
24
    use CheckFilterDeprecationsTrait;
25

26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function validate(string $name, array $filterDescription, array $queryParameters): array
30
    {
31
        $value = $queryParameters[$name] ?? null;
×
32
        if (empty($value) && '0' !== $value) {
×
33
            return [];
×
34
        }
35

36
        $this->checkFilterDeprecations($filterDescription);
×
37

38
        $maximum = $filterDescription['openapi']['maximum'] ?? $filterDescription['swagger']['maximum'] ?? null;
×
39
        $minimum = $filterDescription['openapi']['minimum'] ?? $filterDescription['swagger']['minimum'] ?? null;
×
40

41
        $errorList = [];
×
42

43
        if (null !== $maximum) {
×
44
            if (($filterDescription['openapi']['exclusiveMaximum'] ?? $filterDescription['swagger']['exclusiveMaximum'] ?? false) && $value >= $maximum) {
×
45
                $errorList[] = \sprintf('Query parameter "%s" must be less than %s', $name, $maximum);
×
46
            } elseif ($value > $maximum) {
×
47
                $errorList[] = \sprintf('Query parameter "%s" must be less than or equal to %s', $name, $maximum);
×
48
            }
49
        }
50

51
        if (null !== $minimum) {
×
52
            if (($filterDescription['openapi']['exclusiveMinimum'] ?? $filterDescription['swagger']['exclusiveMinimum'] ?? false) && $value <= $minimum) {
×
53
                $errorList[] = \sprintf('Query parameter "%s" must be greater than %s', $name, $minimum);
×
54
            } elseif ($value < $minimum) {
×
55
                $errorList[] = \sprintf('Query parameter "%s" must be greater than or equal to %s', $name, $minimum);
×
56
            }
57
        }
58

59
        return $errorList;
×
60
    }
61
}
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