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

Function foreach_value_variable

src/selection_range.rs:1136–1154  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1134
1135 #[test]
1136 fn foreach_value_variable() {
1137 let content = r#"<?php
1138$items = [1, 2, 3];
1139foreach ($items as $item) {
1140 echo $item;
1141}
1142"#;
1143 // Cursor on $item in the echo (line 3, char 10).
1144 let results = selection_ranges(content, &[Position::new(3, 10)]);
1145 assert_eq!(results.len(), 1);
1146 let ranges = flatten(&results[0]);
1147 // $item → echo stmt → foreach body stmt → foreach → file
1148 assert!(
1149 ranges.len() >= 3,
1150 "Expected at least 3 levels for foreach value, got {}",
1151 ranges.len()
1152 );
1153 assert_nested(&ranges);
1154 }
1155
1156 #[test]
1157 fn foreach_key_value() {

Callers

nothing calls this directly

Calls 3

selection_rangesFunction · 0.85
flattenFunction · 0.85
assert_nestedFunction · 0.85

Tested by

no test coverage detected