From dd5236ad97da7cf12b2a6392c0bc55a97c4f4d9b Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 14 Feb 2017 10:20:20 +0100 Subject: [PATCH] [DI] Align AutowirePass with 2.8 --- .../Compiler/AutowirePass.php | 31 ++++++------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index fcb986383c3de..985f3a50e1392 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -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; } /** @@ -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 * pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy