Problem
ContainerDynamicReturnTypeExtension handles get() and has() but not getParameter(). Calling $container->getParameter('app.root') currently returns mixed (or whatever the native PHPStan type is) instead of the known parameter type.
For example, app.root is defined as a string parameter in core.services.yml:
But $container->getParameter('app.root') cannot be inferred as string.
Proposed solution
Build a parameter map from the parameters: sections of service YAMLs in DrupalAutoloader (currently only the services: section is processed), then add a getParameter branch to ContainerDynamicReturnTypeExtension that resolves known parameter names to their types.
Related
Problem
ContainerDynamicReturnTypeExtensionhandlesget()andhas()but notgetParameter(). Calling$container->getParameter('app.root')currently returnsmixed(or whatever the native PHPStan type is) instead of the known parameter type.For example,
app.rootis defined as a string parameter incore.services.yml:But
$container->getParameter('app.root')cannot be inferred asstring.Proposed solution
Build a parameter map from the
parameters:sections of service YAMLs inDrupalAutoloader(currently only theservices:section is processed), then add agetParameterbranch toContainerDynamicReturnTypeExtensionthat resolves known parameter names to their types.Related
DrupalServiceDefinition::getType()had aSplStringworkaround that was unreachable becauseapp.rootis a parameter, not a service.