Skip to content

fix(laravel): bind named relation constraint arguments - #450

Open
shuvroroy wants to merge 4 commits into
PHPantom-dev:mainfrom
shuvroroy:fix/l57-relation-named-arguments
Open

shuvroroy wants to merge 4 commits into
PHPantom-dev:mainfrom
shuvroroy:fix/l57-relation-named-arguments

Conversation

@shuvroroy

Copy link
Copy Markdown
Contributor

Relation callback inference assumed the first supplied argument named the relationship. Calls such as Team::has(callback: ..., relation: 'stocks.warehouse') therefore lost the related model and custom builder. Bind the relation and callback against the installed method declaration using the shared argument binder, and apply the override only to the actual constraint argument.

Adds regression coverage for reordered arguments, omitted defaults, static/instance/null-safe calls, block/arrow callbacks, the whereRelation column callback, and a closure in an unrelated parameter. Includes a Laravel demo and runtime assertion; removes completed L57 from the backlog.

Stack: depends on #449 (L56), above #448 and #447. This stacked PR targets upstream main, so its diff includes the unmerged dependencies. The final commit contains L57; merge the dependencies first.

Validation: full cargo test, both required clippy runs, cargo fmt --check, PHP syntax/runtime assertions, and Laravel analysis with exactly its three intentional diagnostics.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 95.32164% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/type_engine/variable/closure_resolution.rs 89.36% 5 Missing ⚠️
...engine/variable/forward_walk/callable_inference.rs 96.49% 2 Missing ⚠️
src/virtual_members/laravel/builder.rs 98.38% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
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.

2 participants