Skip to content

Commit 0766a41

Browse files
committed
Expose @pure-unless-parameter-passed parameters as a function-level map
FunctionPurityCheck read the per-parameter TrinaryLogic flag via ->yes() to find the flagged parameters, which is an equivalent mutation at a declaration site (the flag is only ever Yes or No there, never Maybe). Mirror the @pure-unless-callable-is-impure sibling instead: expose the flagged parameters as a function/method-level array<string, TrinaryLogic> getter and look them up with array_key_exists.
1 parent 472e24d commit 0766a41

21 files changed

Lines changed: 162 additions & 1 deletion

‎src/Reflection/Annotations/AnnotationMethodReflection.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ public function getPureUnlessCallableIsImpureParameters(): array
184184
return [];
185185
}
186186

187+
public function getPureUnlessParameterPassedParameters(): array
188+
{
189+
return [];
190+
}
191+
187192
public function getAttributes(): array
188193
{
189194
return [];

‎src/Reflection/Dummy/ChangedTypeMethodReflection.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ public function getPureUnlessCallableIsImpureParameters(): array
173173
return $this->reflection->getPureUnlessCallableIsImpureParameters();
174174
}
175175

176+
public function getPureUnlessParameterPassedParameters(): array
177+
{
178+
return $this->reflection->getPureUnlessParameterPassedParameters();
179+
}
180+
176181
public function getAttributes(): array
177182
{
178183
return $this->reflection->getAttributes();

‎src/Reflection/Dummy/DummyConstructorReflection.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ public function getPureUnlessCallableIsImpureParameters(): array
158158
return [];
159159
}
160160

161+
public function getPureUnlessParameterPassedParameters(): array
162+
{
163+
return [];
164+
}
165+
161166
public function getAttributes(): array
162167
{
163168
return [];

‎src/Reflection/Dummy/DummyMethodReflection.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ public function getPureUnlessCallableIsImpureParameters(): array
150150
return [];
151151
}
152152

153+
public function getPureUnlessParameterPassedParameters(): array
154+
{
155+
return [];
156+
}
157+
153158
public function getAttributes(): array
154159
{
155160
return [];

‎src/Reflection/ExtendedMethodReflection.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ public function isPure(): TrinaryLogic;
7474
*/
7575
public function getPureUnlessCallableIsImpureParameters(): array;
7676

77+
/**
78+
* @return array<string, TrinaryLogic>
79+
*/
80+
public function getPureUnlessParameterPassedParameters(): array;
81+
7782
/** @return list<AttributeReflection> */
7883
public function getAttributes(): array;
7984

‎src/Reflection/FunctionReflection.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ public function isPure(): TrinaryLogic;
7373
*/
7474
public function getPureUnlessCallableIsImpureParameters(): array;
7575

76+
/**
77+
* @return array<string, TrinaryLogic>
78+
*/
79+
public function getPureUnlessParameterPassedParameters(): array;
80+
7681
/** @return list<AttributeReflection> */
7782
public function getAttributes(): array;
7883

‎src/Reflection/Native/NativeFunctionReflection.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ public function getPureUnlessCallableIsImpureParameters(): array
115115
return [];
116116
}
117117

118+
public function getPureUnlessParameterPassedParameters(): array
119+
{
120+
return [];
121+
}
122+
118123
private function isVoid(): bool
119124
{
120125
foreach ($this->variants as $variant) {

‎src/Reflection/Native/NativeMethodReflection.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ public function getPureUnlessCallableIsImpureParameters(): array
192192
return [];
193193
}
194194

195+
public function getPureUnlessParameterPassedParameters(): array
196+
{
197+
return [];
198+
}
199+
195200
private function isVoid(): bool
196201
{
197202
foreach ($this->variants as $variant) {

‎src/Reflection/Php/ClosureCallMethodReflection.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ public function getPureUnlessCallableIsImpureParameters(): array
208208
return $this->nativeMethodReflection->getPureUnlessCallableIsImpureParameters();
209209
}
210210

211+
public function getPureUnlessParameterPassedParameters(): array
212+
{
213+
return $this->nativeMethodReflection->getPureUnlessParameterPassedParameters();
214+
}
215+
211216
public function getAttributes(): array
212217
{
213218
return $this->nativeMethodReflection->getAttributes();

‎src/Reflection/Php/EnumCasesMethodReflection.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ public function getPureUnlessCallableIsImpureParameters(): array
162162
return [];
163163
}
164164

165+
public function getPureUnlessParameterPassedParameters(): array
166+
{
167+
return [];
168+
}
169+
165170
public function getAttributes(): array
166171
{
167172
return [];

0 commit comments

Comments
 (0)