1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Node;
4:
5: use Override;
6: use PhpParser\Node\Arg;
7: use PhpParser\Node\ArgPlaceholder;
8: use PhpParser\Node\Expr;
9: use PhpParser\Node\Name;
10: use PhpParser\Node\VariadicPlaceholder;
11: use PHPStan\Node\Printer\ExprPrinter;
12: use PHPStan\Turbo\ReferencedByTurboExtension;
13:
14: /**
15: * @api
16: */
17: #[ReferencedByTurboExtension(key: 'functionCallableNode')]
18: final class FunctionCallableNode extends Expr implements VirtualNode
19: {
20:
21: public function __construct(private Name|Expr $name, private Expr\FuncCall $originalNode)
22: {
23: // the original's printed expression key must not become this node's
24: $attributes = $this->originalNode->getAttributes();
25: unset($attributes[ExprPrinter::ATTRIBUTE_CACHE_KEY]);
26: parent::__construct($attributes);
27: }
28:
29: /**
30: * @return Expr|Name
31: */
32: public function getName()
33: {
34: return $this->name;
35: }
36:
37: public function getOriginalNode(): Expr\FuncCall
38: {
39: return $this->originalNode;
40: }
41:
42: /**
43: * The arguments of the call: bound arguments, `?` placeholders and the `...` placeholder.
44: *
45: * @return array<Arg|ArgPlaceholder|VariadicPlaceholder>
46: */
47: public function getArgs(): array
48: {
49: return $this->originalNode->getRawArgs();
50: }
51:
52: #[Override]
53: public function getType(): string
54: {
55: return 'PHPStan_Node_FunctionCallableNode';
56: }
57:
58: /**
59: * @return string[]
60: */
61: #[Override]
62: public function getSubNodeNames(): array
63: {
64: return [];
65: }
66:
67: }
68: