Skip to content

Commit 3782784

Browse files
authored
Enable $rectorConfig->removeUnusedImports() in rector config (#192)
1 parent 86f57ee commit 3782784

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

ecs.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
__DIR__ . '/tests',
1919
__DIR__ . '/rules-tests',
2020
__DIR__ . '/ecs.php',
21+
__DIR__ . '/rector.php',
2122
]);
2223

2324
$ecsConfig->ruleWithConfiguration(NoSuperfluousPhpdocTagsFixer::class, [

rector.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
declare(strict_types=1);
44

5+
use Rector\CodingStyle\Rector\String_\UseClassKeywordForClassNameResolutionRector;
56
use Rector\Config\RectorConfig;
67
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
78
use Rector\PHPUnit\Set\PHPUnitSetList;
@@ -10,6 +11,7 @@
1011

1112
return static function (RectorConfig $rectorConfig): void {
1213
$rectorConfig->importNames();
14+
$rectorConfig->removeUnusedImports();
1315

1416
$rectorConfig->sets([
1517
LevelSetList::UP_TO_PHP_81,
@@ -30,12 +32,14 @@
3032
__DIR__ . '/tests',
3133
__DIR__ . '/rules-tests',
3234
__DIR__ . '/config',
35+
__DIR__ . '/rector.php',
36+
__DIR__ . '/ecs.php',
3337
]);
3438

3539
$rectorConfig->skip([
3640
StringClassNameToClassConstantRector::class,
3741

38-
\Rector\CodingStyle\Rector\String_\UseClassKeywordForClassNameResolutionRector::class => [
42+
UseClassKeywordForClassNameResolutionRector::class => [
3943
// not useful short class cases, possibly skip in the rule
4044
__DIR__ . '/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionClassGetConstantsFilterRector.php',
4145
__DIR__ . '/rules/DowngradePhp81/Rector/FuncCall/DowngradeFirstClassCallableSyntaxRector.php',

src/NodeAnalyzer/ExprInTopStmtMatcher.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use PhpParser\Node;
88
use PhpParser\Node\Expr;
99
use PhpParser\Node\Expr\Closure;
10-
use PhpParser\Node\Stmt;
1110
use PhpParser\Node\Stmt\Do_;
1211
use PhpParser\Node\Stmt\Echo_;
1312
use PhpParser\Node\Stmt\Expression;

0 commit comments

Comments
 (0)