Skip to content

Extract function-call scope effects into FuncCallScopeEffectsHelper - #6279

Merged
ondrejmirtes merged 1 commit into
2.2.xfrom
funccall-scope-effects
Aug 26, 2026
Merged

ondrejmirtes merged 1 commit into
2.2.xfrom
funccall-scope-effects

Conversation

@ondrejmirtes

Copy link
Copy Markdown
Member

Extracted from resolve-type-rewrite-2 (extraction series, follows #6274/#6275/#6278). A 1:1 manual move in the #6247 style: every moved line comes from mainline's FuncCallHandler; the branch's helper (b1c4b9e830) served as the structural template (class name, method decomposition, placement).

The scope-only side effects of a function call move out of FuncCallHandler::processExpr() into a new FuncCallScopeEffectsHelper:

  • applyArrayWalkResult() — the array_walk by-ref value writeback,
  • applyCallScopeEffects() — the contiguous post-throw-point region: closure-impure $this invalidation, possibly-impure value remembering, json_last_error/file_get_contents paired-read invalidation, the by-ref array functions (array_pop/array_shift/array_push/array_unshift/shuffle/array_splice/sorts), extract(), http_response_header, clearstatcache/openssl effects, output-buffer level tracking, and volatile-expression invalidation,
  • plus the private getArrayFunctionAppendingType(), whose only callers moved with it.

FuncCallHandler shrinks by ~440 lines; the rememberPossiblyImpureFunctionValues parameter moves to the helper with its only use. Two mainline-flow adaptations: the helper's remember block gains an explicit $parametersAcceptor !== null guard (the handler's flow correlation with $functionReflection doesn't carry into the extracted method — the branch's helper has the identical guard), and nothing else changes semantically.

Convergence: a whitespace-normalized diff against the branch's helper leaves 82 lines, all of one kind — the branch reads argument types from stored ArgsResult results while mainline prices via $scope->getType(). At the branch's next rebase its extraction commit reduces to exactly those read-style deltas.

Gates: full suite 21155 tests / 96002 assertions green, make phpstan clean (cold cache), make cs clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01R7pqAkCx4xP6WYxBo2nMJE

@ondrejmirtes
ondrejmirtes merged commit e6357e5 into 2.2.x Aug 26, 2026
1 check passed
@ondrejmirtes
ondrejmirtes deleted the funccall-scope-effects branch August 26, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant