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

Function generates_unique_name

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

Source from the content-addressed store, hash-verified

3013
3014 #[test]
3015 fn generates_unique_name() {
3016 let content = "<?php\nfunction extracted() {}\n";
3017 let ctx = EnclosingContext {
3018 target: ExtractionTarget::Function,
3019 insert_offset: content.len(),
3020 body_start: 20,
3021 is_static: false,
3022 enclosing_name: String::new(),
3023 sibling_method_names: Vec::new(),
3024 };
3025 let trailing_rt = PhpType::untyped();
3026 let naming = NamingContext {
3027 enclosing_name: "",
3028 return_strategy: &ReturnStrategy::None,
3029 body_text: "echo 'hello';",
3030 return_var_names: &[],
3031 trailing_return_type: &trailing_rt,
3032 };
3033 let name = generate_function_name(content, &ctx, &naming);
3034 assert_eq!(name, "extracted2");
3035 }
3036
3037 #[test]
3038 fn generates_base_name_when_no_conflict() {

Callers

nothing calls this directly

Calls 1

generate_function_nameFunction · 0.85

Tested by

no test coverage detected