Description
Symfony version(s) affected: 4.4.6
Description
This issue is regarding a change in functionality of the !tagged_locator (Symfony\Component\DependencyInjection\Argument\ServiceLocator) after updating from 4.4.5 to 4.4.6.
With SF 4.4.5 and earlier, the injected tagged locator provides an array with the alias as key and the FQCN as value when calling getProvidedServices().
As of SF 4.4.6, the FQCN value is replaced with a '?'.
The reason it only provides a '?' is because it now uses a generic Reference instead of a TypedReference for the tagged services. The PhpDumper only adds the service type to the $serviceTypes property of the ServiceLocator if the reference is a TypedReference.
The change is caused by #35957 in \Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait.
Possible Solution
This specific problem can be solved by adding a TypedReference if the resolved class service exists and is not stdClass:
foreach ($services as [, , $index, $serviceId]) {
$class = $container->getDefinition($serviceId)->getClass();
$class = $container->getParameterBag()->resolveValue($class) ?: null;
if (!$class || 'stdClass' === $class) {
$reference = new Reference($serviceId);
} elseif ($index === $serviceId) {
$reference = new TypedReference($serviceId, $class);
} else {
$reference = new TypedReference($serviceId, $class, ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, \is_string($index) ? $index : null);
}
if (null === $index) {
$refs[] = $reference;
} else {
$refs[$index] = $reference;
}
}