/usr/share/php/Symfony/Component/DependencyInjection/Compiler
NameSizeModeActions
AbstractRecursivePass.php93310644editdlrm
AliasDeprecatedPublicServicesPass.php25590644editdlrm
AnalyzeServiceReferencesPass.php63260644editdlrm
AttributeAutoconfigurationPass.php76220644editdlrm
AutoAliasServicePass.php19080644editdlrm
AutowirePass.php252190644editdlrm
AutowireRequiredMethodsPass.php38670644editdlrm
AutowireRequiredPropertiesPass.php22860644editdlrm
CheckArgumentsValidityPass.php43860644editdlrm
CheckCircularReferencesPass.php24480644editdlrm
CheckDefinitionValidityPass.php47410644editdlrm
CheckExceptionOnInvalidReferenceBehaviorPass.php36630644editdlrm
CheckReferenceValidityPass.php14770644editdlrm
CheckTypeDeclarationsPass.php123690644editdlrm
Compiler.php27240644editdlrm
CompilerPassInterface.php6680644editdlrm
DecoratorServicePass.php52570644editdlrm
DefinitionErrorExceptionPass.php18700644editdlrm
ExtensionCompilerPass.php8920644editdlrm
InlineServiceDefinitionsPass.php75850644editdlrm
MergeExtensionConfigurationPass.php85630644editdlrm
PassConfig.php75470644editdlrm
PriorityTaggedServiceTrait.php68110644editdlrm
RegisterAutoconfigureAttributesPass.php33530644editdlrm
RegisterEnvVarProcessorsPass.php30040644editdlrm
RegisterReverseContainerPass.php24220644editdlrm
RegisterServiceSubscribersPass.php66510644editdlrm
RemoveAbstractDefinitionsPass.php9080644editdlrm
RemovePrivateAliasesPass.php11140644editdlrm
RemoveUnusedDefinitionsPass.php28600644editdlrm
ReplaceAliasByActualDefinitionPass.php44910644editdlrm
ResolveBindingsPass.php92330644editdlrm
ResolveChildDefinitionsPass.php75380644editdlrm
ResolveClassPass.php15610644editdlrm
ResolveDecoratorStackPass.php46100644editdlrm
ResolveEnvPlaceholdersPass.php13570644editdlrm
ResolveFactoryClassPass.php12170644editdlrm
ResolveHotPathPass.php25530644editdlrm
ResolveInstanceofConditionalsPass.php71710644editdlrm
ResolveInvalidReferencesPass.php53320644editdlrm
ResolveNamedArgumentsPass.php55810644editdlrm
ResolveNoPreloadPass.php33640644editdlrm
ResolveParameterPlaceHoldersPass.php29690644editdlrm
ResolvePrivatesPass.php11780644editdlrm
ResolveReferencesToAliasesPass.php27580644editdlrm
ResolveServiceSubscribersPass.php16370644editdlrm
ResolveTaggedIteratorArgumentPass.php9520644editdlrm
ServiceLocatorTagPass.php52730644editdlrm
ServiceReferenceGraph.php26440644editdlrm
ServiceReferenceGraphEdge.php21840644editdlrm
ServiceReferenceGraphNode.php22990644editdlrm
ValidateEnvPlaceholdersPass.php38840644editdlrm
Edit: /usr/share/php/Symfony/Component/DependencyInjection/Compiler/ResolveNamedArgumentsPass.php (5581B)
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\Argument\AbstractArgument; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper; use Symfony\Component\DependencyInjection\Reference; /** * Resolves named arguments to their corresponding numeric index. * * @author Kévin Dunglas */ class ResolveNamedArgumentsPass extends AbstractRecursivePass { /** * {@inheritdoc} */ protected function processValue($value, bool $isRoot = false) { if ($value instanceof AbstractArgument && $value->getText().'.' === $value->getTextWithContext()) { $value->setContext(sprintf('A value found in service "%s"', $this->currentId)); } if (!$value instanceof Definition) { return parent::processValue($value, $isRoot); } $calls = $value->getMethodCalls(); $calls[] = ['__construct', $value->getArguments()]; foreach ($calls as $i => $call) { [$method, $arguments] = $call; $parameters = null; $resolvedArguments = []; foreach ($arguments as $key => $argument) { if ($argument instanceof AbstractArgument && $argument->getText().'.' === $argument->getTextWithContext()) { $argument->setContext(sprintf('Argument '.(\is_int($key) ? 1 + $key : '"%3$s"').' of '.('__construct' === $method ? 'service "%s"' : 'method call "%s::%s()"'), $this->currentId, $method, $key)); } if (\is_int($key)) { $resolvedArguments[$key] = $argument; continue; } if (null === $parameters) { $r = $this->getReflectionMethod($value, $method); $class = $r instanceof \ReflectionMethod ? $r->class : $this->currentId; $method = $r->getName(); $parameters = $r->getParameters(); } if (isset($key[0]) && '$' !== $key[0] && !class_exists($key) && !interface_exists($key, false)) { throw new InvalidArgumentException(sprintf('Invalid service "%s": did you forget to add the "$" prefix to argument "%s"?', $this->currentId, $key)); } if (isset($key[0]) && '$' === $key[0]) { foreach ($parameters as $j => $p) { if ($key === '$'.$p->name) { if ($p->isVariadic() && \is_array($argument)) { foreach ($argument as $variadicArgument) { $resolvedArguments[$j++] = $variadicArgument; } } else { $resolvedArguments[$j] = $argument; } continue 2; } } throw new InvalidArgumentException(sprintf('Invalid service "%s": method "%s()" has no argument named "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method, $key)); } if (null !== $argument && !$argument instanceof Reference && !$argument instanceof Definition) { throw new InvalidArgumentException(sprintf('Invalid service "%s": the value of argument "%s" of method "%s()" must be null, an instance of "%s" or an instance of "%s", "%s" given.', $this->currentId, $key, $class !== $this->currentId ? $class.'::'.$method : $method, Reference::class, Definition::class, get_debug_type($argument))); } $typeFound = false; foreach ($parameters as $j => $p) { if (!\array_key_exists($j, $resolvedArguments) && ProxyHelper::getTypeHint($r, $p, true) === $key) { $resolvedArguments[$j] = $argument; $typeFound = true; } } if (!$typeFound) { throw new InvalidArgumentException(sprintf('Invalid service "%s": method "%s()" has no argument type-hinted as "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method, $key)); } } if ($resolvedArguments !== $call[1]) { ksort($resolvedArguments); $calls[$i][1] = $resolvedArguments; } } [, $arguments] = array_pop($calls); if ($arguments !== $value->getArguments()) { $value->setArguments($arguments); } if ($calls !== $value->getMethodCalls()) { $value->setMethodCalls($calls); } foreach ($value->getProperties() as $key => $argument) { if ($argument instanceof AbstractArgument && $argument->getText().'.' === $argument->getTextWithContext()) { $argument->setContext(sprintf('Property "%s" of service "%s"', $key, $this->currentId)); } } return parent::processValue($value, $isRoot); } }