xref: /PHP-Parser/lib/PhpParser/Node/Expr/Yield_.php (revision 2d3dd4e2)
1<?php declare(strict_types=1);
2
3namespace PhpParser\Node\Expr;
4
5use PhpParser\Node\Expr;
6
7class Yield_ extends Expr {
8    /** @var null|Expr Key expression */
9    public ?Expr $key;
10    /** @var null|Expr Value expression */
11    public ?Expr $value;
12
13    /**
14     * Constructs a yield expression node.
15     *
16     * @param null|Expr $value Value expression
17     * @param null|Expr $key Key expression
18     * @param array<string, mixed> $attributes Additional attributes
19     */
20    public function __construct(?Expr $value = null, ?Expr $key = null, array $attributes = []) {
21        $this->attributes = $attributes;
22        $this->key = $key;
23        $this->value = $value;
24    }
25
26    public function getSubNodeNames(): array {
27        return ['key', 'value'];
28    }
29
30    public function getType(): string {
31        return 'Expr_Yield';
32    }
33}
34