getCombinedAlias example



        $name = $target = (array_filter($reference->getAttributes()static fn ($a) => $a instanceof Target)[0] ?? null)?->name;

        if (null !== $name ??= $reference->getName()) {
            $parsedName = (new Target($name))->getParsedName();

            if ($this->container->has($alias = $type.' $'.$parsedName) && !$this->container->findDefinition($alias)->isAbstract()) {
                return new TypedReference($alias$type$reference->getInvalidBehavior());
            }

            if (null !== ($alias = $this->getCombinedAlias($type$parsedName) ?? null) && !$this->container->findDefinition($alias)->isAbstract()) {
                return new TypedReference($alias$type$reference->getInvalidBehavior());
            }

            if ($this->container->has($name) && !$this->container->findDefinition($name)->isAbstract()) {
                foreach ($this->container->getAliases() as $id => $alias) {
                    if ($name === (string) $alias && str_starts_with($id$type.' $')) {
                        return new TypedReference($name$type$reference->getInvalidBehavior());
                    }
                }
            }

            
$type = implode($m[0]$types);
        }

        $name = (array_filter($reference->getAttributes()static fn ($a) => $a instanceof Target)[0] ?? null)?->name;

        if (null !== $name ??= $reference->getName()) {
            if ($this->container->has($alias = $type.' $'.$name) && !$this->container->findDefinition($alias)->isAbstract()) {
                return new TypedReference($alias$type$reference->getInvalidBehavior());
            }

            if (null !== ($alias = $this->getCombinedAlias($type$name) ?? null) && !$this->container->findDefinition($alias)->isAbstract()) {
                return new TypedReference($alias$type$reference->getInvalidBehavior());
            }

            if ($this->container->has($name) && !$this->container->findDefinition($name)->isAbstract()) {
                foreach ($this->container->getAliases() as $id => $alias) {
                    if ($name === (string) $alias && str_starts_with($id$type.' $')) {
                        return new TypedReference($name$type$reference->getInvalidBehavior());
                    }
                }
            }

            
Home | Imprint | This part of the site doesn't use cookies.