src/Api/DependencyInjection/Compiler/ServicePass.php
public function process(ContainerBuilder $container)
    {
        $definition = $container->findDefinition(ServiceCollection::class);
        $services = $container->findTaggedServiceIds('ds_api.service');

        foreach ($services as $id => $tags) {
            foreach ($tags as $tag) {
                if (array_key_exists('alias', $tag)) {
                    $definition->addMethodCall('set', [ $tag['alias'], new Reference($id) ]);
                } else {
                    $definition->addMethodCall('add', [ new Reference($id) ]);
                }
            }
        }
    }
public function process(ContainerBuilder $container)
    {
        $definition = $container->findDefinition(ServiceCollection::class);
        $services = $container->findTaggedServiceIds('ds_api.service');

        foreach ($services as $id => $tags) {
            foreach ($tags as $tag) {
                if (array_key_exists('alias', $tag)) {
                    $definition->addMethodCall('set', [ $tag['alias'], new Reference($id) ]);
                } else {
                    $definition->addMethodCall('add', [ new Reference($id) ]);
                }
            }
        }
    }
Process

@param \Symfony\Component\DependencyInjection\ContainerBuilder $container