skip private method

This commit is contained in:
Tomas Votruba 2021-07-06 00:57:20 +02:00
parent e93a102b99
commit 97ca45aade
3 changed files with 20 additions and 0 deletions

View File

@ -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();
@ -32,6 +35,9 @@ return static function (ContainerConfigurator $containerConfigurator): void {
DowngradeParameterTypeWideningRector::SAFE_TYPES => [
RectorInterface::class,
StyleInterface::class,
PhpDocNodeVisitorInterface::class,
Node::class,
NodeNameResolverInterface::class,
]
]]);
};

View File

@ -0,0 +1,10 @@
<?php
namespace Rector\Tests\DowngradePhp72\Rector\ClassMethod\DowngradeParameterTypeWideningRector\Fixture;
class SkipPrivateMethod
{
private function has(string $callable)
{
}
}

View File

@ -116,6 +116,10 @@ CODE_SAMPLE
}
}
if ($node->isPrivate()) {
return null;
}
if ($this->skipClassMethod($node)) {
return null;
}