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

Function foreach_key_value

src/selection_range.rs:1157–1174  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1155
1156 #[test]
1157 fn foreach_key_value() {
1158 let content = r#"<?php
1159$map = ['a' => 1];
1160foreach ($map as $key => $val) {
1161 echo $key;
1162}
1163"#;
1164 // Cursor on $key in the echo (line 3, char 10).
1165 let results = selection_ranges(content, &[Position::new(3, 10)]);
1166 assert_eq!(results.len(), 1);
1167 let ranges = flatten(&results[0]);
1168 assert!(
1169 ranges.len() >= 3,
1170 "Expected at least 3 levels for foreach key-value body, got {}",
1171 ranges.len()
1172 );
1173 assert_nested(&ranges);
1174 }
1175
1176 #[test]
1177 fn foreach_cursor_on_key_target() {

Callers

nothing calls this directly

Calls 3

selection_rangesFunction · 0.85
flattenFunction · 0.85
assert_nestedFunction · 0.85

Tested by

no test coverage detected