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

Function php_use_kind

internal/cbm/extract_imports.c:1726–1742  ·  view source on GitHub ↗

--- PHP imports --- tree-sitter-php models `use Foo\Bar;` as a `namespace_use_declaration` containing one or more `namespace_use_clause` nodes (each a qualified_name, optionally aliased via `as`). Grouped `use Foo\{A, B};` uses a `namespace_use_group` with `namespace_use_group_clause` children. The bare require/include forms remain `expression_statement`s and are still handled by the text fallba

Source from the content-addressed store, hash-verified

1724// of the declaration (flat form) or of the clause (grouped form
1725// `use A\{function f, const C, K}`). DEFAULT when neither is present.
1726static CBMImportKind php_use_kind(TSNode node) {
1727 uint32_t n = ts_node_child_count(node);
1728 for (uint32_t i = 0; i < n; i++) {
1729 TSNode c = ts_node_child(node, i);
1730 if (ts_node_is_named(c)) {
1731 continue;
1732 }
1733 const char *k = ts_node_type(c);
1734 if (strcmp(k, "function") == 0) {
1735 return CBM_IMPORT_KIND_FUNCTION;
1736 }
1737 if (strcmp(k, "const") == 0) {
1738 return CBM_IMPORT_KIND_CONST;
1739 }
1740 }
1741 return CBM_IMPORT_KIND_DEFAULT;
1742}
1743
1744static void emit_php_use_clause(CBMExtractCtx *ctx, TSNode clause, const char *group_prefix,
1745 CBMImportKind decl_kind) {

Callers 2

emit_php_use_clauseFunction · 0.70
emit_php_use_declFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected