[DI] Align AutowirePass with 2.8
This commit is contained in:
parent
50be214200
commit
dd5236ad97
@ -217,26 +217,24 @@ class AutowirePass implements CompilerPassInterface
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -311,17 +309,6 @@ class AutowirePass implements CompilerPassInterface
|
||||
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
|
||||
*
|
||||
|
Reference in New Issue
Block a user