Skip to content

Resolve imported short @see class names in SeeAnnotationToTestRule - #379

Merged
TomasVotruba merged 2 commits into
mainfrom
fix-see-annotation-imported-test
Oct 18, 2026
Merged

TomasVotruba merged 2 commits into
mainfrom
fix-see-annotation-imported-test

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Fixes #377. Supersedes #378 (keeps its failing fixture by @Brainshaker95).

SeeAnnotationToTestRule handed the raw @see tag text straight to is_a(), so a short, imported class name (e.g. @see UserMailerTest with a use import) never matched and the class was wrongly reported as missing its test annotation.

The raw text is now resolved through the docblock name scope (ResolvedPhpDocBlock::getNullableNameScope()->resolveStringName()) before the is_a() check, so both fully qualified and imported short names work. FQCN annotations keep working unchanged.

Same issue and fix approach as rectorphp/rector-phpunit#779.

@Brainshaker95

Copy link
Copy Markdown
Contributor

Thanks!

@TomasVotruba
TomasVotruba merged commit 663fa6c into main Oct 18, 2026
9 checks passed
@TomasVotruba

Copy link
Copy Markdown
Member Author

👍

@TomasVotruba
TomasVotruba deleted the fix-see-annotation-imported-test branch October 18, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SeeAnnotationToTestRule doesn't resolve imported class names

2 participants