[DeadDocBlock] Skip RemoveUselessParamTagRector on Generic Type (#5677)

Co-authored-by: Oskar Stark <oskarstark@googlemail.com>
This commit is contained in:
Abdul Malik Ikhsan 2021-02-25 15:36:33 +07:00 committed by GitHub
parent 8ccef95979
commit 105e2e7026
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View File

@ -7,6 +7,7 @@ namespace Rector\DeadDocBlock;
use PhpParser\Node\FunctionLike;
use PhpParser\Node\Param;
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareGenericTypeNode;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\NodeTypeResolver\TypeComparator\TypeComparator;
@ -47,6 +48,10 @@ final class DeadParamTagValueNodeAnalyzer
return false;
}
if ($paramTagValueNode->type instanceof AttributeAwareGenericTypeNode) {
return false;
}
return $paramTagValueNode->description === '';
}

View File

@ -0,0 +1,14 @@
<?php
namespace Rector\DeadDocBlock\Tests\Rector\ClassMethod\RemoveUselessParamTagRector\Fixture;
final class SkipGenericType
{
/**
* @param iterable<stdClass> $foo
*/
public function run(iterable $foo)
{
}
}
?>