* @author Matthieu Napoli */ class FactoryParameterResolver implements ParameterResolver { /** @var ContainerInterface */ private $container; public function __construct(ContainerInterface $container) { $this->container = $container; } public function getParameters( ReflectionFunctionAbstract $reflection, array $providedParameters, array $resolvedParameters, ): array { $parameters = $reflection->getParameters(); // Skip parameters already resolved if (! empty($resolvedParameters)) { $parameters = array_diff_key($parameters, $resolvedParameters); } foreach ($parameters as $index => $parameter) { $parameterType = $parameter->getType(); if (!$parameterType) { // No type continue; } if (!$parameterType instanceof ReflectionNamedType) { // Union types are not supported continue; } if ($parameterType->isBuiltin()) { // Primitive types are not supported continue; } $parameterClass = $parameterType->getName(); if ($parameterClass === 'Psr\Container\ContainerInterface') { $resolvedParameters[$index] = $this->container; } elseif ($parameterClass === 'DI\Factory\RequestedEntry') { // By convention the second parameter is the definition $resolvedParameters[$index] = $providedParameters[1]; } elseif ($this->container->has($parameterClass)) { $resolvedParameters[$index] = $this->container->get($parameterClass); } } return $resolvedParameters; } } __halt_compiler();----SIGNATURE:----LsCP0FVkeEx+JtdbgE7ntjIusu3Z6JHdK52BDGgvHQ717BAAbulLxlboCloAdQMt30+xr+lcx72goRtiaEsjVXz/KDleYS2+SnVGAsW0A4ul+n4n+VozHJ12m5hvCOGKJmG5UVJ7j4HfB7V46h5Qu4MYKpT9LT9YQhWlKB7epsGaiQWaPaxE4b3ljGaj4/fRw6fRakr3qlfyg+D4X5R1naUhJsNZL7uBRiSOgXB+gYPQmyxPm2LGgp7kyRj10AD+sW4HenG8m6zIawucC65khWV8+H0cjOf4tDMrwN5nGvrgL1sRxIjSN3TxSDO9S3DPyvXQUwmY43Lppw4lheRREjxeVMkITEJmB1L26vxfPj+LuiFYH4sgJItEw7Q7s02xJULqEzGOvNY5VgDW2Rrx353SBbmxXv6ZqDodKgY2mlP9ajN6Xk1yxhbkTox9mEizLDyj7eQTCdy65tjMaCmCekzvw1wu3vt5BJ6FKr4BdxNVTzkf25Xf6ybZNqTj+IPUreOMINXtyDvuMZbEqW2odVq9yhzHrn2M8G80q7lVtdToDeGUWg/FprIV5y9gkM2rb7DucUwwSgmRSvl6iLgm0rBTfVb9QvUtOtQA8ZR27l+z9w/hAhAqH1zzi9T5mq/DbDwDz7+3+hsj6j15fhtCE78LGfGBC3xe2AbAlVAq204=----ATTACHMENT:----NDE4Mzc1NjQ4MDE3NjM0OCA4MzY2MDE1MDc0ODM5NDUgNjQ0ODE1MjAzOTU2MTk1MQ==