Skip to content

feat: complete Laravel config navigation with config() helper and typed accessors#96

Merged
AJenbo merged 4 commits intoAJenbo:mainfrom
MingJen:feat/add-boolean-helper-for-config
Apr 28, 2026
Merged

feat: complete Laravel config navigation with config() helper and typed accessors#96
AJenbo merged 4 commits intoAJenbo:mainfrom
MingJen:feat/add-boolean-helper-for-config

Conversation

@MingJen
Copy link
Copy Markdown
Contributor

@MingJen MingJen commented Apr 28, 2026

Description

This PR completes the Laravel configuration navigation support by extending the existing Config:: Facade logic to include the config() helper and its fluent method chains. It also introduces a robust test suite for the underlying AST walker.

Key Changes

  • Comprehensive config() Helper Support:
    • Enabled "Go to Definition" for configuration keys when using the config() helper, such as config()->get(...) or config()->string(...).
    • Fixed an issue where fully qualified helper calls (e.g., \config()->get(...)) were not correctly recognized.
  • Laravel 11 Typed Accessors:
    • Updated both Config:: and config() logic to support modern typed accessors: boolean, string, integer, float, array, collection, set, prepend, and push.
  • Logic Consolidation:
    • Refactored the configuration method whitelist into a shared is_config_repository_method helper to ensure consistency across different access patterns (Facade vs. Helper).
  • Enhanced Test Coverage:
    • AST Walker Tests: Added extensive test cases to helpers_tests.rs for walk_all_php_expressions, covering various PHP syntax branches (Return, If, Switch, Closures, Match, etc.) to ensure reliable symbol extraction.
    • Integration Tests: Added new test scenarios in definition_laravel.rs specifically for config() instance calls and FQN helper usage.

Technical Details

  • Updated src/symbol_map/extraction.rs to detect and extract symbols from method calls originating from the config() function.
  • Leveraged strip_fqn_prefix to provide robust function name matching regardless of the namespace context.

Verification

  • All 4,500+ existing tests passed.
  • Verified new integration tests for typed accessors and namespaced helper calls.
  • Confirmed cargo clippy and cargo fmt compliance.

MingJen added 3 commits April 28, 2026 21:21
Add 47 unit tests to helpers_tests.rs exercising every statement
and expression arm of the PHP AST walker, plus ControlFlow early-exit.
Add go-to-definition support for typed accessor calls on the config()
helper (e.g. config()->boolean('app.debug')). Covers all 11 repository
methods: get, has, string, integer, float, boolean, array, collection,
set, prepend, push.
Extract shared is_config_repository_method so both the Config:: static
call path and the config()-> instance call path reference one list.
Also add missing go-to-definition assertions for Config::collection,
Config::prepend, and Config::push.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 28, 2026

Codecov Report

❌ Patch coverage is 85.36585% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.74%. Comparing base (ac62fed) to head (16228ef).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/symbol_map/extraction.rs 85.36% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #96      +/-   ##
==========================================
+ Coverage   86.59%   86.74%   +0.15%     
==========================================
  Files         164      164              
  Lines      104416   104711     +295     
==========================================
+ Hits        90418    90833     +415     
+ Misses      13998    13878     -120     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AJenbo AJenbo merged commit 73bdea0 into AJenbo:main Apr 28, 2026
7 checks passed
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