1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Node;
4:
5: use Override;
6: use PhpParser\Node;
7: use PhpParser\NodeAbstract;
8: use PHPStan\Analyser\ExpressionResult;
9: use PHPStan\Analyser\StatementResult;
10:
11: /**
12: * @api
13: */
14: final class ExecutionEndNode extends NodeAbstract implements VirtualNode
15: {
16:
17: public function __construct(
18: private Node\Stmt $node,
19: private StatementResult $statementResult,
20: private bool $hasNativeReturnTypehint,
21: private ?ExpressionResult $exprResult = null,
22: )
23: {
24: parent::__construct($node->getAttributes());
25: }
26:
27: public function getNode(): Node\Stmt
28: {
29: return $this->node;
30: }
31:
32: /**
33: * The result of the expression the ending statement evaluated. Null when the
34: * statement is not an expression statement, for the synthetic statement
35: * wrapping a closure with an empty body, and when the expression was walked
36: * into a storage the end node is not built in.
37: *
38: * @internal
39: */
40: public function getExprResult(): ?ExpressionResult
41: {
42: return $this->exprResult;
43: }
44:
45: public function getStatementResult(): StatementResult
46: {
47: return $this->statementResult;
48: }
49:
50: public function hasNativeReturnTypehint(): bool
51: {
52: return $this->hasNativeReturnTypehint;
53: }
54:
55: #[Override]
56: public function getType(): string
57: {
58: return 'PHPStan_Node_ExecutionEndNode';
59: }
60:
61: /**
62: * @return string[]
63: */
64: #[Override]
65: public function getSubNodeNames(): array
66: {
67: return [];
68: }
69:
70: }
71: