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

Function this_references_no_duplicates

tests/integration/references.rs:535–570  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

533
534#[test]
535fn this_references_no_duplicates() {
536 let backend = create_test_backend();
537 let uri = "file:///tmp/test_refs_this.php";
538 let content = r#"<?php
539
540class Foo {
541 public string $name = '';
542
543 public function test(): void {
544 $this->name = 'hello';
545 echo $this->name;
546 $this->doSomething();
547 }
548
549 public function doSomething(): void {}
550}
551"#;
552
553 open_file(&backend, uri, content);
554
555 // Cursor on `$this` (line 6, col 9)
556 let results = backend
557 .find_references(uri, content, Position::new(6, 9), true)
558 .expect("should find references");
559
560 assert_no_duplicates(&results, "this_references");
561
562 // 3 usages of $this in the method
563 assert_eq!(
564 results.len(),
565 3,
566 "Expected 3 references ($this usages), got {}: {:#?}",
567 results.len(),
568 results
569 );
570}
571
572// ─── Cross-file references ──────────────────────────────────────────────────
573

Callers

nothing calls this directly

Calls 4

create_test_backendFunction · 0.85
assert_no_duplicatesFunction · 0.85
find_referencesMethod · 0.80
open_fileFunction · 0.70

Tested by

no test coverage detected