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