Commit 667d56b
Merge sub-expression side effect checks into existing purity conditions
Instead of having a standalone subExpressionsHaveSideEffects check
separate from the existing MethodCall/StaticCall/FuncCall purity
conditions, merge the receiver chain and argument side effect checks
directly into those conditions. This addresses the review feedback
that the hasSideEffects() checking pattern was duplicated.
- MethodCall block: now also checks receiver ($expr->var) and args
- StaticCall block: now also checks class expr and args
- FuncCall blocks: now also check args for side effects
- Extract callLikeArgsHaveSideEffects() helper, reused by both
the existing blocks and subExpressionsHaveSideEffects()
- subExpressionsHaveSideEffects() remains as catch-all for types
not covered by the blocks above (PropertyFetch, ArrayDimFetch,
NullsafeMethodCall, NullsafePropertyFetch, StaticPropertyFetch)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent ac59fc8 commit 667d56b
1 file changed
Lines changed: 28 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2338 | 2338 | | |
2339 | 2339 | | |
2340 | 2340 | | |
| 2341 | + | |
| 2342 | + | |
| 2343 | + | |
| 2344 | + | |
2341 | 2345 | | |
2342 | 2346 | | |
2343 | 2347 | | |
| |||
2362 | 2366 | | |
2363 | 2367 | | |
2364 | 2368 | | |
| 2369 | + | |
| 2370 | + | |
| 2371 | + | |
| 2372 | + | |
2365 | 2373 | | |
2366 | 2374 | | |
2367 | 2375 | | |
| |||
2375 | 2383 | | |
2376 | 2384 | | |
2377 | 2385 | | |
| 2386 | + | |
| 2387 | + | |
2378 | 2388 | | |
2379 | 2389 | | |
2380 | 2390 | | |
| |||
2400 | 2410 | | |
2401 | 2411 | | |
2402 | 2412 | | |
| 2413 | + | |
| 2414 | + | |
2403 | 2415 | | |
2404 | 2416 | | |
2405 | 2417 | | |
| |||
2466 | 2478 | | |
2467 | 2479 | | |
2468 | 2480 | | |
2469 | | - | |
2470 | | - | |
2471 | | - | |
2472 | | - | |
2473 | | - | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
| 2491 | + | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
2474 | 2497 | | |
2475 | 2498 | | |
2476 | 2499 | | |
| |||
0 commit comments