-
-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add fixture for only importNames() without removeUnusedIMpotrs() (#5194)
- Loading branch information
1 parent
01fb666
commit 3e505e5
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...s/Renaming/Rector/Name/RenameClassRector/AutoImportNamesWithoutRemoveUnusedImportTest.php
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,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\Renaming\Rector\Name\RenameClassRector; | ||
|
||
use Iterator; | ||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use Rector\Testing\PHPUnit\AbstractRectorTestCase; | ||
|
||
/** | ||
* @see \Rector\PostRector\Rector\NameImportingPostRector | ||
*/ | ||
final class AutoImportNamesWithoutRemoveUnusedImportTest extends AbstractRectorTestCase | ||
{ | ||
#[DataProvider('provideData')] | ||
public function test(string $filePath): void | ||
{ | ||
$this->doTestFile($filePath); | ||
} | ||
|
||
public static function provideData(): Iterator | ||
{ | ||
return self::yieldFilesFromDirectory(__DIR__ . '/FixtureAutoImportNamesWithoutRemoveUnusedImport'); | ||
} | ||
|
||
public function provideConfigFilePath(): string | ||
{ | ||
return __DIR__ . '/config/auto_import_names_without_remove_unused_use.php'; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...assRector/FixtureAutoImportNamesWithoutRemoveUnusedImport/factory_invoke_typehint.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,29 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Renaming\Rector\Name\RenameClassRector\FixtureAutoImportNamesWithoutRemoveUnusedImport; | ||
|
||
use Interop\Container\ContainerInterface; | ||
|
||
class FactoryInvokeTypehint | ||
{ | ||
public function __invoke(ContainerInterface $container) | ||
{ | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Renaming\Rector\Name\RenameClassRector\FixtureAutoImportNamesWithoutRemoveUnusedImport; | ||
|
||
use Psr\Container\ContainerInterface; | ||
|
||
class FactoryInvokeTypehint | ||
{ | ||
public function __invoke(ContainerInterface $container) | ||
{ | ||
} | ||
} | ||
|
||
?> |
14 changes: 14 additions & 0 deletions
14
...ming/Rector/Name/RenameClassRector/config/auto_import_names_without_remove_unused_use.php
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,14 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Config\RectorConfig; | ||
use Rector\Renaming\Rector\Name\RenameClassRector; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->importNames(); | ||
|
||
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [ | ||
'Interop\Container\ContainerInterface' => 'Psr\Container\ContainerInterface', | ||
]); | ||
}; |