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\Identifier;
10: use PhpParser\Node\Name;
11: use PhpParser\Node\VariadicPlaceholder;
12: use PHPStan\Node\Printer\ExprPrinter;
13: use PHPStan\Turbo\ReferencedByTurboExtension;
14:
15: /**
16: * @api
17: */
18: #[ReferencedByTurboExtension(key: 'staticMethodCallableNode')]
19: final class StaticMethodCallableNode extends Expr implements VirtualNode
20: {
21:
22: public function __construct(
23: private Name|Expr $class,
24: private Identifier|Expr $name,
25: private Expr\StaticCall $originalNode,
26: )
27: {
28: // the original's printed expression key must not become this node's
29: $attributes = $originalNode->getAttributes();
30: unset($attributes[ExprPrinter::ATTRIBUTE_CACHE_KEY]);
31: parent::__construct($attributes);
32: }
33:
34: /**
35: * @return Expr|Name
36: */
37: public function getClass()
38: {
39: return $this->class;
40: }
41:
42: /**
43: * @return Identifier|Expr
44: */
45: public function getName()
46: {
47: return $this->name;
48: }
49:
50: public function getOriginalNode(): Expr\StaticCall
51: {
52: return $this->originalNode;
53: }
54:
55: /**
56: * The arguments of the call: bound arguments, `?` placeholders and the `...` placeholder.
57: *
58: * @return array<Arg|ArgPlaceholder|VariadicPlaceholder>
59: */
60: public function getArgs(): array
61: {
62: return $this->originalNode->getRawArgs();
63: }
64:
65: #[Override]
66: public function getType(): string
67: {
68: return 'PHPStan_Node_StaticMethodCallableNode';
69: }
70:
71: /**
72: * @return string[]
73: */
74: #[Override]
75: public function getSubNodeNames(): array
76: {
77: return [];
78: }
79:
80: }
81: