xref: /PHP-Parser/lib/PhpParser/Node/StaticVar.php (revision 2d3dd4e2)
1<?php declare(strict_types=1);
2
3namespace PhpParser\Node;
4
5use PhpParser\Node;
6use PhpParser\NodeAbstract;
7
8class StaticVar extends NodeAbstract {
9    /** @var Expr\Variable Variable */
10    public Expr\Variable $var;
11    /** @var null|Node\Expr Default value */
12    public ?Expr $default;
13
14    /**
15     * Constructs a static variable node.
16     *
17     * @param Expr\Variable $var Name
18     * @param null|Node\Expr $default Default value
19     * @param array<string, mixed> $attributes Additional attributes
20     */
21    public function __construct(
22        Expr\Variable $var, ?Node\Expr $default = null, array $attributes = []
23    ) {
24        $this->attributes = $attributes;
25        $this->var = $var;
26        $this->default = $default;
27    }
28
29    public function getSubNodeNames(): array {
30        return ['var', 'default'];
31    }
32
33    public function getType(): string {
34        return 'StaticVar';
35    }
36}
37
38// @deprecated compatibility alias
39class_alias(StaticVar::class, Stmt\StaticVar::class);
40