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

Function php_add_phpstan_alias

internal/cbm/lsp/php_lsp.c:612–638  ·  view source on GitHub ↗

Add a @phpstan-type alias to ctx (idempotent — keeps first definition). */

Source from the content-addressed store, hash-verified

610
611/* Add a @phpstan-type alias to ctx (idempotent — keeps first definition). */
612static void php_add_phpstan_alias(PHPLSPContext *ctx, const char *name, const CBMType *type) {
613 if (!ctx || !name || !type)
614 return;
615 for (int i = 0; i < ctx->phpstan_alias_count; i++) {
616 if (strcmp(ctx->phpstan_alias_names[i], name) == 0)
617 return;
618 }
619 if (ctx->phpstan_alias_count >= ctx->phpstan_alias_cap) {
620 int new_cap = ctx->phpstan_alias_cap ? ctx->phpstan_alias_cap * 2 : 8;
621 const char **nn =
622 (const char **)cbm_arena_alloc(ctx->arena, (size_t)(new_cap + 1) * sizeof(*nn));
623 const CBMType **nt =
624 (const CBMType **)cbm_arena_alloc(ctx->arena, (size_t)(new_cap + 1) * sizeof(*nt));
625 if (!nn || !nt)
626 return;
627 for (int i = 0; i < ctx->phpstan_alias_count; i++) {
628 nn[i] = ctx->phpstan_alias_names[i];
629 nt[i] = ctx->phpstan_alias_types[i];
630 }
631 ctx->phpstan_alias_names = nn;
632 ctx->phpstan_alias_types = nt;
633 ctx->phpstan_alias_cap = new_cap;
634 }
635 ctx->phpstan_alias_names[ctx->phpstan_alias_count] = cbm_arena_strdup(ctx->arena, name);
636 ctx->phpstan_alias_types[ctx->phpstan_alias_count] = type;
637 ctx->phpstan_alias_count++;
638}
639
640static const CBMType *php_lookup_phpstan_alias(PHPLSPContext *ctx, const char *name) {
641 if (!ctx || !name)

Callers 1

apply_phpdoc_class_tagsFunction · 0.85

Calls 2

cbm_arena_allocFunction · 0.50
cbm_arena_strdupFunction · 0.50

Tested by

no test coverage detected