Skip to content

Commit 4bd864e

Browse files
committed
fixup! [tdd] Add AddParamArrayDocblockBasedOnArrayMapRector
1 parent 0fe6597 commit 4bd864e

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

rules-tests/TypeDeclarationDocblocks/Rector/ClassMethod/AddParamArrayDocblockBasedOnArrayMapRector/config/configured_rule.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Rector\Config\RectorConfig;
66
use Rector\TypeDeclarationDocblocks\Rector\ClassMethod\AddParamArrayDocblockBasedOnArrayMapRector;
7-
use Rector\TypeDeclarationDocblocks\Rector\ClassMethod\AddParamArrayDocblockFromAssignsParamToParamReferenceRector;
87

98
return RectorConfig::configure()
109
->withRules([AddParamArrayDocblockBasedOnArrayMapRector::class]);

rules/TypeDeclarationDocblocks/Rector/ClassMethod/AddParamArrayDocblockBasedOnArrayMapRector.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@
55
namespace Rector\TypeDeclarationDocblocks\Rector\ClassMethod;
66

77
use PhpParser\Node;
8+
use Rector\PhpParser\Node\BetterNodeFinder;
89
use Rector\Rector\AbstractRector;
910
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
1011
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
1112

1213
final class AddParamArrayDocblockBasedOnArrayMapRector extends AbstractRector
1314
{
15+
public function __construct(
16+
private readonly BetterNodeFinder $betterNodeFinder
17+
) {
18+
19+
}
1420

1521
public function getRuleDefinition(): RuleDefinition
1622
{
@@ -26,7 +32,7 @@ public function run(array $names): void
2632
}
2733
CODE_SAMPLE
2834
,
29-
<<<'CODE_SAMPLE'
35+
<<<'CODE_SAMPLE'
3036
final class SomeClass
3137
{
3238
/**
@@ -38,8 +44,7 @@ public function run(array $names): void
3844
}
3945
}
4046
CODE_SAMPLE
41-
42-
)
47+
),
4348
]);
4449
}
4550

@@ -65,9 +70,12 @@ public function refactor(Node $node)
6570
if (! $param->type instanceof Node\Identifier || ! $this->isName($param->type, 'array')) {
6671
continue;
6772
}
68-
}
6973

74+
// find array_map usage
75+
$paramName = $this->getName($param->var);
76+
77+
78+
}
7079

71-
// TODO: Implement refactor() method.
7280
}
7381
}

src/Config/Level/DeadCodeLevel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
2727
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnExprInConstructRector;
2828
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
29-
use Rector\DeadCode\Rector\Concat\RemoveConcatAutocastRector;
3029
use Rector\DeadCode\Rector\Closure\RemoveUnusedClosureVariableUseRector;
30+
use Rector\DeadCode\Rector\Concat\RemoveConcatAutocastRector;
3131
use Rector\DeadCode\Rector\ConstFetch\RemovePhpVersionIdCheckRector;
3232
use Rector\DeadCode\Rector\Expression\RemoveDeadStmtRector;
3333
use Rector\DeadCode\Rector\Expression\SimplifyMirrorAssignRector;

0 commit comments

Comments
 (0)