Skip to content

Commit

Permalink
skip private method
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Jul 5, 2021
1 parent e93a102 commit 97ca45a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build/config/config-downgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

declare(strict_types=1);

use PHPStan\PhpDocParser\Ast\Node;
use Rector\Core\Configuration\Option;
use Rector\Core\Contract\Rector\RectorInterface;
use Rector\Core\Stubs\PHPStanStubLoader;
use Rector\DowngradePhp72\Rector\ClassMethod\DowngradeParameterTypeWideningRector;
use Rector\NodeNameResolver\Contract\NodeNameResolverInterface;
use Rector\Set\ValueObject\DowngradeSetList;
use Symfony\Component\Console\Style\StyleInterface;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\SimplePhpDocParser\Contract\PhpDocNodeVisitorInterface;

$phpStanStubLoader = new PHPStanStubLoader();
$phpStanStubLoader->loadStubs();
Expand All @@ -32,6 +35,9 @@
DowngradeParameterTypeWideningRector::SAFE_TYPES => [
RectorInterface::class,
StyleInterface::class,
PhpDocNodeVisitorInterface::class,
Node::class,
NodeNameResolverInterface::class,
]
]]);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Rector\Tests\DowngradePhp72\Rector\ClassMethod\DowngradeParameterTypeWideningRector\Fixture;

class SkipPrivateMethod
{
private function has(string $callable)
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ public function refactor(Node $node): ?Node
}
}

if ($node->isPrivate()) {
return null;
}

if ($this->skipClassMethod($node)) {
return null;
}
Expand Down

0 comments on commit 97ca45a

Please sign in to comment.