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

Function detects_method_context

src/code_actions/extract_function.rs:4416–4424  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4414
4415 #[test]
4416 fn detects_method_context() {
4417 let content =
4418 "<?php\nclass Foo {\n public function bar() {\n $x = 1;\n }\n}\n";
4419 let offset = content.find("$x").unwrap() as u32;
4420 let ctx = find_enclosing_context(content, offset, false);
4421 assert!(ctx.is_some());
4422 let ctx = ctx.unwrap();
4423 assert_eq!(ctx.target, ExtractionTarget::Method);
4424 }
4425
4426 #[test]
4427 fn detects_method_context_with_this() {

Callers

nothing calls this directly

Calls 3

find_enclosing_contextFunction · 0.85
unwrapMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected