Commit 38e8ef2
Simplify method_exists trait context handling
Replace the complex method_exists special case (checking if each method
name is defined in the trait reflection) with a simple early return when
the object argument depends on the trait context. This trades off not
reporting method_exists($this, 'traitDefinedMethod') as always-true in
trait context, but the check is harmless and this removes 17 lines of
logic. Also make isExpressionDependentOnThis private since it's only
used internally.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 1c6d393 commit 38e8ef2
File tree
2 files changed
+3
-20
lines changed- src/Rules/Comparison
- tests/PHPStan/Rules/Comparison
2 files changed
+3
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
| 207 | + | |
222 | 208 | | |
| 209 | + | |
223 | 210 | | |
224 | 211 | | |
225 | 212 | | |
| |||
419 | 406 | | |
420 | 407 | | |
421 | 408 | | |
422 | | - | |
| 409 | + | |
423 | 410 | | |
424 | 411 | | |
425 | 412 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | 186 | | |
191 | 187 | | |
192 | 188 | | |
| |||
0 commit comments