diff --git a/config/rector/sets/cakephp60.php b/config/rector/sets/cakephp60.php index dbd1f3b1..9800a76c 100644 --- a/config/rector/sets/cakephp60.php +++ b/config/rector/sets/cakephp60.php @@ -103,4 +103,28 @@ new AddReturnTypeDeclaration('Cake\View\View', 'setPlugin', new SimpleStaticType('')), new AddReturnTypeDeclaration('Cake\View\View', 'setElementCache', new SimpleStaticType('')), ]); + + // ===== Remove underscores from method names ===== + + $map = [ + 'Cache' => [ + 'Cake\Cache\Cache' => ['_buildEngine'], + 'Cake\Cache\CacheEngine' => ['_key'], + 'Cake\Cache\Engine\FileEngine' => ['_clearDirectory', '_setKey', '_active', '_key'], + 'Cake\Cache\Engine\MemcachedEngine' => ['_setOptions'], + 'Cake\Cache\Engine\RedisEngine' => [ + '_connect', '_connectTransient', '_connectPersistent', '_createRedisInstance', + ], + ], + ]; + + foreach ($map as $definitions) { + foreach ($definitions as $className => $methods) { + foreach ($methods as $method) { + $rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [ + new MethodCallRename($className, $method, substr($method, 1)), + ]); + } + } + } };