MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / php_bucket_declaring

Function php_bucket_declaring

src/pipeline/pass_pkgmap.c:2674–2694  ·  view source on GitHub ↗

The file of `bucket` that defines a symbol named `leaf`, or NULL. Exact: * the definition must live in that very file (same file_path). */

Source from the content-addressed store, hash-verified

2672/* The file of `bucket` that defines a symbol named `leaf`, or NULL. Exact:
2673 * the definition must live in that very file (same file_path). */
2674static const cbm_gbuf_node_t *php_bucket_declaring(const cbm_pipeline_ctx_t *ctx,
2675 const char *bucket, const char *source_file_qn,
2676 const char *leaf) {
2677 const cbm_gbuf_node_t **hits = NULL;
2678 int hit_count = 0;
2679 if (!bucket || cbm_gbuf_find_by_name(ctx->gbuf, leaf, &hits, &hit_count) != 0 || !hits) {
2680 return NULL;
2681 }
2682 const char *cursor = bucket;
2683 for (const cbm_gbuf_node_t *f = php_bucket_next(ctx, &cursor, source_file_qn); f;
2684 f = php_bucket_next(ctx, &cursor, source_file_qn)) {
2685 for (int i = 0; i < hit_count; i++) {
2686 const cbm_gbuf_node_t *h = hits[i];
2687 if (h && h->label && strcmp(h->label, "File") != 0 && h->file_path && f->file_path &&
2688 strcmp(h->file_path, f->file_path) == 0) {
2689 return f;
2690 }
2691 }
2692 }
2693 return NULL;
2694}
2695
2696/* Resolve a PHP namespaced `use` that no psr-4 prefix covers, through the
2697 * namespaces project files DECLARE. `use A\B\C` names C in namespace A\B (or

Callers 1

resolve_php_declared_useFunction · 0.85

Calls 2

cbm_gbuf_find_by_nameFunction · 0.85
php_bucket_nextFunction · 0.85

Tested by

no test coverage detected