xref: /PHP-Parser/lib/PhpParser/Node/UnionType.php (revision 2d3dd4e2)
1<?php declare(strict_types=1);
2
3namespace PhpParser\Node;
4
5class UnionType extends ComplexType {
6    /** @var (Identifier|Name|IntersectionType)[] Types */
7    public array $types;
8
9    /**
10     * Constructs a union type.
11     *
12     * @param (Identifier|Name|IntersectionType)[] $types Types
13     * @param array<string, mixed> $attributes Additional attributes
14     */
15    public function __construct(array $types, array $attributes = []) {
16        $this->attributes = $attributes;
17        $this->types = $types;
18    }
19
20    public function getSubNodeNames(): array {
21        return ['types'];
22    }
23
24    public function getType(): string {
25        return 'UnionType';
26    }
27}
28