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

api-platform / schema-generator / 13569276979

27 Feb 2025 02:56PM UTC coverage: 79.019%. First build
13569276979

Pull #430

github

web-flow
Merge fa0bfaf80 into c50ccf54d
Pull Request #430: operation openapi property support

47 of 60 new or added lines in 1 file covered. (78.33%)

1789 of 2264 relevant lines covered (79.02%)

16.16 hits per line

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

0.0
/src/Model/Type/UnionType.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\SchemaGenerator\Model\Type;
15

16
final class UnionType implements CompositeType
17
{
18
    /** @var Type[] */
19
    public array $types;
20

21
    /**
22
     * @param Type[] $types
23
     */
24
    public function __construct(array $types)
25
    {
26
        $this->types = $types;
×
27
    }
28

29
    public function __toString(): string
30
    {
31
        return implode('|', array_map(fn (Type $type) => $type instanceof CompositeType ? '('.$type.')' : $type, $this->types));
×
32
    }
33

34
    public function getPhp(): string
35
    {
36
        // Deduplicate PHP types.
37
        $phpTypes = [];
×
38
        foreach ($this->types as $type) {
×
39
            $phpTypes[$type->getPhp()] = $type;
×
40
        }
41

42
        return implode('|', array_map(fn (Type $type) => $type instanceof CompositeType ? '('.$type->getPhp().')' : $type->getPhp(), $phpTypes));
×
43
    }
44
}
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