Skip to content

Unused import isn't removed despite no uses in the code #391

@abodnar

Description

@abodnar

Pint Version

Pint 1.24.0

PHP Version

8.3.17

Description

For some reason Pint seems to refuse to remove an import that is clearly unused in a file.

Image
sail pint app/Http/Controllers/AccessSites/UpdateAccessSiteControllertest2.php

.

  ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Laravel  
    PASS   ..................................................................................................................................................................................................................... 1 file 

PhpStorm clearly recognizes that the import is unused and offers to remove it, but Pint misses it.

In particular if I remove the word fulfillment from this comment below does Pint actually determine that the import is unused and removes it

// If the fulfillment center changed, and it was to a value or if the fgs_site_id changed, let's reload the relationships

Steps To Reproduce

  1. Have a comment that has the same word as the name of an imported class, but does not do a Class::class or any other sort of reference to said class
  2. Have no references to that class otherwise in the code
  3. Run pint and see that the import is not removed

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions