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

api-platform / core / 14925420478

09 May 2025 09:03AM UTC coverage: 7.739% (+0.6%) from 7.179%
14925420478

Pull #7134

github

web-flow
Merge a0984c209 into 4ddce1f53
Pull Request #7134: refactor(metadata): type parameters to list<string>|string

48 of 134 new or added lines in 15 files covered. (35.82%)

2 existing lines in 2 files now uncovered.

12267 of 158510 relevant lines covered (7.74%)

15.54 hits per line

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

0.0
/tests/Fixtures/TestBundle/ApiResource/Issue6673/MutlipleParameterProvider.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\Tests\Fixtures\TestBundle\ApiResource\Issue6673;
15

16
use ApiPlatform\Metadata\GetCollection;
17
use ApiPlatform\Metadata\Operation;
18
use ApiPlatform\Metadata\Parameter;
19
use ApiPlatform\Metadata\QueryParameter;
20
use Symfony\Component\TypeInfo\Type\BuiltinType;
21
use Symfony\Component\TypeInfo\TypeIdentifier;
22

23
#[GetCollection(
24
    uriTemplate: 'issue6673_multiple_parameter_provider',
×
25
    shortName: 'multiple_parameter_provider',
×
26
    outputFormats: ['json'],
×
27
    parameters: [
×
28
        'a' => new QueryParameter(
×
29
            provider: [self::class, 'parameterOneProvider'],
×
NEW
30
            nativeType: new BuiltinType(TypeIdentifier::STRING),
×
31
        ),
×
32
        'b' => new QueryParameter(
×
33
            provider: [self::class, 'parameterTwoProvider'],
×
NEW
34
            nativeType: new BuiltinType(TypeIdentifier::STRING),
×
35
        ),
×
36
    ],
×
37
    provider: [self::class, 'provide']
×
38
)]
×
39
final class MutlipleParameterProvider
40
{
41
    public function __construct(public readonly string $id)
42
    {
43
    }
×
44

45
    public static function provide(Operation $operation): ?array
46
    {
47
        return $operation->getNormalizationContext();
×
48
    }
49

50
    public static function parameterOneProvider(Parameter $parameter, array $parameters = [], array $context = []): ?Operation
51
    {
52
        $operation = $context['operation'];
×
53
        $context = $operation->getNormalizationContext() ?? [];
×
54
        $context['a'] = $parameter->getValue();
×
55

56
        return $operation->withNormalizationContext($context);
×
57
    }
58

59
    public static function parameterTwoProvider(Parameter $parameter, array $parameters = [], array $context = []): ?Operation
60
    {
61
        $operation = $context['operation'];
×
62
        $context = $operation->getNormalizationContext() ?? [];
×
63
        $context['b'] = $parameter->getValue();
×
64

65
        return $operation->withNormalizationContext($context);
×
66
    }
67
}
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