DependencyInjection/Compiler/BlockPass.php
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition('fxp_block.extension')) {
            return;
        }

        $definition = $container->getDefinition('fxp_block.extension');

        // Builds an array with service IDs as keys and tag aliases as values
        $types = [];

        foreach ($container->findTaggedServiceIds('fxp_block.type') as $serviceId => $tag) {
            $serviceDefinition = $this->getPublicRequireDefinition($container, $serviceId, 'types');

            // Support type access by FQCN
            $types[$serviceDefinition->getClass()] = $serviceId;
        }

        $definition->replaceArgument(0, $types);

        $typeExtensions = [];

        foreach ($container->findTaggedServiceIds('fxp_block.type_extension') as $serviceId => $tag) {
            $extDef = $this->getPublicRequireDefinition($container, $serviceId, 'type extensions');
            /* @var BlockTypeExtensionInterface|string $extClass */
            $extClass = $extDef->getClass();
            $extendedTypes = $extClass::getExtendedTypes();

            if (empty($extendedTypes)) {
                throw new InvalidArgumentException(sprintf('The getExtendedTypes() method for service "%s" does not return any extended types.', $serviceId));
            }

            foreach ($extendedTypes as $extendedType) {
                $typeExtensions[$extendedType][] = $serviceId;
            }
        }

        $definition->replaceArgument(1, $typeExtensions);

        // Find all services annotated with "fxp_block.type_guesser"
        $guessers = array_keys($container->findTaggedServiceIds('fxp_block.type_guesser'));
        foreach ($guessers as $serviceId) {
            $this->getPublicRequireDefinition($container, $serviceId, 'type guessers');
        }

        $definition->replaceArgument(2, $guessers);
    }
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition('fxp_block.extension')) {
            return;
        }

        $definition = $container->getDefinition('fxp_block.extension');

        // Builds an array with service IDs as keys and tag aliases as values
        $types = [];

        foreach ($container->findTaggedServiceIds('fxp_block.type') as $serviceId => $tag) {
            $serviceDefinition = $this->getPublicRequireDefinition($container, $serviceId, 'types');

            // Support type access by FQCN
            $types[$serviceDefinition->getClass()] = $serviceId;
        }

        $definition->replaceArgument(0, $types);

        $typeExtensions = [];

        foreach ($container->findTaggedServiceIds('fxp_block.type_extension') as $serviceId => $tag) {
            $extDef = $this->getPublicRequireDefinition($container, $serviceId, 'type extensions');
            /* @var BlockTypeExtensionInterface|string $extClass */
            $extClass = $extDef->getClass();
            $extendedTypes = $extClass::getExtendedTypes();

            if (empty($extendedTypes)) {
                throw new InvalidArgumentException(sprintf('The getExtendedTypes() method for service "%s" does not return any extended types.', $serviceId));
            }

            foreach ($extendedTypes as $extendedType) {
                $typeExtensions[$extendedType][] = $serviceId;
            }
        }

        $definition->replaceArgument(1, $typeExtensions);

        // Find all services annotated with "fxp_block.type_guesser"
        $guessers = array_keys($container->findTaggedServiceIds('fxp_block.type_guesser'));
        foreach ($guessers as $serviceId) {
            $this->getPublicRequireDefinition($container, $serviceId, 'type guessers');
        }

        $definition->replaceArgument(2, $guessers);
    }
{@inheritdoc}