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

api-platform / core / 9838430407

08 Jul 2024 11:06AM UTC coverage: 64.738% (-0.1%) from 64.857%
9838430407

push

github

web-flow
feat: deprecate query parameter validator (#6454)

51 of 60 new or added lines in 8 files covered. (85.0%)

34 existing lines in 10 files now uncovered.

11480 of 17733 relevant lines covered (64.74%)

68.99 hits per line

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

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

16
/**
17
 * @deprecated use Parameter constraint instead
18
 */
19
final class MultipleOf implements ValidatorInterface
20
{
21
    use CheckFilterDeprecationsTrait;
22

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

33
        $this->checkFilterDeprecations($filterDescription);
×
34

35
        $multipleOf = $filterDescription['openapi']['multipleOf'] ?? $filterDescription['swagger']['multipleOf'] ?? null;
×
36

37
        if (null !== $multipleOf && 0 !== ($value % $multipleOf)) {
×
38
            return [
×
39
                sprintf('Query parameter "%s" must multiple of %s', $name, $multipleOf),
×
40
            ];
×
41
        }
42

43
        return [];
×
44
    }
45
}
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