Configurable

ChangeMethodVisibilityRector

Change visibility of method from parent class.

 class FrameworkClass
 {
     protected function someMethod()
     {
     }
 }

 class MyClass extends FrameworkClass
 {
-    public function someMethod()
+    protected function someMethod()
     {
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\ValueObject\Visibility;
use Rector\Visibility\Rector\ClassMethod\ChangeMethodVisibilityRector;
use Rector\Visibility\ValueObject\ChangeMethodVisibility;

return RectorConfig::configure()
    ->withConfiguredRule(ChangeMethodVisibilityRector::class, [
        new ChangeMethodVisibility('FrameworkClass', 'someMethod', Visibility::PROTECTED),
    ]);
SETS:  symfony/* 4.2