Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dd5236a

Browse filesBrowse files
[DI] Align AutowirePass with 2.8
1 parent 50be214 commit dd5236a
Copy full SHA for dd5236a

File tree

Expand file treeCollapse file tree

1 file changed

+9
-22
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-22
lines changed

‎src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php
+9-22Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -217,26 +217,24 @@ private function set($type, $id)
217217

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

222222
return;
223223
}
224224

225225
// check to make sure the type doesn't match multiple services
226-
if (isset($this->types[$type])) {
227-
if ($this->types[$type] === $id) {
228-
return;
229-
}
230-
231-
// keep an array of all services matching this type
232-
$this->addServiceToAmbiguousType($id, $type);
233-
234-
unset($this->types[$type]);
226+
if (!isset($this->types[$type]) || $this->types[$type] === $id) {
227+
$this->types[$type] = $id;
235228

236229
return;
237230
}
238231

239-
$this->types[$type] = $id;
232+
// keep an array of all services matching this type
233+
if (!isset($this->ambiguousServiceTypes[$type])) {
234+
$this->ambiguousServiceTypes[$type] = array($this->types[$type]);
235+
unset($this->types[$type]);
236+
}
237+
$this->ambiguousServiceTypes[$type][] = $id;
240238
}
241239

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

314-
private function addServiceToAmbiguousType($id, $type)
315-
{
316-
// keep an array of all services matching this type
317-
if (!isset($this->ambiguousServiceTypes[$type])) {
318-
$this->ambiguousServiceTypes[$type] = array(
319-
$this->types[$type],
320-
);
321-
}
322-
$this->ambiguousServiceTypes[$type][] = $id;
323-
}
324-
325312
/**
326313
* @param \ReflectionClass $reflectionClass
327314
*

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.