1<?php declare(strict_types=1);
2
3namespace PhpParser\Node;
4
5use PhpParser\NodeAbstract;
6
7class Arg extends NodeAbstract
8{
9    /** @var Identifier|null Parameter name (for named parameters) */
10    public $name;
11    /** @var Expr Value to pass */
12    public $value;
13    /** @var bool Whether to pass by ref */
14    public $byRef;
15    /** @var bool Whether to unpack the argument */
16    public $unpack;
17
18    /**
19     * Constructs a function call argument node.
20     *
21     * @param Expr  $value      Value to pass
22     * @param bool  $byRef      Whether to pass by ref
23     * @param bool  $unpack     Whether to unpack the argument
24     * @param array $attributes Additional attributes
25     * @param Identifier|null $name Parameter name (for named parameters)
26     */
27    public function __construct(
28        Expr $value, bool $byRef = false, bool $unpack = false, array $attributes = [],
29        Identifier $name = null
30    ) {
31        $this->attributes = $attributes;
32        $this->name = $name;
33        $this->value = $value;
34        $this->byRef = $byRef;
35        $this->unpack = $unpack;
36    }
37
38    public function getSubNodeNames() : array {
39        return ['name', 'value', 'byRef', 'unpack'];
40    }
41
42    public function getType() : string {
43        return 'Arg';
44    }
45}
46