Skip to content

Add Laravel config-backed resource name intelligence - #372

Open
shuvroroy wants to merge 8 commits into
PHPantom-dev:mainfrom
shuvroroy:feat/laravel-config-resource-names
Open

Add Laravel config-backed resource name intelligence#372
shuvroroy wants to merge 8 commits into
PHPantom-dev:mainfrom
shuvroroy:feat/laravel-config-resource-names

Conversation

@shuvroroy

@shuvroroy shuvroroy commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Laravel's config-backed service names are now first-class, family-aware string symbols. This layer adds direct editor support for eight resource families:

Resource Config subtree
Auth guards auth.guards.*
Cache stores cache.stores.*
Log channels logging.channels.*
Storage disks filesystems.disks.*
Database connections database.connections.*
Queue connections queue.connections.*
Mailers mail.mailers.*
Broadcast connections broadcasting.connections.*

Supported direct contexts include auth(), the corresponding Laravel facades, parameter-level contextual attributes, Log::stack() array values, and auth:* parameters on static or fluent Route::middleware() calls.

Editor behavior

Each resource family now provides:

  • Completion scoped to its own config subtree
  • Family-specific hover text and unknown-resource diagnostics
  • Ctrl+Click to the exact app, provider, or framework-default config entry
  • Symmetric references between the short resource spelling, generic config() / Config access, and the config declaration

Semantic name resolution accepts imports, aliases, and fully qualified Laravel classes while rejecting namespace-local and vendor homonyms. Named arguments, reordered arguments, modern and legacy arrays, multiline/commented Route chains, and grouped contextual attributes are covered.

Laravel-specific edge behavior is preserved: database role suffixes such as mysql::read, mysql::write, and mysql::direct resolve the mysql connection; built-in Cache::store('null') and Queue::connection('null') remain valid without fabricated config declarations.

Design and performance

  • One declarative descriptor table is authoritative for resource metadata and trigger shapes.
  • Compact family indexes make trigger and config-root dispatch O(1) without request-time allocation.
  • Completion borrows typed prefixes, and the config candidate cache shares Arc storage instead of cloning candidate vectors.
  • Resource and generic config occurrences share one canonical reference-index identity rather than duplicating entries.
  • Exact config lookup narrows scans and preserves app → provider → framework precedence.
  • Cross-file function/class shadows are stored as dormant candidates and refreshed only when the relevant declaration index changes, keeping homonym handling correct after edits without reparsing every file.
  • Diagnostics retain symbol-map owners and borrow key text rather than cloning every Laravel string.

Deliberate scope boundary

This PR handles direct, config-backed contexts only. Type-resolved ->connection() receivers and $connection properties, free-form queue names, typed controller middleware, and source-registered rate limiters remain separate backlog items. Mixed short/full config-resource rename also remains disabled until the existing Laravel string-rename task is implemented safely.

Stack

This is the focused config-resource layer split from #368 after review feedback.

Depends on:

Once #371 lands, this branch can be rebased and the PR will show only this resource-family layer.

Verification

  • 13,732 instrumented tests passed; 2 intentionally skipped
  • 2,941/2,941 changed executable Rust lines covered (100.00%)
  • Full ordinary cargo test --no-fail-fast suite passed
  • cargo clippy --all-targets -- -D warnings
  • cargo fmt --check
  • Documentation site build completed
  • PHP playground syntax checks and runtime assertions passed
  • Laravel demo syntax and all 190 runtime assertions passed
  • Laravel analyzer reports exactly the three intentional demo errors

Checklist

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, examples/)
  • I have updated the config schema (config-schema.json)
  • 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.

🤖 Generated with Codex

@codecov-commenter

codecov-commenter commented Aug 17, 2026

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!

Recognize auth guards, cache stores, log channels, database and queue connections, mailers, and broadcast connections across direct Laravel helpers, facades, contextual attributes, and route middleware.

Drive completion, hover, navigation, diagnostics, and references from one descriptor table while preserving semantic alias and homonym handling.
@shuvroroy
shuvroroy force-pushed the feat/laravel-config-resource-names branch from 8837010 to 538f69e Compare August 17, 2026 01:11
@shuvroroy
shuvroroy marked this pull request as ready for review August 17, 2026 04:17
@AJenbo AJenbo added this to the Sprint 7 milestone Aug 18, 2026
# Conflicts:
#	docs/CHANGELOG.md
#	docs/todo.md
#	src/analyse/run.rs
#	src/blade/call_site_inference.rs
#	src/completion/laravel_string_keys.rs
#	src/symbol_map/extraction/laravel.rs
#	tests/integration/main.rs
…ig-resource-names

# Conflicts:
#	docs/todo.md
#	examples/laravel/app/Demo.php
#	src/completion/laravel_string_keys.rs
#	src/diagnostics/mod.rs
#	src/lib.rs
#	src/symbol_map/extraction/laravel.rs
@shuvroroy

Copy link
Copy Markdown
Contributor Author

@AJenbo this pr is ready for review again.

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.

3 participants