Skip to content

Commit

Permalink
[TypeDeclaration] Replace ParentClassMethodTypeOverrideGuard::isRetur…
Browse files Browse the repository at this point in the history
…nTypeChangeAllowed() with ClassMethodReturnTypeOverrideGuard::shouldSkipClassMethod() in ReturnNeverTypeRector (#3321)

* [TypeDeclaration] Use ClassMethodReturnTypeOverrideGuard::shouldSkipClassMethod() in ReturnNeverTypeRector

* fix not operator usage
  • Loading branch information
samsonasik committed Jan 29, 2023
1 parent 8714537 commit 2ddd44b
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\PhpVersionFeature;
use Rector\NodeNestingScope\ValueObject\ControlStructure;
use Rector\VendorLocker\ParentClassMethodTypeOverrideGuard;
use Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;

Expand All @@ -32,7 +32,7 @@
final class ReturnNeverTypeRector extends AbstractRector
{
public function __construct(
private readonly ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard,
private readonly ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard,
private readonly PhpDocTypeChanger $phpDocTypeChanger,
private readonly PhpVersionProvider $phpVersionProvider,
) {
Expand Down Expand Up @@ -130,7 +130,7 @@ private function shouldSkip(ClassMethod | Function_ | Closure $node): bool
return true;
}

if ($node instanceof ClassMethod && ! $this->parentClassMethodTypeOverrideGuard->isReturnTypeChangeAllowed(
if ($node instanceof ClassMethod && $this->classMethodReturnTypeOverrideGuard->shouldSkipClassMethod(
$node
)) {
return true;
Expand Down

0 comments on commit 2ddd44b

Please sign in to comment.