diff --git a/internal/languages/php/analyzer/analyzer.go b/internal/languages/php/analyzer/analyzer.go index 7949b3cdd..95af2e610 100644 --- a/internal/languages/php/analyzer/analyzer.go +++ b/internal/languages/php/analyzer/analyzer.go @@ -45,6 +45,8 @@ func (analyzer *analyzer) Analyze(node *sitter.Node, visitChildren func() error) return analyzer.analyzeGenericConstruct(node, visitChildren) case "switch_label": return visitChildren() + case "dynamic_variable_name": + return analyzer.analyzeDynamicVariableName(node, visitChildren) case "binary_expression", "unary_op_expression", "argument", @@ -168,6 +170,12 @@ func (analyzer *analyzer) analyzeSwitch(node *sitter.Node, visitChildren func() return visitChildren() } +func (analyzer *analyzer) analyzeDynamicVariableName(node *sitter.Node, visitChildren func() error) error { + analyzer.lookupVariable(node.NamedChild(0)) + + return visitChildren() +} + // default analysis, where the children are assumed to be aliases func (analyzer *analyzer) analyzeGenericConstruct(node *sitter.Node, visitChildren func() error) error { analyzer.builder.Alias(node, analyzer.builder.ChildrenFor(node)...)