xref: /PHP-Parser/lib/PhpParser/Node/Expr/Match_.php (revision f4961b89)
1<?php declare(strict_types=1);
2
3namespace PhpParser\Node\Expr;
4
5use PhpParser\Node;
6use PhpParser\Node\MatchArm;
7
8class Match_ extends Node\Expr {
9    /** @var Node\Expr Condition */
10    public Node\Expr $cond;
11    /** @var MatchArm[] */
12    public array $arms;
13
14    /**
15     * @param Node\Expr $cond Condition
16     * @param MatchArm[] $arms
17     * @param array<string, mixed> $attributes Additional attributes
18     */
19    public function __construct(Node\Expr $cond, array $arms = [], array $attributes = []) {
20        $this->attributes = $attributes;
21        $this->cond = $cond;
22        $this->arms = $arms;
23    }
24
25    public function getSubNodeNames(): array {
26        return ['cond', 'arms'];
27    }
28
29    public function getType(): string {
30        return 'Expr_Match';
31    }
32}
33