Repository: symfony/symfony
File: src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.php (PHP)

Code before:
        ->set('serializer.name_converter.camel_case_to_snake_case', CamelCaseToSnakeCaseNameConverter::class)
        ->set('serializer.name_converter.snake_case_to_camel_case', SnakeCaseToCamelCaseNameConverter::class)

        ->set('serializer.name_converter.metadata_aware.abstract', MetadataAwareNameConverter::class)
            ->abstract()
            ->args([service('serializer.mapping.class_metadata_factory')])

        ->set('serializer.name_converter.metadata_aware')
            ->parent('serializer.name_converter.metadata_aware.abstract')

        // PropertyInfo extractor
        ->set('property_info.serializer_extractor', SerializerExtractor::class)
            ->args([service('serializer.mapping.class_metadata_factory')])
            ->tag('property_info.list_extractor', ['priority' => -999])

        // ErrorRenderer integration
        ->alias('error_renderer', 'error_renderer.serializer')
        ->alias('error_renderer.serializer', 'error_handler.error_renderer.serializer')

        ->set('error_handler.error_renderer.serializer', SerializerErrorRenderer::class)
            ->args([
                service('serializer'),
                inline_service()
                    ->factory([SerializerErrorRenderer::class, 'getPreferredFormat'])
                    ->args([service('request_stack')]),
                service('error_renderer.default'),
                inline_service()
                    ->factory([HtmlErrorRenderer::class, 'isDebug'])
                    ->args([service('request_stack'), param('kernel.debug')]),
            ])

        ->set('serializer.normalizer.backed_enum', BackedEnumNormalizer::class)
            ->tag('serializer.normalizer', ['built_in' => true, 'priority' => -915])

        ->set('serializer.normalizer.number', NumberNormalizer::class)
            ->tag('serializer.normalizer', ['built_in' => true, 'priority' => -915])
    ;
};


Review comment (suggestion):
this should make Symfony generate a lazy proxy, so that we don't create the service unless it's used:
```suggestion
                inline_service(ErrorRendererInterface::class)
                    ->factory('current')
                    ->args([['error_renderer.default']])
                    ->lazy(),
```

Code after:
        // Name converters
        ->set('serializer.name_converter.camel_case_to_snake_case', CamelCaseToSnakeCaseNameConverter::class)
        ->set('serializer.name_converter.snake_case_to_camel_case', SnakeCaseToCamelCaseNameConverter::class)

        ->set('serializer.name_converter.metadata_aware.abstract', MetadataAwareNameConverter::class)
            ->abstract()
            ->args([service('serializer.mapping.class_metadata_factory')])

        ->set('serializer.name_converter.metadata_aware')
            ->parent('serializer.name_converter.metadata_aware.abstract')

        // PropertyInfo extractor
        ->set('property_info.serializer_extractor', SerializerExtractor::class)
            ->args([service('serializer.mapping.class_metadata_factory')])
            ->tag('property_info.list_extractor', ['priority' => -999])

        // ErrorRenderer integration
        ->alias('error_renderer', 'error_renderer.serializer')
        ->alias('error_renderer.serializer', 'error_handler.error_renderer.serializer')

        ->set('error_handler.error_renderer.serializer', SerializerErrorRenderer::class)
            ->args([
                service('serializer'),
                inline_service()
                    ->factory([SerializerErrorRenderer::class, 'getPreferredFormat'])
                    ->args([service('request_stack')]),
                inline_service(ErrorRendererInterface::class)
                    ->factory([\Closure::class, 'fromCallable'])
                    ->args([service('error_renderer.default'), 'render'])
                    ->lazy(),
                inline_service()
                    ->factory([HtmlErrorRenderer::class, 'isDebug'])
                    ->args([service('request_stack'), param('kernel.debug')]),
            ])

        ->set('serializer.normalizer.backed_enum', BackedEnumNormalizer::class)
            ->tag('serializer.normalizer', ['built_in' => true, 'priority' => -915])

        ->set('serializer.normalizer.number', NumberNormalizer::class)
            ->tag('serializer.normalizer', ['built_in' => true, 'priority' => -915])
    ;
};