Skip to content

feat: add PHP call-graph support#37

Merged
Helweg merged 2 commits intomainfrom
feature/php-call-graph
Mar 28, 2026
Merged

feat: add PHP call-graph support#37
Helweg merged 2 commits intomainfrom
feature/php-call-graph

Conversation

@Helweg
Copy link
Copy Markdown
Owner

@Helweg Helweg commented Mar 28, 2026

Summary

Add PHP call-graph extraction as follow-up to PR #35 (basic PHP semantic parsing). Covers function calls, method calls, nullsafe/static calls, constructors, simple and grouped use imports, with PHP-specific case-insensitive normalization and deduplication.

Changes

  • Add native/queries/php-calls.scm with tree-sitter queries for 8 PHP call patterns (direct, qualified, method, nullsafe, static, constructor, simple use, grouped use)
  • Route PHP in native/src/call_extractor.rs (language binding, query loading, method parent kinds)
  • Normalize PHP Call/MethodCall callee names to lowercase for case-insensitive matching
  • Deduplicate call extraction results by (name, line, column) to handle overlapping query matches
  • Add COLLATE NOCASE to DB caller queries in native/src/db.rs
  • Add "php" to CALL_GRAPH_LANGUAGES and "trait_declaration" to CALL_GRAPH_SYMBOL_CHUNK_TYPES in src/indexer/index.ts
  • Add 4 PHP test fixtures and 8 TypeScript + 9 Rust unit tests

Testing

  • Unit tests added/updated
  • Manual testing performed
  • Build passes (npm run build)
  • Typecheck passes (npm run typecheck)
  • Tests pass (npm run test:run)
  • Lint passes (npm run lint)

Release Labels

  • Added at least one release category label (feature, bug, performance, documentation, dependencies, refactor, test, chore, or skip-changelog)
  • Added at most one semver label (semver:major, semver:minor, semver:patch) when needed

Related Issues

Fixes #36

- Add native/queries/php-calls.scm with patterns for function calls,
  method calls, nullsafe calls, static calls, constructors, and use imports
- Route PHP in call_extractor.rs (language, query, method_parent_kinds)
- Add "php" to CALL_GRAPH_LANGUAGES, "trait_declaration" to CALL_GRAPH_SYMBOL_CHUNK_TYPES
- Add PHP test fixtures and call-graph tests
@Helweg Helweg added the feature New feature or capability label Mar 28, 2026
@github-actions github-actions bot added the test Test changes label Mar 28, 2026
- Normalize PHP Call/MethodCall callee names to lowercase in Rust extractor
  so HELPER() matches symbol helper during resolution and lookup
- Add COLLATE NOCASE to DB caller queries for case-insensitive matching
- Deduplicate call extraction results by (name, line, column)
- Add grouped use import query pattern (namespace_use_group)
- Add tests for case-insensitive calls, grouped imports, and dedup
@Helweg Helweg merged commit aa5f31f into main Mar 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or capability test Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add PHP call-graph support

1 participant