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

Function inline_simple_variable

src/code_actions/inline_variable.rs:873–889  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

871
872 #[test]
873 fn inline_simple_variable() {
874 let php = r#"<?php
875function foo() {
876 /*|*/$name = $user->getName();
877 echo $name;
878}
879"#;
880 let content_without_marker = php.replace("/*|*/", "");
881 let edits = run_inline(php).expect("action should be offered");
882 let result = apply_edits(&content_without_marker, &edits);
883 assert!(!result.contains("$name = "), "assignment should be removed");
884 assert!(
885 result.contains("echo $user->getName();"),
886 "read should be replaced with RHS: got:\n{}",
887 result
888 );
889 }
890
891 #[test]
892 fn inline_variable_multiple_reads() {

Callers

nothing calls this directly

Calls 2

run_inlineFunction · 0.85
apply_editsFunction · 0.70

Tested by

no test coverage detected