Read expression types from ExpressionResults in NodeScopeResolver and handlers - #6138
Merged
Merged
Conversation
ondrejmirtes
commented
Jul 28, 2026
| $this->callNodeCallback($nodeCallback, $elseif, $scope, $storage); | ||
| $elseIfConditionType = ($this->treatPhpDocTypesAsCertain ? $condScope->getType($elseif->cond) : $scope->getNativeType($elseif->cond))->toBoolean(); | ||
| $condResult = $this->processExprNode($stmt, $elseif->cond, $condScope, $storage, $nodeCallback, ExpressionContext::createDeep()); | ||
| $elseIfConditionType = ($this->treatPhpDocTypesAsCertain ? $condResult->getType() : $scope->getNativeType($elseif->cond))->toBoolean(); |
Member
Author
There was a problem hiding this comment.
$scope->getNativeType could be $condResult->getNativeType
… handlers Where a result is (or can be) in hand, read types off it instead of re-asking a scope: - the while pre-condition and the elseif condition (processed first, Match-style, instead of a forward read - both certainty flavours come off the result) - the dynamic function-call name (processed first, then consumed for the parameters-acceptor selection) - the nested array-dimension reads in offset assignments (the dims were already processed at that point; the reads move after the processing and consume the results) The foreach iteratee and while/do-while post-body condition reads ask post-processing scopes and stay as they are. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019wqGgaD7iqL44t1KgpJS7b
Member
Author
|
Applied — the native read now also comes off the result. Also grew the batch while at it: the dynamic function-call name is processed first and consumed for the acceptor selection, and the nested array-dimension reads in |
ondrejmirtes
force-pushed
the
expression-result-type-reads-4
branch
from
July 28, 2026 17:27
ae5a95d to
a282930
Compare
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.
Fourth batch of converting
$scope->getType()reads toExpressionResultreads (independent PR on 2.2.x; follows the merged batches 1–3).whilepre-condition check reads$condResult->getType()/getNativeType()— the entry scope is exactly the condition result's before-scope (exact equivalence).elseifcondition is processed first and its phpdoc-certain type read off the result, replacing a forward read; the native-certainty read keeps asking the outer scope, preserving the pre-existing asymmetry between the two reads.while/do-while post-body condition reads (they ask body-derived scopes) — those only convert with the callback world's asking-scope machinery.Validation: full test suite green (17776 tests), self-analysis clean, code style clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_019wqGgaD7iqL44t1KgpJS7b