File tree Expand file tree Collapse file tree
rules-tests/TypeDeclarationDocblocks/Rector/ClassMethod/AddParamArrayDocblockBasedOnArrayMapRector/config
rules/TypeDeclarationDocblocks/Rector/ClassMethod Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55use Rector \Config \RectorConfig ;
66use Rector \TypeDeclarationDocblocks \Rector \ClassMethod \AddParamArrayDocblockBasedOnArrayMapRector ;
7- use Rector \TypeDeclarationDocblocks \Rector \ClassMethod \AddParamArrayDocblockFromAssignsParamToParamReferenceRector ;
87
98return RectorConfig::configure ()
109 ->withRules ([AddParamArrayDocblockBasedOnArrayMapRector::class]);
Original file line number Diff line number Diff line change 55namespace Rector \TypeDeclarationDocblocks \Rector \ClassMethod ;
66
77use PhpParser \Node ;
8+ use Rector \PhpParser \Node \BetterNodeFinder ;
89use Rector \Rector \AbstractRector ;
910use Symplify \RuleDocGenerator \ValueObject \CodeSample \CodeSample ;
1011use Symplify \RuleDocGenerator \ValueObject \RuleDefinition ;
1112
1213final 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}
2733CODE_SAMPLE
2834 ,
29- <<<'CODE_SAMPLE'
35+ <<<'CODE_SAMPLE'
3036final class SomeClass
3137{
3238 /**
@@ -38,8 +44,7 @@ public function run(array $names): void
3844 }
3945}
4046CODE_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}
Original file line number Diff line number Diff line change 2626use Rector \DeadCode \Rector \ClassMethod \RemoveUselessParamTagRector ;
2727use Rector \DeadCode \Rector \ClassMethod \RemoveUselessReturnExprInConstructRector ;
2828use Rector \DeadCode \Rector \ClassMethod \RemoveUselessReturnTagRector ;
29- use Rector \DeadCode \Rector \Concat \RemoveConcatAutocastRector ;
3029use Rector \DeadCode \Rector \Closure \RemoveUnusedClosureVariableUseRector ;
30+ use Rector \DeadCode \Rector \Concat \RemoveConcatAutocastRector ;
3131use Rector \DeadCode \Rector \ConstFetch \RemovePhpVersionIdCheckRector ;
3232use Rector \DeadCode \Rector \Expression \RemoveDeadStmtRector ;
3333use Rector \DeadCode \Rector \Expression \SimplifyMirrorAssignRector ;
You can’t perform that action at this time.
0 commit comments