Skip to content

Commit

Permalink
[DeadCode] Add Function_ support on RemoveUselessParamTagRector (#5331)
Browse files Browse the repository at this point in the history
* [DeadCode] Add Function_ support on RemoveUselessParamTagRector

* implemented
  • Loading branch information
samsonasik authored Dec 6, 2023
1 parent a92fade commit 1daab3c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Rector\Tests\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector\Fixture;

/**
* @param string $a
*/
function foo(string $a)
{
}

?>
-----
<?php

namespace Rector\Tests\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector\Fixture;

function foo(string $a)
{
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use PhpParser\Node;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\Core\Rector\AbstractRector;
Expand Down Expand Up @@ -64,11 +65,11 @@ public function foo(string $a, string $b)
*/
public function getNodeTypes(): array
{
return [ClassMethod::class];
return [ClassMethod::class, Function_::class];
}

/**
* @param ClassMethod $node
* @param ClassMethod|Function_ $node
*/
public function refactor(Node $node): ?Node
{
Expand Down

0 comments on commit 1daab3c

Please sign in to comment.