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

Function parse_stdin_path_key

src/phpcs.rs:813–847  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

811
812 #[test]
813 fn parse_stdin_path_key() {
814 // When PHPCS is invoked with --stdin-path=/project/src/Foo.php,
815 // it reports the file under that path value.
816 let json = r#"{
817 "totals": {"errors": 1, "warnings": 0, "fixable": 0},
818 "files": {
819 "/project/src/Foo.php": {
820 "errors": 1,
821 "warnings": 0,
822 "messages": [
823 {
824 "message": "Missing namespace declaration.",
825 "source": "PSR1.Classes.ClassDeclaration.MissingNamespace",
826 "severity": 5,
827 "fixable": false,
828 "type": "ERROR",
829 "line": 2,
830 "column": 1
831 }
832 ]
833 },
834 "/project/src/Bar.php": {
835 "errors": 0,
836 "warnings": 0,
837 "messages": []
838 }
839 }
840 }"#;
841 // With multiple file entries, path matching is used.
842 // The --stdin-path value matches the requested file.
843 let path = Path::new("/project/src/Foo.php");
844 let diags = parse_phpcs_json(json, path).unwrap();
845 assert_eq!(diags.len(), 1);
846 assert!(diags[0].message.contains("Missing namespace"));
847 }
848}

Callers

nothing calls this directly

Calls 2

parse_phpcs_jsonFunction · 0.85
unwrapMethod · 0.45

Tested by

no test coverage detected