Resolve @template bindings in Arrayable shapes and Builder method return types - #39
Open
levikl wants to merge 2 commits into
Open
Conversation
levikl
force-pushed
the
template-bindings-via-static-method-dispatch-on-model-subclasses
branch
2 times, most recently
from
May 8, 2026 05:24
4806783 to
a8f16f7
Compare
levikl
force-pushed
the
template-bindings-via-static-method-dispatch-on-model-subclasses
branch
from
May 8, 2026 06:22
a8f16f7 to
8a6e546
Compare
Collaborator
|
Thanks for the PR! Is this ready to be looked at? Or is it still a draft? |
This was referenced May 8, 2026
levikl
force-pushed
the
template-bindings-via-static-method-dispatch-on-model-subclasses
branch
10 times, most recently
from
May 12, 2026 02:54
c3b2b1e to
3ef9b16
Compare
@template bindings through static method dispatch on Model subclasses@template bindings in Arrayable and Builder return type resolution
Author
|
@joetannenbaum yo! saw the direction you're taking with generics in #40 so I went ahead and refactored this to fit naturally alongside it, eg. storing this is ready for review |
levikl
force-pushed
the
template-bindings-via-static-method-dispatch-on-model-subclasses
branch
3 times, most recently
from
May 13, 2026 21:08
85c1a4d to
eb38770
Compare
@template bindings in Arrayable and Builder return type resolution@template bindings in Arrayable shapes and Builder method return types
levikl
force-pushed
the
template-bindings-via-static-method-dispatch-on-model-subclasses
branch
from
May 13, 2026 21:49
eb38770 to
0caa5ec
Compare
levikl
force-pushed
the
template-bindings-via-static-method-dispatch-on-model-subclasses
branch
2 times, most recently
from
May 15, 2026 04:37
fa97a10 to
e7ba124
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.
summary
this change parses and stores
@template,@template-covariant, and@template-contravariantdocblock tags onClassLikeResult, giving every analyzed class a typed record of its generic parameters.e2e flow
given a controller returning
Product::paginate(5)inside anInertia::render()call:Product::paginate(5)falls back toBuilder::paginate()sinceProductdoesn't define itBuilder'sClassLikeResult::templateTags()containsTModel of ModelbindCallerTemplates->["TModel" => ClassType(Product)]substituteInTypereplacesStringType("TModel")->ClassType(Product)ClassType(LengthAwarePaginator, genericTypes: [IntType, ClassType(Product)])ArrayableResolverresolvesLengthAwarePaginator::toArray();datakey containsStringType('TKey')|StringType('TValue')placeholders because theCollection::toArray()fast path surfaces them directly from the collection's generic typessubstituteTemplateBindingsmapsTKey -> IntType,TValue -> ClassType(Product)data: App.Models.Product[]emitted in generated TypeScriptrelated
Builderpaginate methods framework#60045merge order
laravel/framework#60045 ->
this-> laravel/wayfinder#249