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

Function preserves_descriptions

src/code_actions/update_docblock.rs:1626–1664  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1624
1625 #[test]
1626 fn preserves_descriptions() {
1627 let php = r#"<?php
1628class Foo {
1629 /**
1630 * Summary line.
1631 *
1632 * @param string $a The first param
1633 */
1634 public function bar(string $a, int $b): void {}
1635}
1636"#;
1637 let pos = php.find("@param string").unwrap() as u32;
1638 let info = find_info(php, pos).unwrap();
1639 let cl = no_class_loader();
1640 let updated = build_updated_docblock(
1641 &info,
1642 php,
1643 &[],
1644 &cl,
1645 no_function_loader(),
1646 &HashMap::new(),
1647 &None,
1648 );
1649 assert!(
1650 updated.contains("The first param"),
1651 "Should preserve description: {}",
1652 updated
1653 );
1654 assert!(
1655 updated.contains("$b"),
1656 "Should add missing param: {}",
1657 updated
1658 );
1659 assert!(
1660 updated.contains("Summary line"),
1661 "Should preserve summary: {}",
1662 updated
1663 );
1664 }
1665
1666 #[test]
1667 fn removes_extra_param_and_adds_missing() {

Callers

nothing calls this directly

Calls 6

find_infoFunction · 0.85
no_class_loaderFunction · 0.85
build_updated_docblockFunction · 0.85
no_function_loaderFunction · 0.85
unwrapMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected