Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

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

use Rector\Tests\DeadCode\Rector\ClassMethod\RemoveParentDelegatingClassMethodRector\Source\SomeParentCommand;

final class SkipAnnotationDocblock extends SomeParentCommand
{
/**
* @Route("/first", methods={"GET"})
*/
public function anotherMethod(): void
{
parent::anotherMethod();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Rector\DeadCode\Rector\ClassMethod;

use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode;
use PhpParser\Node;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Expr\Variable;
Expand All @@ -12,6 +13,7 @@
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\Return_;
use PhpParser\NodeVisitor;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\ExtendedMethodReflection;
use PHPStan\Reflection\ExtendedParameterReflection;
Expand Down Expand Up @@ -115,18 +117,7 @@ public function refactor(Node $node): ?int
private function hasRefiningDocblock(ClassMethod $classMethod): bool
{
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($classMethod);

return $phpDocInfo->hasByNames(
[
'@param',
'@phpstan-param',
'@psalm-param',
'@return',
'@phpstan-return',
'@psalm-return',
'@deprecated',
]
);
return array_any($phpDocInfo->getPhpDocNode()->children, fn(PhpDocChildNode $phpDocChildNode): bool => $phpDocChildNode instanceof PhpDocTagNode);
}

private function matchParentMethodReflection(ClassMethod $classMethod): ?ExtendedMethodReflection
Expand Down
Loading