11local Parser = require (" clapi.parser.__parser" )
22
3+ --- @class PhpParser : Parser
34local PhpParser = Parser :new ()
45
6+ --- Get visibility modifier of a node
57--- @param node TSNode The treesitter node of the visibility modifier
68--- @param bufnr integer The buffer number of the source file
79--- @return string visibility The visibility modifier of the node
@@ -15,10 +17,12 @@ function PhpParser.get_visibility(node, bufnr)
1517 return " public" -- Public by default (TODO: review this wih more languages)
1618end
1719
18- --- @param node TSNode
19- --- @param start_col integer
20- --- @param start_row integer
21- --- @param opts table
20+ --- Parse a method node
21+ --- @param node TSNode The treesitter node of the method
22+ --- @param start_col integer Starting column of the node
23+ --- @param start_row integer Starting row of the node
24+ --- @param opts table Additional options
25+ --- @return table MethodInfo Method information
2226function PhpParser .parse_method (node , start_col , start_row , opts )
2327 local visibility = PhpParser .get_visibility (node :parent (), opts .bufnr )
2428 local text = vim .treesitter .get_node_text (node , opts .bufnr )
@@ -32,10 +36,12 @@ function PhpParser.parse_method(node, start_col, start_row, opts)
3236 }
3337end
3438
35- --- @param node TSNode
36- --- @param start_col integer
37- --- @param start_row integer
38- --- @param opts table
39+ --- Parse a constant node
40+ --- @param node TSNode The treesitter node of the constant
41+ --- @param start_col integer Starting column of the node
42+ --- @param start_row integer Starting row of the node
43+ --- @param opts table Additional options
44+ --- @return table ConstantInfo Constant information
3945function PhpParser .parse_constant (node , start_col , start_row , opts )
4046 local text = vim .treesitter .get_node_text (node , opts .bufnr )
4147 local visibility = PhpParser .get_visibility (node :parent ():parent (), opts .bufnr )
@@ -49,10 +55,12 @@ function PhpParser.parse_constant(node, start_col, start_row, opts)
4955 }
5056end
5157
52- --- @param node TSNode
53- --- @param start_col integer
54- --- @param start_row integer
55- --- @param opts table
58+ --- Parse a property node
59+ --- @param node TSNode The treesitter node of the property
60+ --- @param start_col integer Starting column of the node
61+ --- @param start_row integer Starting row of the node
62+ --- @param opts table Additional options
63+ --- @return table PropertyInfo Property information
5664function PhpParser .parse_property (node , start_col , start_row , opts )
5765 local parent = node :parent ()
5866 local prop_parent = parent
0 commit comments