DependencyInjection/Compiler/AddBasketHandlersPass.php
public function process(ContainerBuilder $container): void
    {
        if (!$container->has(BasketFactory::class)) {
            return;
        }

        $tagged = $container->findTaggedServiceIds('ruwork_runet_id.basket_handler', true);
        $references = [];

        foreach ($tagged as $id => $attributes) {
            $class = $container->getDefinition($id)->getClass();

            if (!is_subclass_of($class, HandlerInterface::class)) {
                throw new \LogicException(sprintf('Basket handler "%s" must implement "%s".', $class, HandlerInterface::class));
            }

            $references[$class] = new Reference($id);
        }

        $container
            ->findDefinition(BasketFactory::class)
            ->setArgument('$handlers', ServiceLocatorTagPass::register($container, $references));
    }
public function process(ContainerBuilder $container): void
    {
        if (!$container->has(BasketFactory::class)) {
            return;
        }

        $tagged = $container->findTaggedServiceIds('ruwork_runet_id.basket_handler', true);
        $references = [];

        foreach ($tagged as $id => $attributes) {
            $class = $container->getDefinition($id)->getClass();

            if (!is_subclass_of($class, HandlerInterface::class)) {
                throw new \LogicException(sprintf('Basket handler "%s" must implement "%s".', $class, HandlerInterface::class));
            }

            $references[$class] = new Reference($id);
        }

        $container
            ->findDefinition(BasketFactory::class)
            ->setArgument('$handlers', ServiceLocatorTagPass::register($container, $references));
    }
{@inheritdoc}