Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

jorgsowa
Copy link
Contributor

@jorgsowa jorgsowa commented Oct 7, 2024

Second try of #6350

Fixes the UnusedImportRemovingPostRector rule when the imported namespace doesn't match the letter case in the code, by comparing all names in lowercase, except consts, because of their case sensitivity.

Additionally:
Early return for cases when no usage of imported namespaces has been found.

Example:

<?php

use Json;


class Json {
}

var_dump(JSON::class);

https://getrector.com/demo/f2508805-2d69-4792-908b-3555589439e1

To do:

  • add a test with the mixed namespace for consts

@jorgsowa jorgsowa marked this pull request as ready for review October 8, 2024 22:40
@jorgsowa jorgsowa changed the title [UnusedImport] Different letter case for classes [UnusedImport] Different letter case for classes + optimization Oct 9, 2024
@jorgsowa jorgsowa requested a review from samsonasik October 9, 2024 21:58
@samsonasik
Copy link
Member

Let's give it a try once more, thank you @jorgsowa

@samsonasik samsonasik merged commit cb4ccd6 into rectorphp:main Oct 11, 2024
36 checks passed
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.

2 participants