Introduce ExpressionResultFactory and store ExpressionResults instead of before-Scopes - #6125
Closed
ondrejmirtes wants to merge 0 commit into
Closed
Introduce ExpressionResultFactory and store ExpressionResults instead of before-Scopes#6125ondrejmirtes wants to merge 0 commit into
ondrejmirtes wants to merge 0 commit into
Conversation
ondrejmirtes
force-pushed
the
expression-result-factory
branch
from
July 28, 2026 13:41
7acbac0 to
c691da6
Compare
ondrejmirtes
force-pushed
the
expression-result-factory
branch
from
July 28, 2026 14:14
c691da6 to
eea2788
Compare
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First extraction step from the
resolve-type-rewrite-2branch: behavior-neutralExpressionResultplumbing that the eventual resolveType/specifyTypes-to-callback switch builds on.ExpressionResultFactorybecomes the single construction point forExpressionResult(same constructor signature as today; handlers get it injected).ExpressionResultcarries itsbeforeScopeandExpr.ExpressionResult" (BeforeScopeForExprRequest→ExpressionResultRequest);FiberScopereads type answers off the result.ExpressionResultStoragekeeps storing plain before-scopes — that is all the bridge needs, since every consumer resolves types on demand from the before-scope. Results are wrapped on demand at resume: from the stored before-scope for walk-processed expressions, and from the asker's own scope for synthetic nodes never processed in the walk. This keeps the storage from pinning throw points, impure points, scope callbacks and after-scopes (+42% RSS on the impure-call-columns bench in an earlier revision), and avoids re-processing synthetic subtrees (2.6–2.9× user CPU on the bug-11283 / nullsafe-chain-walk benches in an earlier revision). The turbo twin is untouched.Validation performed locally:
make phpstanclean; fullmake testsgreen with and without the turbo extension loaded (17683 tests each); turbo smoke + method/signature parity pass (extension identical to 2.2.x); bench fixtures bug-11283 / nullsafe-chain-walk / impure-call-columns at or near 2.2.x baseline;make phpstanaggregate within ~2% user CPU of 2.2.x.🤖 Generated with Claude Code
https://claude.ai/code/session_019wqGgaD7iqL44t1KgpJS7b