You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PHP extractor misses class_constant_access_expression (enum and constant references) #230
The PHP extractor wires up function_call_expression and member_call_expression into calls edges, but it never visits class_constant_access_expression. That means references to enums and class constants do not produce any graph edges, so constant-heavy codebases show up in graph analyses as isolated nodes that look like dead code.
Current behavior
Minimal reproducer:
<?phpnamespaceApp\Support;
class TimeConstant
{
publicconstintHOUR_IN_SECONDS = 3600;
}
class CacheService
{
publicfunctionttl(): int
{
return TimeConstant::HOUR_IN_SECONDS;
}
}
Running extract_php() on this file returns two classes (TimeConstant, CacheService), one method (.ttl()), the contains and method edges. No edge connects CacheService to TimeConstant, even though the method body uses it.
This is reproducible on any project that follows the Laravel convention of extracting magic numbers into enum-like classes, but it also hits any project that uses native enum Foo { case Bar; } syntax because enum case access goes through the same grammar node.
Expected behavior
The method should be linked to the class that holds the constant, with a relation label that makes the intent clear (for example uses_const). The existing calls relation is reserved for callable invocations, so a new relation label keeps the graph semantically honest.
Proposed solution
Extend LanguageConfig with an optional static_const_types frozenset (default empty, so other languages are untouched) and populate it in _PHP_CONFIG with class_constant_access_expression. In the walk_calls dispatcher, handle the new node type by reading its class reference (via the scope field with a positional fallback, since tree-sitter-php has exposed the child under different field names across versions) and adding a uses_const edge when the enclosing class resolves in label_to_nid.
The change stays additive. Languages that do not set static_const_types see no behavioral difference.
Notes
I am happy to open a PR (one is already prepared with tests). I also have follow-up ideas for scoped_call_expression and scoped_property_access_expression that have the same root cause and can be addressed independently.
Activity
Fix 9 issues: kiro package data, betweenness perf, wiki step, opencod…
safishamsi commentedon Apr 14, 2026
Implemented in v0.4.14.
Fix 9 issues: kiro package data, betweenness perf, wiki step, opencod…
Fix 9 issues: kiro package data, betweenness perf, wiki step, opencod…