Repository: symfony/symfony
File: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php (PHP)

Code before:
        private bool $debug,
    ) {
    }

    /**
     * Generates the configuration tree builder.
     */
    public function getConfigTreeBuilder(): TreeBuilder
    {
        $treeBuilder = new TreeBuilder('framework');
        $rootNode = $treeBuilder->getRootNode();

        $rootNode
            ->docUrl('https://symfony.com/doc/{version:major}.{version:minor}/reference/configuration/framework.html', 'symfony/framework-bundle')
            ->beforeNormalization()
                ->ifArray()
                ->then(static function ($v) {
                    if (isset($v['templating']) && class_exists(Package::class)) {
                        $v['assets'] ??= [];
                    }

                    return $v;
                })
            ->end()
            ->validate()
                ->always(function ($v) {
                    if (!isset($v['use_sapi_error_renderer'])) {
                        trigger_deprecation('symfony/framework-bundle', '7.4', 'Not setting the "framework.use_sapi_error_renderer" config option is deprecated. It will default to "true" in 8.0.');

                        $v['use_sapi_error_renderer'] = false;
                    }

                    return $v;
                })
            ->end()
            ->children()
                ->scalarNode('secret')->end()
                ->booleanNode('http_method_override')
                    ->info("Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests.")
                    ->defaultFalse()
                ->end()
                ->arrayNode('allowed_http_method_override')
                    ->info('Sets the list of HTTP methods that can be overridden. Set to null to allow all methods to be overridden (default). Set to an empty array to disallow overrides entirely. Otherwise, provide the list of uppercased method names that are allowed.')
                    ->stringPrototype()->end()
                    ->defaultNull()
                    ->validate()
                        ->ifTrue(static fn ($v) => array_intersect($v, ['GET', 'HEAD', 'CONNECT', 'TRACE']))
                        ->thenInvalid('The HTTP methods "GET", "HEAD", "CONNECT", and "TRACE" cannot be overridden.')
                    ->end()
                ->end()
                ->scalarNode('trust_x_sendfile_type_header')

Review comment (suggestion):
Using `always` breaks the type validation of the value in array-shape or Json Schema. It's better using `ifFalse` in the `booleanNode`.

Code after:
        private bool $debug,
    ) {
    }

    /**
     * Generates the configuration tree builder.
     */
    public function getConfigTreeBuilder(): TreeBuilder
    {
        $treeBuilder = new TreeBuilder('framework');
        $rootNode = $treeBuilder->getRootNode();

        $rootNode
            ->docUrl('https://symfony.com/doc/{version:major}.{version:minor}/reference/configuration/framework.html', 'symfony/framework-bundle')
            ->beforeNormalization()
                ->ifArray()
                ->then(static function ($v) {
                    if (isset($v['templating']) && class_exists(Package::class)) {
                        $v['assets'] ??= [];
                    }

                    return $v;
                })
            ->end()
            ->children()
                ->scalarNode('secret')->end()
                ->booleanNode('http_method_override')
                    ->info("Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests.")
                    ->defaultFalse()
                ->end()
                ->arrayNode('allowed_http_method_override')
                    ->info('Sets the list of HTTP methods that can be overridden. Set to null to allow all methods to be overridden (default). Set to an empty array to disallow overrides entirely. Otherwise, provide the list of uppercased method names that are allowed.')
                    ->stringPrototype()->end()
                    ->defaultNull()
                    ->validate()
                        ->ifTrue(static fn ($v) => array_intersect($v, ['GET', 'HEAD', 'CONNECT', 'TRACE']))
                        ->thenInvalid('The HTTP methods "GET", "HEAD", "CONNECT", and "TRACE" cannot be overridden.')
                    ->end()
                ->end()
                ->scalarNode('trust_x_sendfile_type_header')
                    ->info('Set true to enable support for xsendfile in binary file responses.')
                    ->defaultValue('%env(bool:default::SYMFONY_TRUST_X_SENDFILE_TYPE_HEADER)%')
                ->end()
                ->scalarNode('ide')->defaultValue($this->debug ? '%env(default::SYMFONY_IDE)%' : null)->end()
                ->booleanNode('test')->end()
                ->scalarNode('default_locale')->defaultValue('en')->end()
                ->booleanNode('set_locale_from_accept_language')
                    ->info('Whether to use the Accept-Language HTTP header to set the Request locale (only when the "_locale" request attribute is not passed).')
                    ->defaultFalse()
                ->end()
                ->booleanNode('set_content_language_from_locale')