8000 [DI] Align AutowirePass with 2.8 by nicolas-grekas · Pull Request #21605 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -217,26 +217,24 @@ private function set($type, $id)

// is this already a type/class that is known to match multiple services?
if (isset($this->ambiguousServiceTypes[$type])) {
$this->addServiceToAmbiguousType($id, $type);
$this->ambiguousServiceTypes[$type][] = $id;

return;
}

// check to make sure the type doesn't match multiple services
if (isset($this->types[$type])) {
if ($this->types[$type] === $id) {
return;
}

// keep an array of all services matching this type
$this->addServiceToAmbiguousType($id, $type);

unset($this->types[$type]);
if (!isset($this->types[$type]) || $this->types[$type] === $id) {
$this->types[$type] = $id;

return;
}

$this->types[$type] = $id;
// keep an array of all services matching this type
if (!isset($this->ambiguousServiceTypes[$type])) {
$this->ambiguousServiceTypes[$type] = array($this->types[$type]);
unset($this->types[$type]);
}
$this->ambiguousServiceTypes[$type][] = $id;
}

/**
Expand Down Expand Up @@ -311,17 +309,6 @@ private function getReflectionClass($id, Definition $definition)
return $this->reflectionClasses[$id] = $reflector;
}

private function addServiceToAmbiguousType($id, $type)
{
// keep an array of all services matching this type
if (!isset($this->ambiguousServiceTypes[$type])) {
$this->ambiguousServiceTypes[$type] = array(
$this->types[$type],
);
}
$this->ambiguousServiceTypes[$type][] = $id;
}

/**
* @param \ReflectionClass $reflectionClass
*
Expand Down
0