Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AutowirePass.php

function AutowirePass::populateAutowiringAlias

2 calls to AutowirePass::populateAutowiringAlias()
AutowirePass::populateAvailableType in vendor/symfony/dependency-injection/Compiler/AutowirePass.php
Populates the list of available types for a given definition.
AutowirePass::populateAvailableTypes in vendor/symfony/dependency-injection/Compiler/AutowirePass.php
Populates the list of available types.

File

vendor/symfony/dependency-injection/Compiler/AutowirePass.php, line 703

Class

AutowirePass
Inspects existing service definitions and wires the autowired ones using the type hints of their classes.

Namespace

Symfony\Component\DependencyInjection\Compiler

Code

private function populateAutowiringAlias(string $id, ?string $target = null) : void {
    if (!preg_match('/(?(DEFINE)(?<V>[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+))^((?&V)(?:\\\\(?&V))*+)(?: \\$((?&V)))?$/', $id, $m)) {
        return;
    }
    $type = $m[2];
    $name = $m[3] ?? '';
    if (class_exists($type, false) || interface_exists($type, false)) {
        if (null !== $target && str_starts_with($target, '.' . $type . ' $') && (new Target($target = substr($target, \strlen($type) + 3)))->getParsedName() === $name) {
            $name = $target;
        }
        $this->autowiringAliases[$type][$name] = $name;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal