/
AfterMethodCallAnalysisEvent.php
143 lines (128 loc) · 3.11 KB
/
AfterMethodCallAnalysisEvent.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
namespace Psalm\Plugin\EventHandler\Event;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\StaticCall;
use Psalm\Codebase;
use Psalm\Context;
use Psalm\FileManipulation;
use Psalm\StatementsSource;
use Psalm\Type\Union;
final class AfterMethodCallAnalysisEvent
{
/**
* @var MethodCall|StaticCall
*/
private $expr;
/**
* @var string
*/
private $method_id;
/**
* @var string
*/
private $appearing_method_id;
/**
* @var string
*/
private $declaring_method_id;
/**
* @var Context
*/
private $context;
/**
* @var StatementsSource
*/
private $statements_source;
/**
* @var Codebase
*/
private $codebase;
/**
* @var FileManipulation[]
*/
private $file_replacements;
/**
* @var Union|null
*/
private $return_type_candidate;
/**
* @param MethodCall|StaticCall $expr
* @param FileManipulation[] $file_replacements
* @internal
*/
public function __construct(
Expr $expr,
string $method_id,
string $appearing_method_id,
string $declaring_method_id,
Context $context,
StatementsSource $statements_source,
Codebase $codebase,
array $file_replacements = [],
Union $return_type_candidate = null
) {
$this->expr = $expr;
$this->method_id = $method_id;
$this->appearing_method_id = $appearing_method_id;
$this->declaring_method_id = $declaring_method_id;
$this->context = $context;
$this->statements_source = $statements_source;
$this->codebase = $codebase;
$this->file_replacements = $file_replacements;
$this->return_type_candidate = $return_type_candidate;
}
/**
* @return MethodCall|StaticCall
*/
public function getExpr(): Expr
{
return $this->expr;
}
public function getMethodId(): string
{
return $this->method_id;
}
public function getAppearingMethodId(): string
{
return $this->appearing_method_id;
}
public function getDeclaringMethodId(): string
{
return $this->declaring_method_id;
}
public function getContext(): Context
{
return $this->context;
}
public function getStatementsSource(): StatementsSource
{
return $this->statements_source;
}
public function getCodebase(): Codebase
{
return $this->codebase;
}
/**
* @return FileManipulation[]
*/
public function getFileReplacements(): array
{
return $this->file_replacements;
}
public function getReturnTypeCandidate(): ?Union
{
return $this->return_type_candidate;
}
/**
* @param FileManipulation[] $file_replacements
*/
public function setFileReplacements(array $file_replacements): void
{
$this->file_replacements = $file_replacements;
}
public function setReturnTypeCandidate(?Union $return_type_candidate): void
{
$this->return_type_candidate = $return_type_candidate;
}
}