1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Node;
4:
5: use PhpParser\Node\Stmt\Function_;
6: use PhpParser\NodeAbstract;
7: use PHPStan\Analyser\StatementResult;
8:
9: /** @api */
10: class FunctionReturnStatementsNode extends NodeAbstract implements ReturnStatementsNode
11: {
12:
13: /**
14: * @param ReturnStatement[] $returnStatements
15: * @param ExecutionEndNode[] $executionEnds
16: */
17: public function __construct(
18: private Function_ $function,
19: private array $returnStatements,
20: private StatementResult $statementResult,
21: private array $executionEnds,
22: )
23: {
24: parent::__construct($function->getAttributes());
25: }
26:
27: /**
28: * @return ReturnStatement[]
29: */
30: public function getReturnStatements(): array
31: {
32: return $this->returnStatements;
33: }
34:
35: public function getStatementResult(): StatementResult
36: {
37: return $this->statementResult;
38: }
39:
40: /**
41: * @return ExecutionEndNode[]
42: */
43: public function getExecutionEnds(): array
44: {
45: return $this->executionEnds;
46: }
47:
48: public function returnsByRef(): bool
49: {
50: return $this->function->byRef;
51: }
52:
53: public function hasNativeReturnTypehint(): bool
54: {
55: return $this->function->returnType !== null;
56: }
57:
58: public function getType(): string
59: {
60: return 'PHPStan_Node_FunctionReturnStatementsNode';
61: }
62:
63: /**
64: * @return string[]
65: */
66: public function getSubNodeNames(): array
67: {
68: return [];
69: }
70:
71: }
72: