Skip to content

[CodeQuality] Skip existing imported or short @ see annotation in AddSeeTestAnnotationRector - #779

Merged
TomasVotruba merged 2 commits into
mainfrom
skip-double-see
Sep 1, 2026
Merged

[CodeQuality] Skip existing imported or short @ see annotation in AddSeeTestAnnotationRector#779
TomasVotruba merged 2 commits into
mainfrom
skip-double-see

Conversation

@samsonasik

Copy link
Copy Markdown
Member

@samsonasik

Copy link
Copy Markdown
Member Author

Fixed 🎉 /cc @Brainshaker95

@samsonasik

Copy link
Copy Markdown
Member Author

@TomasVotruba ready 👍

@TomasVotruba
TomasVotruba merged commit a2ec380 into main Sep 1, 2026
7 checks passed
@TomasVotruba
TomasVotruba deleted the skip-double-see branch September 1, 2026 10:55
@TomasVotruba
TomasVotruba requested a lite review from Copilot September 1, 2026 10:55
@TomasVotruba

Copy link
Copy Markdown
Member

Thanks

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is narrowly scoped to @see resolution, and the added fixtures cover the newly supported cases to prevent regressions.

Pull request overview

Updates AddSeeTestAnnotationRector to correctly detect already-present @see tags when they reference a class using a short name (either imported via use or resolved from the current namespace), preventing duplicate @see additions and aligning behavior with rectorphp/rector#9875.

Changes:

  • Inject ClassAnnotationMatcher and use it to resolve @see tag values to fully qualified class names before checking existence via ReflectionProvider.
  • Add fixtures covering “short @see in same namespace” and “imported short @see” cases.
  • Add a source class used by the imported-@see fixture.
File summaries
File Description
rules/CodeQuality/Rector/Class_/AddSeeTestAnnotationRector.php Resolves short @see values to FQCNs before deciding to skip adding an annotation.
rules-tests/CodeQuality/Rector/Class_/AddSeeTestAnnotationRector/Source/SkipExistingImportedSeeTest.php Adds a resolvable class for the imported-@see fixture scenario.
rules-tests/CodeQuality/Rector/Class_/AddSeeTestAnnotationRector/Fixture/skip_existing_short_see.php.inc Fixture ensuring a short @see in the same namespace prevents adding another @see.
rules-tests/CodeQuality/Rector/Class_/AddSeeTestAnnotationRector/Fixture/skip_existing_imported_see.php.inc Fixture ensuring an imported short @see prevents adding another @see.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

AddSeeTestAnnotationRector adds a duplicate @see when the existing annotation is imported

3 participants