Skip to content

Create merge conditionals from the differing holders only - #6141

Merged
ondrejmirtes merged 3 commits into
2.2.xfrom
analyser-cleanups
Jul 28, 2026
Merged

Create merge conditionals from the differing holders only#6141
ondrejmirtes merged 3 commits into
2.2.xfrom
analyser-cleanups

Conversation

@ondrejmirtes

Copy link
Copy Markdown
Member

Two analyser cleanups extracted from the resolve-type-rewrite-2 branch (independent PR on 2.2.x).

  1. Merge-conditional creation iterates only the differing holders. createConditionalExpressions() scanned every holder map in full — twice per merge — although its loops only ever select entries whose our/their/merged holders differ. mergeVariableHolders() now reports those keys by reference and the conditional creation iterates just that diff. This was the largest self-time item in the branch's SPX profile; local ABAB pairs here show ~2–5% make phpstan user-CPU improvement. The ScopeOps turbo twin mirrors both signature changes (by-ref out-parameter included), with differential smoke coverage; analysis output is byte-identical with the extension on vs PHPSTAN_TURBO=0.
  2. The foreach key-loop native types get the native flavour$keyLoopNativeTypes was filled with the same getType() reads as the PHPDoc list, so a key-type-changing loop mapped the native array's key type to the PHPDoc key union. Latent in practice (the mapping is guarded behind keyTypeChanged and a mappable native array — no observable fixture found, and the branch shares the same line), but the flavour was plainly wrong.

⚠ Merge note: this PR touches turbo-ext/src, so the version-pin commit is included — if the merge rebases the commits, re-run make bump-turbo on 2.2.x afterwards.

Validation: full test suite green with and without the turbo extension (17776 each), smoke + method/signature parity green, self-analysis clean, code style clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_019wqGgaD7iqL44t1KgpJS7b

ondrejmirtes and others added 3 commits July 28, 2026 20:22
The loop array rewrite filled $keyLoopNativeTypes with the same
getType() reads as the PHPDoc list, so a key-type-changing loop mapped
the native array's key type to the PHPDoc key union. Latent in
practice - the native mapping is guarded behind keyTypeChanged and a
mappable native array - but the flavour was plainly wrong. Also drops
an unused variable left behind by the for-loop condition conversion.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019wqGgaD7iqL44t1KgpJS7b
createConditionalExpressions() scanned every holder map in full - twice
per merge - although each of its loops only ever selects entries whose
our/their/merged holders differ. mergeVariableHolders() knows exactly
which keys those are and now reports them; the conditional creation
iterates just that diff - typically a handful of keys instead of
hundreds of holders. The ScopeOps turbo twin mirrors both signature
changes.

createConditionalExpressions was the largest self-time item in the
single-pass branch's SPX profile; make phpstan user CPU measured -2..5%
here.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019wqGgaD7iqL44t1KgpJS7b
@ondrejmirtes
ondrejmirtes merged commit 3f94c39 into 2.2.x Jul 28, 2026
133 of 135 checks passed
@ondrejmirtes
ondrejmirtes deleted the analyser-cleanups branch July 28, 2026 18:24
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