RootNodeTreeBuilderRector

Changes TreeBuilder with root() call to constructor passed root and getRootNode() call

 use Symfony\Component\Config\Definition\Builder\TreeBuilder;

-$treeBuilder = new TreeBuilder();
-$rootNode = $treeBuilder->root('acme_root');
+$treeBuilder = new TreeBuilder('acme_root');
+$rootNode = $treeBuilder->getRootNode();
 $rootNode->someCall();

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony42\Rector\New_\RootNodeTreeBuilderRector;

return RectorConfig::configure()
    ->withRules([
        RootNodeTreeBuilderRector::class,
    ]);
SETS:  symfony/* 4.2