mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-10 21:22:21 +00:00
skip private method
This commit is contained in:
parent
e93a102b99
commit
97ca45aade
|
@ -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,
|
||||
]
|
||||
]]);
|
||||
};
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\DowngradePhp72\Rector\ClassMethod\DowngradeParameterTypeWideningRector\Fixture;
|
||||
|
||||
class SkipPrivateMethod
|
||||
{
|
||||
private function has(string $callable)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -116,6 +116,10 @@ CODE_SAMPLE
|
|||
}
|
||||
}
|
||||
|
||||
if ($node->isPrivate()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($this->skipClassMethod($node)) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user