Commit a1feba2
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 96472f1 commit a1feba2
1 file changed
Lines changed: 28 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2334 | 2334 | | |
2335 | 2335 | | |
2336 | 2336 | | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
| 2340 | + | |
2337 | 2341 | | |
2338 | 2342 | | |
2339 | 2343 | | |
| |||
2358 | 2362 | | |
2359 | 2363 | | |
2360 | 2364 | | |
| 2365 | + | |
| 2366 | + | |
| 2367 | + | |
| 2368 | + | |
2361 | 2369 | | |
2362 | 2370 | | |
2363 | 2371 | | |
| |||
2371 | 2379 | | |
2372 | 2380 | | |
2373 | 2381 | | |
| 2382 | + | |
| 2383 | + | |
2374 | 2384 | | |
2375 | 2385 | | |
2376 | 2386 | | |
| |||
2396 | 2406 | | |
2397 | 2407 | | |
2398 | 2408 | | |
| 2409 | + | |
| 2410 | + | |
2399 | 2411 | | |
2400 | 2412 | | |
2401 | 2413 | | |
| |||
2462 | 2474 | | |
2463 | 2475 | | |
2464 | 2476 | | |
2465 | | - | |
2466 | | - | |
2467 | | - | |
2468 | | - | |
2469 | | - | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
| 2491 | + | |
| 2492 | + | |
2470 | 2493 | | |
2471 | 2494 | | |
2472 | 2495 | | |
| |||
0 commit comments