Repository navigation
Repeated calls keep their conditional return type - #578
Merged
AJenbo merged 2 commits intoNov 23, 2026
Merged
Conversation
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Closed
A call statement records its argument-less call arguments in the walker's scope under their written form, and a check does the same for the call it tests. The recorded type was the method's declared return type, so a later occurrence of the same call read that wider type instead of the branch the conditional return type picks. Record the conditional decided with every parameter at its default, as a call without arguments resolves it. Assisted-by: claude-code/claude-opus-5-5
Seeding a condition's argument-less call fully resolved its declared type only to throw it away when the method had no conditional return. Ask a cheap predicate (method_return_is_conditional / is_conditional_call_key) instead, share the receiver lookup with resolve_member_key_type, and cover a reassigned receiver and mixing make() with make(true). Seed the conditional call from what it returns once its receiver is set, like the other call keys, so a `?->` check leaves no `null` on the plain call that repeats it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AJenbo
force-pushed
the
fix-conditional-call-seed
branch
from
November 23, 2026 01:54
208bc09 to
4ec6088
Compare
Contributor
|
Thanks |
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.
A call without arguments that appears a second time in the same method, or is checked in a condition, now gets the branch its conditional return type picks. Before, the repeat fell back to the wider declared type, so passing it on was reported.
$this, or through an inherited method resolve the same way on the repeat.Drupal's
$url->toString()called twice in one method is a common case once #577 gives it a conditional return type.Checked
analyzeon Drupal core 11.4 and on a site with theredirectandflagmodules reports exactly whatmainreports.Checklist
If applicable:
CHANGELOG.mdREADME.md,docs/,examples/). Not applicable: no documented behaviour changes.config-schema.json). Not applicable: this PR adds or changes no setting.the changes and why they are needed.
the changelog, and other user-facing content, and removed or corrected
anything inaccurate, unclear, or unnecessary.