DependencyInjection/Compiler/GenericCompilerPass.php
public function process(ContainerBuilder $container)
    {
        if (!$container->has($this->registry)) {
            return;
        }

        $definition = $container->findDefinition($this->registry);
        $taggedServices = $container->findTaggedServiceIds($this->tag);

        foreach ($taggedServices as $id => $tags) {
            $arguments = [new Reference($id)];
            if ($this->withPriority) {
                $arguments[] = $this->resolvePriority($tags);
            }
            $definition->addMethodCall($this->method, $arguments);
        }
    }
public function process(ContainerBuilder $container)
    {
        if (!$container->has($this->registry)) {
            return;
        }

        $definition = $container->findDefinition($this->registry);
        $taggedServices = $container->findTaggedServiceIds($this->tag);

        foreach ($taggedServices as $id => $tags) {
            $arguments = [new Reference($id)];
            if ($this->withPriority) {
                $arguments[] = $this->resolvePriority($tags);
            }
            $definition->addMethodCall($this->method, $arguments);
        }
    }
Inject tagged services into defined registry

@api

@param ContainerBuilder $container

@throws InvalidArgumentException