<?php

namespace AshleyDawson\SimplePaginationBundle\DependencyInjection;

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

/**
 * Class Configuration
 *
 * @package AshleyDawson\SimplePaginationBundle\DependencyInjection
 * @author Ashley Dawson <ashley@ashleydawson.co.uk>
 */
class Configuration implements ConfigurationInterface
{
    /**
     * {@inheritdoc}
     */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder('ashley_dawson_simple_pagination');
        $rootNode = $treeBuilder->getRootNode();

        $rootNode
            ->children()
                ->arrayNode('defaults')
                ->addDefaultsIfNotSet()
                ->children()
                    ->integerNode('items_per_page')->defaultValue(10)->min(1)->isRequired()->end()
                    ->integerNode('pages_in_range')->defaultValue(5)->min(1)->isRequired()->end()
                    ->scalarNode('template')->defaultValue('AshleyDawsonSimplePaginationBundle:Pagination:default.html.twig')->end()
                ->end()
            ->end()
        ;

        return $treeBuilder;
    }
}

<?php

namespace AshleyDawson\SimplePaginationBundle\DependencyInjection;

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

/**
 * Class Configuration
 *
 * @package AshleyDawson\SimplePaginationBundle\DependencyInjection
 * @author Ashley Dawson <ashley@ashleydawson.co.uk>
 */
class Configuration implements ConfigurationInterface
{
    const ROOT_NODE_NAME = '';

    /**
     * {@inheritdoc}
     */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder('ashley_dawson_simple_pagination');
        $rootNode = \method_exists($treeBuilder, 'getRootNode')
            ? $treeBuilder->getRootNode()
            : $treeBuilder->root('ashley_dawson_simple_pagination');

        $rootNode
            ->children()
                ->arrayNode('defaults')
                ->addDefaultsIfNotSet()
                ->children()
                    ->integerNode('items_per_page')->defaultValue(10)->min(1)->isRequired()->end()
                    ->integerNode('pages_in_range')->defaultValue(5)->min(1)->isRequired()->end()
                    ->scalarNode('template')->defaultValue('AshleyDawsonSimplePaginationBundle:Pagination:default.html.twig')->end()
                ->end()
            ->end()
        ;

        return $treeBuilder;
    }
}

Check getRootNode method exists for older Symfony versions
Check getRootNode method exists for older Symfony versions
