-
-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PostRector][AutoImport] Handle remove unused import with auto import…
… enabled on conflict with existing use statement (#5912) * [PostRector][AutoImport] Handle remove unused import with auto import enabled on conflict with existing use statement * more tests * fix * fix * fix
- Loading branch information
1 parent
650ae6a
commit c431eae
Showing
6 changed files
with
152 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
tests/Issues/NamespacedUseAutoImport/Fixture/conflict_last_name_aliased.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Issues\NamespacedUseAutoImport\Fixture; | ||
|
||
use Some\Class_ as ClassOrig; | ||
use PhpParser\Node; | ||
|
||
final class ConflictLastNameAliased | ||
{ | ||
/** | ||
* @param Node\Stmt\Class_ $param | ||
*/ | ||
public function run($param): void | ||
{ | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Issues\NamespacedUseAutoImport\Fixture; | ||
|
||
use PhpParser\Node\Stmt\Class_; | ||
final class ConflictLastNameAliased | ||
{ | ||
/** | ||
* @param Class_ $param | ||
*/ | ||
public function run($param): void | ||
{ | ||
} | ||
} | ||
|
||
?> |
35 changes: 35 additions & 0 deletions
35
tests/Issues/NamespacedUseAutoImport/Fixture/conflict_last_name_unused.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Issues\NamespacedUseAutoImport\Fixture; | ||
|
||
use Some\Class_; | ||
use PhpParser\Node; | ||
|
||
final class ConflictLastNameUnused | ||
{ | ||
/** | ||
* @param Node\Stmt\Class_ $param | ||
*/ | ||
public function run($param): void | ||
{ | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Issues\NamespacedUseAutoImport\Fixture; | ||
|
||
use PhpParser\Node\Stmt\Class_; | ||
final class ConflictLastNameUnused | ||
{ | ||
/** | ||
* @param Class_ $param | ||
*/ | ||
public function run($param): void | ||
{ | ||
} | ||
} | ||
|
||
?> |
16 changes: 16 additions & 0 deletions
16
tests/Issues/NamespacedUseAutoImport/Fixture/non_docblock_conflict.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Issues\NamespacedUseAutoImport\Fixture; | ||
|
||
use Some\Class_; | ||
use PhpParser\Node; | ||
|
||
final class SkipNonDocblockConflictLastName | ||
{ | ||
public function run(Node\Stmt\Class_ $param): void | ||
{ | ||
new Class_(); | ||
} | ||
|
||
|
||
} |
17 changes: 17 additions & 0 deletions
17
tests/Issues/NamespacedUseAutoImport/Fixture/skip_conflict_last_name_aliased_used.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Issues\NamespacedUseAutoImport\Fixture; | ||
|
||
use Some\Class_ as ClassOrig; | ||
use PhpParser\Node; | ||
|
||
final class SkipConflictLastNameAliasedUsed | ||
{ | ||
/** | ||
* @param Node\Stmt\Class_ $param | ||
*/ | ||
public function run($param): void | ||
{ | ||
new ClassOrig(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/Issues/NamespacedUseAutoImport/Fixture/skip_conflict_last_name_used.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Issues\NamespacedUseAutoImport\Fixture; | ||
|
||
use Some\Class_; | ||
use PhpParser\Node; | ||
|
||
final class SkipConflictLastNameUsed | ||
{ | ||
/** | ||
* @param Node\Stmt\Class_ $param | ||
*/ | ||
public function run($param): void | ||
{ | ||
new Class_(); | ||
} | ||
} |