RemoveReflectionSetAccessibleCallsRector

Remove Reflection::setAccessible() calls

 $reflectionProperty = new ReflectionProperty($object, 'property');
-$reflectionProperty->setAccessible(true);
 $value = $reflectionProperty->getValue($object);

 $reflectionMethod = new ReflectionMethod($object, 'method');
-$reflectionMethod->setAccessible(false);
 $reflectionMethod->invoke($object);

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Php81\Rector\MethodCall\RemoveReflectionSetAccessibleCallsRector;

return RectorConfig::configure()
    ->withRules([
        RemoveReflectionSetAccessibleCallsRector::class,
    ]);
SETS:  PHP 8.1