MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / collect_from_function

Function collect_from_function

src/scope_collector/tests.rs:7–23  ·  view source on GitHub ↗

Helper: parse PHP code and collect scope from the first function body found.

(php: &str)

Source from the content-addressed store, hash-verified

5
6/// Helper: parse PHP code and collect scope from the first function body found.
7fn collect_from_function(php: &str) -> ScopeMap {
8 with_parsed_program(php, "test", |program, _content| {
9 for stmt in program.statements.iter() {
10 if let Statement::Function(func) = stmt {
11 let body_start = func.body.left_brace.start.offset;
12 let body_end = func.body.right_brace.end.offset;
13 return collect_function_scope(
14 &func.parameter_list,
15 func.body.statements.as_slice(),
16 body_start,
17 body_end,
18 );
19 }
20 }
21 panic!("No function found in test PHP code");
22 })
23}
24
25/// Helper: parse PHP code and collect scope from the first method body
26/// found inside the first class.

Callers 15

parameter_is_writeFunction · 0.85
multiple_assignmentsFunction · 0.85
if_else_variables_leakFunction · 0.85
foreach_value_is_writeFunction · 0.85
for_loop_variablesFunction · 0.85
while_loop_variablesFunction · 0.85
do_while_variablesFunction · 0.85
switch_case_variablesFunction · 0.85

Calls 3

with_parsed_programFunction · 0.85
collect_function_scopeFunction · 0.85
iterMethod · 0.80

Tested by

no test coverage detected