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:
14: /**
15: * @api
16: */
17: final class PropertyHookReturnStatementsNode extends NodeAbstract implements ReturnStatementsNode
18: {
19:
20: /**
21: * @param list<ReturnStatement> $returnStatements
22: * @param list<ExecutionEndNode> $executionEnds
23: * @param ImpurePoint[] $impurePoints
24: */
25: public function __construct(
26: private PropertyHook $hook,
27: private array $returnStatements,
28: private StatementResult $statementResult,
29: private array $executionEnds,
30: private array $impurePoints,
31: private ClassReflection $classReflection,
32: private PhpMethodFromParserNodeReflection $hookReflection,
33: private PhpPropertyReflection $propertyReflection,
34: )
35: {
36: parent::__construct($hook->getAttributes());
37: }
38:
39: public function getPropertyHookNode(): PropertyHook
40: {
41: return $this->hook;
42: }
43:
44: public function returnsByRef(): bool
45: {
46: return $this->hook->byRef;
47: }
48:
49: public function hasNativeReturnTypehint(): bool
50: {
51: return false;
52: }
53:
54: public function getYieldStatements(): array
55: {
56: return [];
57: }
58:
59: public function isGenerator(): bool
60: {
61: return false;
62: }
63:
64: public function getReturnStatements(): array
65: {
66: return $this->returnStatements;
67: }
68:
69: public function getStatementResult(): StatementResult
70: {
71: return $this->statementResult;
72: }
73:
74: public function getExecutionEnds(): array
75: {
76: return $this->executionEnds;
77: }
78:
79: public function getImpurePoints(): array
80: {
81: return $this->impurePoints;
82: }
83:
84: public function getClassReflection(): ClassReflection
85: {
86: return $this->classReflection;
87: }
88:
89: public function getHookReflection(): PhpMethodFromParserNodeReflection
90: {
91: return $this->hookReflection;
92: }
93:
94: public function getPropertyReflection(): PhpPropertyReflection
95: {
96: return $this->propertyReflection;
97: }
98:
99: #[Override]
100: public function getType(): string
101: {
102: return 'PHPStan_Node_PropertyHookReturnStatementsNode';
103: }
104:
105: /**
106: * @return string[]
107: */
108: #[Override]
109: public function getSubNodeNames(): array
110: {
111: return [];
112: }
113:
114: }
115: