Error with merged carbon imports with importNames and removeUnusedImports.#7811
Error with merged carbon imports with importNames and removeUnusedImports.#7811BinaryKitten wants to merge 4 commits intorectorphp:mainfrom
Conversation
|
The |
|
it's weird that its creating the It only occurs when there's a class named the start of the other - otherwise it doesn't import the |
|
@samsonasik if you could point me in the general direction - i'd love to submit a possible fix - learn more and be useful :) |
|
@BinaryKitten the remove unused imports is on rector-src/src/PostRector/Rector/UnusedImportRemovingPostRector.php Lines 163 to 173 in 540fbfa To add more resolved class, you can add more then register it: rector-src/src/DependencyInjection/LazyContainerFactory.php Lines 333 to 338 in 540fbfa then, you may can fetch via |
| @@ -0,0 +1,43 @@ | |||
| <?php | |||
There was a problem hiding this comment.
this only for autoimport + remove, nothing todo with rename, so you can move these fixture tests to tests/Issues/NamespacedUseAutoImport which only check on this functionality for auto import + remove unused import:
https://github.com/rectorphp/rector-src/tree/main/tests/Issues/NamespacedUseAutoImport/Fixture
When using Carbon as a class and the CarbonInterface - we get a weird merged import process.
this imports
use Carbon\Carbon\CarbonInterfacewhich is not valid.Test case here in PR
Demo
https://getrector.com/demo/14fa4e52-32b1-4931-811e-17d522a8c833