| @@ -24,20 +24,19 @@ | ||
| 24 | 24 | * @internal |
| 25 | 25 | */ |
| 26 | 26 | class FunctionNode extends AbstractNode |
| 27 | 27 | { |
| 28 | - private NodeInterface $selector; | |
| 29 | 28 | private string $name; |
| 30 | - private array $arguments; | |
| 31 | 29 | |
| 32 | 30 | /** |
| 33 | 31 | * @param Token[] $arguments |
| 34 | 32 | */ |
| 35 | - public function __construct(NodeInterface $selector, string $name, array $arguments = []) | |
| 36 | - { | |
| 37 | - $this->selector = $selector; | |
| 33 | + public function __construct( | |
| 34 | + private NodeInterface $selector, | |
| 35 | + string $name, | |
| 36 | + private array $arguments = [], | |
| 37 | + ) { | |
| 38 | 38 | $this->name = strtolower($name); |
| 39 | - $this->arguments = $arguments; | |
| 40 | 39 | } |
| 41 | 40 | |
| 42 | 41 | public function getSelector(): NodeInterface |
| 43 | 42 | { |
| @@ -63,9 +62,9 @@ | ||
| 63 | 62 | } |
| 64 | 63 | |
| 65 | 64 | public function __toString(): string |
| 66 | 65 | { |
| 67 | - $arguments = implode(', ', array_map(fn (Token $token) => "'".$token->getValue()."'", $this->arguments)); | |
| 66 | + $arguments = implode(', ', array_map(static fn (Token $token) => "'".$token->getValue()."'", $this->arguments)); | |
| 68 | 67 | |
| 69 | 68 | return \sprintf('%s[%s:%s(%s)]', $this->getNodeName(), $this->selector, $this->name, $arguments ? '['.$arguments.']' : ''); |
| 70 | 69 | } |
| 71 | 70 | } |