vendor/symfony/dependency-injection/Compiler/AutowirePass.php line 498

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\DependencyInjection\Compiler;
  11. use Symfony\Component\Config\Resource\ClassExistenceResource;
  12. use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
  13. use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
  14. use Symfony\Component\DependencyInjection\Attribute\TaggedIterator;
  15. use Symfony\Component\DependencyInjection\Attribute\TaggedLocator;
  16. use Symfony\Component\DependencyInjection\Attribute\Target;
  17. use Symfony\Component\DependencyInjection\ContainerBuilder;
  18. use Symfony\Component\DependencyInjection\Definition;
  19. use Symfony\Component\DependencyInjection\Exception\AutowiringFailedException;
  20. use Symfony\Component\DependencyInjection\Exception\RuntimeException;
  21. use Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper;
  22. use Symfony\Component\DependencyInjection\TypedReference;
  23. /**
  24.  * Inspects existing service definitions and wires the autowired ones using the type hints of their classes.
  25.  *
  26.  * @author Kévin Dunglas <dunglas@gmail.com>
  27.  * @author Nicolas Grekas <p@tchwork.com>
  28.  */
  29. class AutowirePass extends AbstractRecursivePass
  30. {
  31.     private $types;
  32.     private $ambiguousServiceTypes;
  33.     private $autowiringAliases;
  34.     private $lastFailure;
  35.     private $throwOnAutowiringException;
  36.     private $decoratedClass;
  37.     private $decoratedId;
  38.     private $methodCalls;
  39.     private $defaultArgument;
  40.     private $getPreviousValue;
  41.     private $decoratedMethodIndex;
  42.     private $decoratedMethodArgumentIndex;
  43.     private $typesClone;
  44.     private $combinedAliases;
  45.     public function __construct(bool $throwOnAutowireException true)
  46.     {
  47.         $this->throwOnAutowiringException $throwOnAutowireException;
  48.         $this->defaultArgument = new class() {
  49.             public $value;
  50.             public $names;
  51.         };
  52.     }
  53.     /**
  54.      * {@inheritdoc}
  55.      */
  56.     public function process(ContainerBuilder $container)
  57.     {
  58.         $this->populateCombinedAliases($container);
  59.         try {
  60.             $this->typesClone = clone $this;
  61.             parent::process($container);
  62.         } finally {
  63.             $this->decoratedClass null;
  64.             $this->decoratedId null;
  65.             $this->methodCalls null;
  66.             $this->defaultArgument->names null;
  67.             $this->getPreviousValue null;
  68.             $this->decoratedMethodIndex null;
  69.             $this->decoratedMethodArgumentIndex null;
  70.             $this->typesClone null;
  71.             $this->combinedAliases = [];
  72.         }
  73.     }
  74.     /**
  75.      * {@inheritdoc}
  76.      */
  77.     protected function processValue($valuebool $isRoot false)
  78.     {
  79.         try {
  80.             return $this->doProcessValue($value$isRoot);
  81.         } catch (AutowiringFailedException $e) {
  82.             if ($this->throwOnAutowiringException) {
  83.                 throw $e;
  84.             }
  85.             $this->container->getDefinition($this->currentId)->addError($e->getMessageCallback() ?? $e->getMessage());
  86.             return parent::processValue($value$isRoot);
  87.         }
  88.     }
  89.     /**
  90.      * @return mixed
  91.      */
  92.     private function doProcessValue($valuebool $isRoot false)
  93.     {
  94.         if ($value instanceof TypedReference) {
  95.             if ($ref $this->getAutowiredReference($valuetrue)) {
  96.                 return $ref;
  97.             }
  98.             if (ContainerBuilder::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior()) {
  99.                 $message $this->createTypeNotFoundMessageCallback($value'it');
  100.                 // since the error message varies by referenced id and $this->currentId, so should the id of the dummy errored definition
  101.                 $this->container->register($id sprintf('.errored.%s.%s'$this->currentId, (string) $value), $value->getType())
  102.                     ->addError($message);
  103.                 return new TypedReference($id$value->getType(), $value->getInvalidBehavior(), $value->getName());
  104.             }
  105.         }
  106.         $value parent::processValue($value$isRoot);
  107.         if (!$value instanceof Definition || !$value->isAutowired() || $value->isAbstract() || !$value->getClass()) {
  108.             return $value;
  109.         }
  110.         if (!$reflectionClass $this->container->getReflectionClass($value->getClass(), false)) {
  111.             $this->container->log($thissprintf('Skipping service "%s": Class or interface "%s" cannot be loaded.'$this->currentId$value->getClass()));
  112.             return $value;
  113.         }
  114.         $this->methodCalls $value->getMethodCalls();
  115.         try {
  116.             $constructor $this->getConstructor($valuefalse);
  117.         } catch (RuntimeException $e) {
  118.             throw new AutowiringFailedException($this->currentId$e->getMessage(), 0$e);
  119.         }
  120.         if ($constructor) {
  121.             array_unshift($this->methodCalls, [$constructor$value->getArguments()]);
  122.         }
  123.         $checkAttributes 80000 <= \PHP_VERSION_ID && !$value->hasTag('container.ignore_attributes');
  124.         $this->methodCalls $this->autowireCalls($reflectionClass$isRoot$checkAttributes);
  125.         if ($constructor) {
  126.             [, $arguments] = array_shift($this->methodCalls);
  127.             if ($arguments !== $value->getArguments()) {
  128.                 $value->setArguments($arguments);
  129.             }
  130.         }
  131.         if ($this->methodCalls !== $value->getMethodCalls()) {
  132.             $value->setMethodCalls($this->methodCalls);
  133.         }
  134.         return $value;
  135.     }
  136.     private function autowireCalls(\ReflectionClass $reflectionClassbool $isRootbool $checkAttributes): array
  137.     {
  138.         $this->decoratedId null;
  139.         $this->decoratedClass null;
  140.         $this->getPreviousValue null;
  141.         if ($isRoot && ($definition $this->container->getDefinition($this->currentId)) && null !== ($this->decoratedId $definition->innerServiceId) && $this->container->has($this->decoratedId)) {
  142.             $this->decoratedClass $this->container->findDefinition($this->decoratedId)->getClass();
  143.         }
  144.         $patchedIndexes = [];
  145.         foreach ($this->methodCalls as $i => $call) {
  146.             [$method$arguments] = $call;
  147.             if ($method instanceof \ReflectionFunctionAbstract) {
  148.                 $reflectionMethod $method;
  149.             } else {
  150.                 $definition = new Definition($reflectionClass->name);
  151.                 try {
  152.                     $reflectionMethod $this->getReflectionMethod($definition$method);
  153.                 } catch (RuntimeException $e) {
  154.                     if ($definition->getFactory()) {
  155.                         continue;
  156.                     }
  157.                     throw $e;
  158.                 }
  159.             }
  160.             $arguments $this->autowireMethod($reflectionMethod$arguments$checkAttributes$i);
  161.             if ($arguments !== $call[1]) {
  162.                 $this->methodCalls[$i][1] = $arguments;
  163.                 $patchedIndexes[] = $i;
  164.             }
  165.         }
  166.         // use named arguments to skip complex default values
  167.         foreach ($patchedIndexes as $i) {
  168.             $namedArguments null;
  169.             $arguments $this->methodCalls[$i][1];
  170.             foreach ($arguments as $j => $value) {
  171.                 if ($namedArguments && !$value instanceof $this->defaultArgument) {
  172.                     unset($arguments[$j]);
  173.                     $arguments[$namedArguments[$j]] = $value;
  174.                 }
  175.                 if ($namedArguments || !$value instanceof $this->defaultArgument) {
  176.                     continue;
  177.                 }
  178.                 if (\PHP_VERSION_ID >= 80100 && (\is_array($value->value) ? $value->value : \is_object($value->value))) {
  179.                     unset($arguments[$j]);
  180.                     $namedArguments $value->names;
  181.                 } else {
  182.                     $arguments[$j] = $value->value;
  183.                 }
  184.             }
  185.             $this->methodCalls[$i][1] = $arguments;
  186.         }
  187.         return $this->methodCalls;
  188.     }
  189.     /**
  190.      * Autowires the constructor or a method.
  191.      *
  192.      * @throws AutowiringFailedException
  193.      */
  194.     private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, array $argumentsbool $checkAttributesint $methodIndex): array
  195.     {
  196.         $class $reflectionMethod instanceof \ReflectionMethod $reflectionMethod->class $this->currentId;
  197.         $method $reflectionMethod->name;
  198.         $parameters $reflectionMethod->getParameters();
  199.         if ($reflectionMethod->isVariadic()) {
  200.             array_pop($parameters);
  201.         }
  202.         $this->defaultArgument->names = new \ArrayObject();
  203.         foreach ($parameters as $index => $parameter) {
  204.             $this->defaultArgument->names[$index] = $parameter->name;
  205.             if (\array_key_exists($index$arguments) && '' !== $arguments[$index]) {
  206.                 continue;
  207.             }
  208.             $type ProxyHelper::getTypeHint($reflectionMethod$parametertrue);
  209.             if ($checkAttributes) {
  210.                 foreach ($parameter->getAttributes() as $attribute) {
  211.                     if (TaggedIterator::class === $attribute->getName()) {
  212.                         $attribute $attribute->newInstance();
  213.                         $arguments[$index] = new TaggedIteratorArgument($attribute->tag$attribute->indexAttribute$attribute->defaultIndexMethodfalse$attribute->defaultPriorityMethod);
  214.                         break;
  215.                     }
  216.                     if (TaggedLocator::class === $attribute->getName()) {
  217.                         $attribute $attribute->newInstance();
  218.                         $arguments[$index] = new ServiceLocatorArgument(new TaggedIteratorArgument($attribute->tag$attribute->indexAttribute$attribute->defaultIndexMethodtrue$attribute->defaultPriorityMethod));
  219.                         break;
  220.                     }
  221.                 }
  222.                 if ('' !== ($arguments[$index] ?? '')) {
  223.                     continue;
  224.                 }
  225.             }
  226.             if (!$type) {
  227.                 if (isset($arguments[$index])) {
  228.                     continue;
  229.                 }
  230.                 // no default value? Then fail
  231.                 if (!$parameter->isDefaultValueAvailable()) {
  232.                     // For core classes, isDefaultValueAvailable() can
  233.                     // be false when isOptional() returns true. If the
  234.                     // argument *is* optional, allow it to be missing
  235.                     if ($parameter->isOptional()) {
  236.                         --$index;
  237.                         break;
  238.                     }
  239.                     $type ProxyHelper::getTypeHint($reflectionMethod$parameterfalse);
  240.                     $type $type sprintf('is type-hinted "%s"'ltrim($type'\\')) : 'has no type-hint';
  241.                     throw new AutowiringFailedException($this->currentIdsprintf('Cannot autowire service "%s": argument "$%s" of method "%s()" %s, you should configure its value explicitly.'$this->currentId$parameter->name$class !== $this->currentId $class.'::'.$method $method$type));
  242.                 }
  243.                 // specifically pass the default value
  244.                 $arguments[$index] = clone $this->defaultArgument;
  245.                 $arguments[$index]->value $parameter->getDefaultValue();
  246.                 continue;
  247.             }
  248.             $getValue = function () use ($type$parameter$class$method) {
  249.                 if (!$value $this->getAutowiredReference($ref = new TypedReference($type$typeContainerBuilder::EXCEPTION_ON_INVALID_REFERENCETarget::parseName($parameter)), true)) {
  250.                     $failureMessage $this->createTypeNotFoundMessageCallback($refsprintf('argument "$%s" of method "%s()"'$parameter->name$class !== $this->currentId $class.'::'.$method $method));
  251.                     if ($parameter->isDefaultValueAvailable()) {
  252.                         $value = clone $this->defaultArgument;
  253.                         $value->value $parameter->getDefaultValue();
  254.                     } elseif (!$parameter->allowsNull()) {
  255.                         throw new AutowiringFailedException($this->currentId$failureMessage);
  256.                     }
  257.                 }
  258.                 return $value;
  259.             };
  260.             if ($this->decoratedClass && $isDecorated is_a($this->decoratedClass$typetrue)) {
  261.                 if ($this->getPreviousValue) {
  262.                     // The inner service is injected only if there is only 1 argument matching the type of the decorated class
  263.                     // across all arguments of all autowired methods.
  264.                     // If a second matching argument is found, the default behavior is restored.
  265.                     $getPreviousValue $this->getPreviousValue;
  266.                     $this->methodCalls[$this->decoratedMethodIndex][1][$this->decoratedMethodArgumentIndex] = $getPreviousValue();
  267.                     $this->decoratedClass null// Prevent further checks
  268.                 } else {
  269.                     $arguments[$index] = new TypedReference($this->decoratedId$this->decoratedClass);
  270.                     $this->getPreviousValue $getValue;
  271.                     $this->decoratedMethodIndex $methodIndex;
  272.                     $this->decoratedMethodArgumentIndex $index;
  273.                     continue;
  274.                 }
  275.             }
  276.             $arguments[$index] = $getValue();
  277.         }
  278.         if ($parameters && !isset($arguments[++$index])) {
  279.             while (<= --$index) {
  280.                 if (!$arguments[$index] instanceof $this->defaultArgument) {
  281.                     break;
  282.                 }
  283.                 unset($arguments[$index]);
  284.             }
  285.         }
  286.         // it's possible index 1 was set, then index 0, then 2, etc
  287.         // make sure that we re-order so they're injected as expected
  288.         ksort($arguments);
  289.         return $arguments;
  290.     }
  291.     /**
  292.      * Returns a reference to the service matching the given type, if any.
  293.      */
  294.     private function getAutowiredReference(TypedReference $referencebool $filterType): ?TypedReference
  295.     {
  296.         $this->lastFailure null;
  297.         $type $reference->getType();
  298.         if ($type !== (string) $reference) {
  299.             return $reference;
  300.         }
  301.         if ($filterType && false !== $m strpbrk($type'&|')) {
  302.             $types array_diff(explode($m[0], $type), ['int''string''array''bool''float''iterable''object''callable''null']);
  303.             sort($types);
  304.             $type implode($m[0], $types);
  305.         }
  306.         if (null !== $name $reference->getName()) {
  307.             if ($this->container->has($alias $type.' $'.$name) && !$this->container->findDefinition($alias)->isAbstract()) {
  308.                 return new TypedReference($alias$type$reference->getInvalidBehavior());
  309.             }
  310.             if (null !== ($alias $this->combinedAliases[$alias] ?? null) && !$this->container->findDefinition($alias)->isAbstract()) {
  311.                 return new TypedReference($alias$type$reference->getInvalidBehavior());
  312.             }
  313.             if ($this->container->has($name) && !$this->container->findDefinition($name)->isAbstract()) {
  314.                 foreach ($this->container->getAliases() + $this->combinedAliases as $id => $alias) {
  315.                     if ($name === (string) $alias && str_starts_with($id$type.' $')) {
  316.                         return new TypedReference($name$type$reference->getInvalidBehavior());
  317.                     }
  318.                 }
  319.             }
  320.         }
  321.         if ($this->container->has($type) && !$this->container->findDefinition($type)->isAbstract()) {
  322.             return new TypedReference($type$type$reference->getInvalidBehavior());
  323.         }
  324.         if (null !== ($alias $this->combinedAliases[$type] ?? null) && !$this->container->findDefinition($alias)->isAbstract()) {
  325.             return new TypedReference($alias$type$reference->getInvalidBehavior());
  326.         }
  327.         return null;
  328.     }
  329.     /**
  330.      * Populates the list of available types.
  331.      */
  332.     private function populateAvailableTypes(ContainerBuilder $container)
  333.     {
  334.         $this->types = [];
  335.         $this->ambiguousServiceTypes = [];
  336.         $this->autowiringAliases = [];
  337.         foreach ($container->getDefinitions() as $id => $definition) {
  338.             $this->populateAvailableType($container$id$definition);
  339.         }
  340.         foreach ($container->getAliases() as $id => $alias) {
  341.             $this->populateAutowiringAlias($id);
  342.         }
  343.     }
  344.     /**
  345.      * Populates the list of available types for a given definition.
  346.      */
  347.     private function populateAvailableType(ContainerBuilder $containerstring $idDefinition $definition)
  348.     {
  349.         // Never use abstract services
  350.         if ($definition->isAbstract()) {
  351.             return;
  352.         }
  353.         if ('' === $id || '.' === $id[0] || $definition->isDeprecated() || !$reflectionClass $container->getReflectionClass($definition->getClass(), false)) {
  354.             return;
  355.         }
  356.         foreach ($reflectionClass->getInterfaces() as $reflectionInterface) {
  357.             $this->set($reflectionInterface->name$id);
  358.         }
  359.         do {
  360.             $this->set($reflectionClass->name$id);
  361.         } while ($reflectionClass $reflectionClass->getParentClass());
  362.         $this->populateAutowiringAlias($id);
  363.     }
  364.     /**
  365.      * Associates a type and a service id if applicable.
  366.      */
  367.     private function set(string $typestring $id)
  368.     {
  369.         // is this already a type/class that is known to match multiple services?
  370.         if (isset($this->ambiguousServiceTypes[$type])) {
  371.             $this->ambiguousServiceTypes[$type][] = $id;
  372.             return;
  373.         }
  374.         // check to make sure the type doesn't match multiple services
  375.         if (!isset($this->types[$type]) || $this->types[$type] === $id) {
  376.             $this->types[$type] = $id;
  377.             return;
  378.         }
  379.         // keep an array of all services matching this type
  380.         if (!isset($this->ambiguousServiceTypes[$type])) {
  381.             $this->ambiguousServiceTypes[$type] = [$this->types[$type]];
  382.             unset($this->types[$type]);
  383.         }
  384.         $this->ambiguousServiceTypes[$type][] = $id;
  385.     }
  386.     private function createTypeNotFoundMessageCallback(TypedReference $referencestring $label): \Closure
  387.     {
  388.         if (null === $this->typesClone->container) {
  389.             $this->typesClone->container = new ContainerBuilder($this->container->getParameterBag());
  390.             $this->typesClone->container->setAliases($this->container->getAliases());
  391.             $this->typesClone->container->setDefinitions($this->container->getDefinitions());
  392.             $this->typesClone->container->setResourceTracking(false);
  393.         }
  394.         $currentId $this->currentId;
  395.         return (function () use ($reference$label$currentId) {
  396.             return $this->createTypeNotFoundMessage($reference$label$currentId);
  397.         })->bindTo($this->typesClone);
  398.     }
  399.     private function createTypeNotFoundMessage(TypedReference $referencestring $labelstring $currentId): string
  400.     {
  401.         if (!$r $this->container->getReflectionClass($type $reference->getType(), false)) {
  402.             // either $type does not exist or a parent class does not exist
  403.             try {
  404.                 $resource = new ClassExistenceResource($typefalse);
  405.                 // isFresh() will explode ONLY if a parent class/trait does not exist
  406.                 $resource->isFresh(0);
  407.                 $parentMsg false;
  408.             } catch (\ReflectionException $e) {
  409.                 $parentMsg $e->getMessage();
  410.             }
  411.             $message sprintf('has type "%s" but this class %s.'$type$parentMsg sprintf('is missing a parent class (%s)'$parentMsg) : 'was not found');
  412.         } else {
  413.             $alternatives $this->createTypeAlternatives($this->container$reference);
  414.             $message $this->container->has($type) ? 'this service is abstract' 'no such service exists';
  415.             $message sprintf('references %s "%s" but %s.%s'$r->isInterface() ? 'interface' 'class'$type$message$alternatives);
  416.             if ($r->isInterface() && !$alternatives) {
  417.                 $message .= ' Did you create a class that implements this interface?';
  418.             }
  419.         }
  420.         $message sprintf('Cannot autowire service "%s": %s %s'$currentId$label$message);
  421.         if (null !== $this->lastFailure) {
  422.             $message $this->lastFailure."\n".$message;
  423.             $this->lastFailure null;
  424.         }
  425.         return $message;
  426.     }
  427.     private function createTypeAlternatives(ContainerBuilder $containerTypedReference $reference): string
  428.     {
  429.         // try suggesting available aliases first
  430.         if ($message $this->getAliasesSuggestionForType($container$type $reference->getType())) {
  431.             return ' '.$message;
  432.         }
  433.         if (null === $this->ambiguousServiceTypes) {
  434.             $this->populateAvailableTypes($container);
  435.         }
  436.         $servicesAndAliases $container->getServiceIds();
  437.         if (null !== ($autowiringAliases $this->autowiringAliases[$type] ?? null) && !isset($autowiringAliases[''])) {
  438.             return sprintf(' Available autowiring aliases for this %s are: "$%s".'class_exists($typefalse) ? 'class' 'interface'implode('", "$'$autowiringAliases));
  439.         }
  440.         if (!$container->has($type) && false !== $key array_search(strtolower($type), array_map('strtolower'$servicesAndAliases))) {
  441.             return sprintf(' Did you mean "%s"?'$servicesAndAliases[$key]);
  442.         } elseif (isset($this->ambiguousServiceTypes[$type])) {
  443.             $message sprintf('one of these existing services: "%s"'implode('", "'$this->ambiguousServiceTypes[$type]));
  444.         } elseif (isset($this->types[$type])) {
  445.             $message sprintf('the existing "%s" service'$this->types[$type]);
  446.         } else {
  447.             return '';
  448.         }
  449.         return sprintf(' You should maybe alias this %s to %s.'class_exists($typefalse) ? 'class' 'interface'$message);
  450.     }
  451.     private function getAliasesSuggestionForType(ContainerBuilder $containerstring $type): ?string
  452.     {
  453.         $aliases = [];
  454.         foreach (class_parents($type) + class_implements($type) as $parent) {
  455.             if ($container->has($parent) && !$container->findDefinition($parent)->isAbstract()) {
  456.                 $aliases[] = $parent;
  457.             }
  458.         }
  459.         if ($len = \count($aliases)) {
  460.             $message 'Try changing the type-hint to one of its parents: ';
  461.             for ($i 0, --$len$i $len; ++$i) {
  462.                 $message .= sprintf('%s "%s", 'class_exists($aliases[$i], false) ? 'class' 'interface'$aliases[$i]);
  463.             }
  464.             $message .= sprintf('or %s "%s".'class_exists($aliases[$i], false) ? 'class' 'interface'$aliases[$i]);
  465.             return $message;
  466.         }
  467.         if ($aliases) {
  468.             return sprintf('Try changing the type-hint to "%s" instead.'$aliases[0]);
  469.         }
  470.         return null;
  471.     }
  472.     private function populateAutowiringAlias(string $id): void
  473.     {
  474.         if (!preg_match('/(?(DEFINE)(?<V>[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+))^((?&V)(?:\\\\(?&V))*+)(?: \$((?&V)))?$/'$id$m)) {
  475.             return;
  476.         }
  477.         $type $m[2];
  478.         $name $m[3] ?? '';
  479.         if (class_exists($typefalse) || interface_exists($typefalse)) {
  480.             $this->autowiringAliases[$type][$name] = $name;
  481.         }
  482.     }
  483.     private function populateCombinedAliases(ContainerBuilder $container): void
  484.     {
  485.         $this->combinedAliases = [];
  486.         $reverseAliases = [];
  487.         foreach ($container->getAliases() as $id => $alias) {
  488.             if (!preg_match('/(?(DEFINE)(?<V>[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+))^((?&V)(?:\\\\(?&V))*+)(?: \$((?&V)))?$/'$id$m)) {
  489.                 continue;
  490.             }
  491.             $type $m[2];
  492.             $name $m[3] ?? '';
  493.             $reverseAliases[(string) $alias][$name][] = $type;
  494.         }
  495.         foreach ($reverseAliases as $alias => $names) {
  496.             foreach ($names as $name => $types) {
  497.                 if ($count = \count($types)) {
  498.                     continue;
  499.                 }
  500.                 sort($types);
  501.                 $i << $count;
  502.                 // compute the powerset of the list of types
  503.                 while ($i--) {
  504.                     $set = [];
  505.                     for ($j 0$j $count; ++$j) {
  506.                         if ($i & (<< $j)) {
  507.                             $set[] = $types[$j];
  508.                         }
  509.                     }
  510.                     if (<= \count($set)) {
  511.                         $this->combinedAliases[implode('&'$set).('' === $name '' ' $'.$name)] = $alias;
  512.                         $this->combinedAliases[implode('|'$set).('' === $name '' ' $'.$name)] = $alias;
  513.                     }
  514.                 }
  515.             }
  516.         }
  517.     }
  518. }