Repository: symfony/symfony
File: src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php (PHP)

Code before:
    private function getServiceClass(ContainerBuilder $container, string $serviceId): string
    {
        while (true) {
            $definition = $container->findDefinition($serviceId);

            if (!$definition->getClass() && $definition instanceof ChildDefinition) {
                $serviceId = $definition->getParent();

                continue;
            }

            return $definition->getClass();
        }
    }

    private function registerTypeMapping(ContainerBuilder $container): void
    {
        if (!$container->hasDefinition('messenger.transport.symfony_serializer')) {
            return;
        }

        $typeToClassMap = [];
        foreach ($container->findTaggedResourceIds('messenger.message') as $id => $tags) {
            $class = $container->getDefinition($id)->getClass();
            foreach ($tags as $tag) {
                if (isset($tag['serializedTypeName'])) {
                    if (isset($typeToClassMap[$tag['serializedTypeName']])) {
                        throw new RuntimeException(\sprintf('The serialized type name "%s" is already mapped to class "%s", cannot map it to "%s" as well. Each serialized type must be unique.', $tag['serializedTypeName'], $typeToClassMap[$tag['serializedTypeName']], $class));
                    }
                    $typeToClassMap[$tag['serializedTypeName']] = $class;
                }
            }
        }

        $container->getDefinition('messenger.transport.symfony_serializer')->setArgument(3, $typeToClassMap);
    }
}


Review comment (suggestion):
```suggestion
                if (!isset($tag['serializedTypeName'])) {
                    continue;
```

Code after:
    private function getServiceClass(ContainerBuilder $container, string $serviceId): string
    {
        while (true) {
            $definition = $container->findDefinition($serviceId);

            if (!$definition->getClass() && $definition instanceof ChildDefinition) {
                $serviceId = $definition->getParent();

                continue;
            }

            return $definition->getClass();
        }
    }

    private function registerTypeMapping(ContainerBuilder $container): void
    {
        if (!$container->hasDefinition('messenger.transport.symfony_serializer')) {
            return;
        }

        $typeToClassMap = [];
        foreach ($container->findTaggedResourceIds('messenger.message') as $id => $tags) {
            $class = $container->getDefinition($id)->getClass();
            foreach ($tags as $tag) {
                if (!isset($tag['serializedTypeName'])) {
                    continue;
                }
                if (isset($typeToClassMap[$tag['serializedTypeName']])) {
                    throw new RuntimeException(\sprintf('The serialized type name "%s" is already mapped to class "%s", cannot map it to "%s" as well. Each serialized type must be unique.', $tag['serializedTypeName'], $typeToClassMap[$tag['serializedTypeName']], $class));
                }
                $typeToClassMap[$tag['serializedTypeName']] = $class;
            }
        }

        $container->getDefinition('messenger.transport.symfony_serializer')->setArgument(3, $typeToClassMap);
    }
}