MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / pushPhpUseRef

Method pushPhpUseRef

src/extraction/tree-sitter.ts:3563–3574  ·  view source on GitHub ↗

Convert a PHP FQN `Foo\Bar\Baz` to the stored `Foo\Bar::Baz` and emit an `imports` ref.

(fqn: string, fromNodeId: string, node: SyntaxNode)

Source from the content-addressed store, hash-verified

3561
3562 /** Convert a PHP FQN `Foo\Bar\Baz` to the stored `Foo\Bar::Baz` and emit an `imports` ref. */
3563 private pushPhpUseRef(fqn: string, fromNodeId: string, node: SyntaxNode): void {
3564 const clean = fqn.replace(/^\\/, '');
3565 const lastSep = clean.lastIndexOf('\\');
3566 if (lastSep < 0) return; // global-namespace class — already matches by simple name
3567 this.unresolvedReferences.push({
3568 fromNodeId,
3569 referenceName: `${clean.slice(0, lastSep)}::${clean.slice(lastSep + 1)}`,
3570 referenceKind: 'imports',
3571 line: node.startPosition.row + 1,
3572 column: node.startPosition.column,
3573 });
3574 }
3575
3576 /**
3577 * Emit one `imports` reference per name imported in a Python

Callers 2

extractImportMethod · 0.95
emitPhpUseRefsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected