DependencyInjection/Compiler/RegisterConstraintsPass.php
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition($this->registry) && !$container->hasAlias($this->registry)) {
            return;
        }

        $registry = $container->findDefinition($this->registry);
        foreach ($container->findTaggedServiceIds($this->tag) as $id => $tags) {
            $definition = $container->getDefinition($id);
            foreach ($tags as $tag) {
                if (!isset($tag['type'])) {
                    throw new \InvalidArgumentException(sprintf('The service "%s" must define the attribute "type" on "%s" tags.', $id, $this->tag));
                }

                $registry->addMethodCall('register', [$tag['type'], $definition]);
            }
        }
    }
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition($this->registry) && !$container->hasAlias($this->registry)) {
            return;
        }

        $registry = $container->findDefinition($this->registry);
        foreach ($container->findTaggedServiceIds($this->tag) as $id => $tags) {
            $definition = $container->getDefinition($id);
            foreach ($tags as $tag) {
                if (!isset($tag['type'])) {
                    throw new \InvalidArgumentException(sprintf('The service "%s" must define the attribute "type" on "%s" tags.', $id, $this->tag));
                }

                $registry->addMethodCall('register', [$tag['type'], $definition]);
            }
        }
    }
{@inheritdoc}