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\CompilerCode
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;
}
}