Resolve morph aliases in type-column comparisons - #432
Open
shuvroroy wants to merge 1 commit into
Open
Conversation
Recognize alias literals in query filters and property comparisons when the receiver model declares the column through a morphTo relationship. Use the shared type engine and relation metadata to provide completion, hover, navigation, references, and enforced-map diagnostics. Preserve inherited and trait-defined columns, and resolve parent names and custom builder generics through the shared resolution path. Cache confirmed spans with source and model invalidation, and check each query column once for all values in an array. Add regression tests, Laravel demos and runtime assertions, completion benchmarks, architecture notes, and a changelog entry. Remove the completed morph-column item from the backlog. The independent named Blade slot closer fix remains in PR PHPantom-dev#431; the Laravel demo diagnostic baseline requires that prerequisite to merge.
shuvroroy
marked this pull request as ready for review
September 9, 2026 07:03
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Morph-map aliases in polymorphic column comparisons now support completion, hover, go-to-definition, find-references, and unknown-alias diagnostics when the map is enforced. For example,
Comment::where('commentable_type', 'post')and$comment->commentable_type === 'post'resolvepostthrough the morph map when the model declares that relationship.Receiver types come from the shared type engine, and parsed
morphTo()metadata identifies the effective column through inheritance and traits. This also corrects shared resolution ofparentnames and generic arguments through custom builders. Confirmation is cached and shared across array values, with invalidation when model metadata or source changes.Depends on #431. The Blade slot fix is excluded from this PR. Until it merges, Laravel analysis on
mainreports its known extra mismatched-tag diagnostic atresources/views/welcome.blade.php:131, in addition to the three intentional demo errors. With #431 applied, the complete validation pipeline passes with exactly the expected three diagnostics.Validation:
Checklist
If applicable:
CHANGELOG.mdREADME.md,docs/,examples/)config-schema.json)how it works, how it's organized), including any code drafted by an LLM.
an eye towards deleting anything that is irrelevant, clarifying anything
that is confusing, and adding details that are relevant. This includes,
for example, commit descriptions, PR descriptions, and code comments.