1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Node;
4:
5: use Override;
6: use PhpParser\Node\PropertyHook;
7: use PhpParser\NodeAbstract;
8: use PHPStan\Analyser\ImpurePoint;
9: use PHPStan\Analyser\StatementResult;
10: use PHPStan\Reflection\ClassReflection;
11: use PHPStan\Reflection\Php\PhpMethodFromParserNodeReflection;
12: use PHPStan\Reflection\Php\PhpPropertyReflection;
13: use PHPStan\Turbo\ReferencedByTurboExtension;
14:
15: /**
16: * @api
17: */
18: #[ReferencedByTurboExtension(key: 'propertyHookReturnStatementsNode')]
19: final class PropertyHookReturnStatementsNode extends NodeAbstract implements ReturnStatementsNode
20: {
21:
22: /**
23: * @param list<ReturnStatement> $returnStatements
24: * @param list<ReturnStatement> $returnStatementsAfterFinally
25: * @param list<ExecutionEndNode> $executionEnds
26: * @param ImpurePoint[] $impurePoints
27: */
28: public function __construct(
29: private PropertyHook $hook,
30: private array $returnStatements,
31: private array $returnStatementsAfterFinally,
32: private StatementResult $statementResult,
33: private array $executionEnds,
34: private array $impurePoints,
35: private ClassReflection $classReflection,
36: private PhpMethodFromParserNodeReflection $hookReflection,
37: private PhpPropertyReflection $propertyReflection,
38: )
39: {
40: parent::__construct($hook->getAttributes());
41: }
42:
43: public function getPropertyHookNode(): PropertyHook
44: {
45: return $this->hook;
46: }
47:
48: public function returnsByRef(): bool
49: {
50: return $this->hook->byRef;
51: }
52:
53: public function hasNativeReturnTypehint(): bool
54: {
55: return false;
56: }
57:
58: public function getYieldStatements(): array
59: {
60: return [];
61: }
62:
63: public function isGenerator(): bool
64: {
65: return false;
66: }
67:
68: public function getReturnStatements(): array
69: {
70: return $this->returnStatements;
71: }
72:
73: public function getReturnStatementsAfterFinally(): array
74: {
75: return $this->returnStatementsAfterFinally;
76: }
77:
78: public function getStatementResult(): StatementResult
79: {
80: return $this->statementResult;
81: }
82:
83: public function getExecutionEnds(): array
84: {
85: return $this->executionEnds;
86: }
87:
88: public function getImpurePoints(): array
89: {
90: return $this->impurePoints;
91: }
92:
93: public function getClassReflection(): ClassReflection
94: {
95: return $this->classReflection;
96: }
97:
98: public function getHookReflection(): PhpMethodFromParserNodeReflection
99: {
100: return $this->hookReflection;
101: }
102:
103: public function getPropertyReflection(): PhpPropertyReflection
104: {
105: return $this->propertyReflection;
106: }
107:
108: #[Override]
109: public function getType(): string
110: {
111: return 'PHPStan_Node_PropertyHookReturnStatementsNode';
112: }
113:
114: /**
115: * @return string[]
116: */
117: #[Override]
118: public function getSubNodeNames(): array
119: {
120: return [];
121: }
122:
123: }
124: