Skip to content

Problems with importing names especially DocBlock classes #7684

@malteschlueter

Description

@malteschlueter

Bug Report

Subject Details
Rector version 0.15.1
PHP version 8.1.13
OS Mac Ventura 13.1

I've some issues with the importNames config option. If I use the option it should import all FQCN in all files. For ~70% of the files it works well and for the other the behavior is very strange. In some files it's only add the use statement but not replaces the FQCN. Or it will change just a few of the FQCN but not all.

I tried to reproduce it within some rector tests. Locally I can reproduce it with it but in the GitHub action everything works well. I've no special setup or everything with my local machine. Everything is very basic.

The classes where it replaces only a few FQCN are also not special (can't provide them for the public :/ ).

What me totally confues is that the tests locally failing but not in the GitHub actions.

grafik

Maybe I'm doing something wrong. Need some support here please maybe someone can the tests too?

Minimal PHP Code Causing Issue

Added some tests to reproduce this issue.
Branch: https://github.com/malteschlueter/rector-symfony/tree/bug/importing-names-not-working-well
Commit: https://github.com/malteschlueter/rector-symfony/commit/36186f3e9e9712eae0373f21e47071229c759556

Expected Behaviour

Every FQCN should be imported.

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