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

Method pushPhpUseRef

src/extraction/tree-sitter.ts:5397–5408  ·  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

5395
5396 /** Convert a PHP FQN `Foo\Bar\Baz` to the stored `Foo\Bar::Baz` and emit an `imports` ref. */
5397 private pushPhpUseRef(fqn: string, fromNodeId: string, node: SyntaxNode): void {
5398 const clean = fqn.replace(/^\\/, '');
5399 const lastSep = clean.lastIndexOf('\\');
5400 if (lastSep < 0) return; // global-namespace class — already matches by simple name
5401 this.unresolvedReferences.push({
5402 fromNodeId,
5403 referenceName: `${clean.slice(0, lastSep)}::${clean.slice(lastSep + 1)}`,
5404 referenceKind: 'imports',
5405 line: node.startPosition.row + 1,
5406 column: node.startPosition.column,
5407 });
5408 }
5409
5410 /**
5411 * Emit one `imports` reference per name imported in a Python

Callers 2

extractImportMethod · 0.95
emitPhpUseRefsMethod · 0.95

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected