Skip to content

feat(laravel): discover sibling resource registrations - #500

Open
shuvroroy wants to merge 7 commits into
PHPantom-dev:mainfrom
shuvroroy:feat/laravel-sibling-resource-routes
Open

shuvroroy wants to merge 7 commits into
PHPantom-dev:mainfrom
shuvroroy:feat/laravel-sibling-resource-routes

Conversation

@shuvroroy

Copy link
Copy Markdown
Contributor

Route names generated by plural resource registrations and singleton controllers now work in completion, diagnostics, hover, go-to-definition, and route-parameter completion. For example, Route::resources(['photos' => PhotoController::class]) makes photos.show available, while Route::singleton('profile', ProfileController::class) generates routes without a profile ID parameter.

The shared scanner applies literal options and fluent modifiers in Laravel's order, including API filtering and singleton creation/deletion. Empty names, trailing slashes, and empty dot-separated segments retain Laravel's actual route names and URIs. This implements L44.

Validation:

  • cargo +1.99 test: 16,998 passed, 14 ignored.
  • Full instrumented suite passed; changed executable source lines: 254/254 covered (100%).
  • Clippy with -D warnings and formatting checks passed.
  • Plain PHP syntax/runtime checks and Laravel syntax/runtime checks passed (307 Laravel assertions).
  • Laravel analysis reports exactly the three intentional demo errors, on the expected view and Artisan calls.

The existing route-discovery gap for renamed facade imports was recorded separately as L61 in the backlog.

Checklist

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, examples/)
  • I have added/updated tests to cover my changes
  • I fully understand the code that I am submitting (what it does,
    how it works, how it's organized), including any code drafted by an LLM.
  • For any prose generated by an LLM, I have proof-read and copy-edited with
    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.

No config schema changes are needed.

Expand plural resource and singleton registrations through the shared route
collector so route completion, diagnostics, hover, definitions, and parameter
completion see their generated names and URIs.

Apply literal registration options and fluent modifiers in Laravel's order,
including singleton creation/deletion and API filter overrides. Preserve
empty resource segments and empty name-prefix overrides rather than
normalizing them into different routes. Reuse scalar truthiness for shallow
routing and borrow repeated URI fragments to avoid unnecessary copies.

Add scanner regressions for degenerate names, option precedence, naming
replacement, and literal shallow flags.
Exercise plural and singleton registrations through editor handlers, checking
completion and unknown-route diagnostics against the same expected names.
Cover grouped routes, custom names and parameters, API action filtering,
shallow singleton behavior, degenerate resource names, and navigation to each
individual registration literal, including UTF-16 source positions.
Add working plural-resource and singleton routes, a stateless demo
controller, editor examples, and runtime assertions against Laravel.
Document the feature in the changelog and remove the completed backlog item.

Record the existing renamed-Route-import discovery gap as a separate
follow-up rather than extending this change into facade name resolution.
@shuvroroy
shuvroroy marked this pull request as ready for review October 13, 2026 16:30
@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

✅ All modified and coverable lines are covered by tests.

📢 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