xref: /PHP-Parser/lib/PhpParser/Node/Expr/New_.php (revision ea778075)
1<?php declare(strict_types=1);
2
3namespace PhpParser\Node\Expr;
4
5use PhpParser\Node;
6use PhpParser\Node\Arg;
7use PhpParser\Node\Expr;
8use PhpParser\Node\VariadicPlaceholder;
9
10class New_ extends CallLike {
11    /** @var Node\Name|Expr|Node\Stmt\Class_ Class name */
12    public Node $class;
13    /** @var array<Arg|VariadicPlaceholder> Arguments */
14    public array $args;
15
16    /**
17     * Constructs a function call node.
18     *
19     * @param Node\Name|Expr|Node\Stmt\Class_ $class Class name (or class node for anonymous classes)
20     * @param array<Arg|VariadicPlaceholder> $args Arguments
21     * @param array<string, mixed> $attributes Additional attributes
22     */
23    public function __construct(Node $class, array $args = [], array $attributes = []) {
24        $this->attributes = $attributes;
25        $this->class = $class;
26        $this->args = $args;
27    }
28
29    public function getSubNodeNames(): array {
30        return ['class', 'args'];
31    }
32
33    public function getType(): string {
34        return 'Expr_New';
35    }
36
37    public function getRawArgs(): array {
38        return $this->args;
39    }
40}
41