Skip to content

Used import is deleted with option removeUnusedImports enabled #9078

@Myks92

Description

@Myks92

Bug Report

Subject Details
Rector version Rector 2.0.10

For some reason, Rector deletes the import that is used via alias width 3 level:

<?php

declare(strict_types=1);

namespace App\Test;

use App\Test as TestAlias;

class Tree
{
    public function create(TestAlias\Create\Handler $handler): Response 
    {
        var_dump(TestAlias\Create\Command::class);
    }
}

Minimal PHP Code Causing Issue

https://getrector.com/demo/cb127848-0576-495b-a55c-4ded4d286658

Expected Behaviour

The import is not deleted

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