Skip to content

Import / use statement removal fails when docblock references un-namespaced (and unrelated) class #9009

@SpencerMalone

Description

@SpencerMalone

Bug Report

Subject Details
Rector version 2.0.8

If you are removing a use statement for an un-namespaced class and reference another different unnamespaced class in a docblock, the import removal never happens

Minimal PHP Code Causing Issue

https://getrector.com/demo/0f245b36-9555-4c86-8f97-8a862d850bc0

Expected Behaviour

If you remove the leading \ on ThirdClass, it'll correctly remove the unused import. I would have expected that to work in the version with \ThirdClass as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions