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