Processing your own Symfony bundle configuration

Code
<?php

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


class Configuration implements ConfigurationInterface
{
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder('my_config');
        $rootNode = $treeBuilder->getRootNode();

        $rootNode->children()
            ->integerNode('number')
                ->min(3)
                ->max(9)
            ->end()
            ->booleanNode('boolean')
                ->defaultValue(true)
            ->end()
            ->scalarNode('string')
            ->end();
        
        return $treeBuilder;
    }
}

$configuration = new Configuration();
$processor = new Processor();

// config is valid and processed
$config = ['my_config' => [
    'number' => 5,
    'string' => 'value',
]];

$config = $processor
    ->processConfiguration($configuration, $config);
dump($config);
echo PHP_EOL;


// config "number" is not between 3 and 9
$config = ['my_config' => [
    'number' => 1,
    'boolean' => false,
    'string' => 'value',
]];

try {
    $config = $processor
        ->processConfiguration($configuration, $config);
}
catch (Exception $e) {
    echo $e->getMessage() . PHP_EOL . PHP_EOL;
}


// config "boolean" is not true or false
$config = ['my_config' => [
    'number' => 6,
    'boolean' => 'ttt',
    'string' => 'value',
]];

try {
    $config = $processor
        ->processConfiguration($configuration, $config);
}
catch (Exception $e) {
    echo $e->getMessage() . PHP_EOL . PHP_EOL;
}
Result
^ array:3 [
"number" => 5
"string" => "value"
"boolean" => true
]


The value 1 is too small for path "my_config.number". Should be greater than or equal to 3

Invalid type for path "my_config.boolean". Expected "bool", but got "string".
Used Versions
PHP 8.3, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8