6
6
7
7
use Override ;
8
8
use Psalm \CodeLocation ;
9
- use Psalm \Storage \ImmutableNonCloneableTrait ;
10
9
use Stringable ;
11
10
12
11
use function strtolower ;
@@ -30,7 +29,7 @@ public function __construct(
30
29
/**
31
30
* @var array<string, array<string, string>>
32
31
*/
33
- public readonly array $ specialized_calls = [],
32
+ public readonly array $ specialized_calls = [],
34
33
) {
35
34
}
36
35
@@ -43,7 +42,7 @@ public static function make(
43
42
string $ label ,
44
43
?CodeLocation $ code_location ,
45
44
?string $ specialization_key = null ,
46
- int $ taints = 0
45
+ int $ taints = 0 ,
47
46
): self {
48
47
if ($ specialization_key === null ) {
49
48
$ unspecialized_id = null ;
@@ -57,7 +56,7 @@ public static function make(
57
56
$ specialization_key ,
58
57
$ label ,
59
58
$ code_location ,
60
- $ taints
59
+ $ taints,
61
60
);
62
61
}
63
62
@@ -91,11 +90,17 @@ public static function getForMethodArgument(
91
90
public static function getForAssignment (
92
91
string $ var_id ,
93
92
CodeLocation $ assignment_location ,
94
- string $ specialization_key = '' ,
93
+ ? string $ specialization_key = null ,
95
94
): self {
96
- $ specialization_key .= '- ' . $ assignment_location ->file_name
97
- . ': ' . $ assignment_location ->raw_file_start
98
- . '- ' . $ assignment_location ->raw_file_end ;
95
+ if ($ specialization_key === null ) {
96
+ $ specialization_key = $ assignment_location ->file_name
97
+ . ': ' . $ assignment_location ->raw_file_start
98
+ . '- ' . $ assignment_location ->raw_file_end ;
99
+ } else {
100
+ $ specialization_key .= '- ' . $ assignment_location ->file_name
101
+ . ': ' . $ assignment_location ->raw_file_start
102
+ . '- ' . $ assignment_location ->raw_file_end ;
103
+ }
99
104
100
105
return self ::make ($ var_id , $ var_id , $ assignment_location , $ specialization_key );
101
106
}
@@ -105,7 +110,7 @@ public static function getForMethodReturn(
105
110
string $ cased_method_id ,
106
111
?CodeLocation $ code_location ,
107
112
?CodeLocation $ function_location = null ,
108
- int $ taints = 0
113
+ int $ taints = 0 ,
109
114
): self {
110
115
$ specialization_key = null ;
111
116
@@ -153,7 +158,7 @@ public function setTaints(int $taints): self
153
158
$ taints ,
154
159
$ this ->taintSource ,
155
160
$ this ->path_types ,
156
- $ this ->specialized_calls
161
+ $ this ->specialized_calls ,
157
162
);
158
163
}
159
164
0 commit comments