Skip to content

Commit bf68286

Browse files
committed
bug #21797 [DI] Simplify AutowirePass and other master-only cleanups (nicolas-grekas)
This PR was merged into the 3.3-dev branch. Discussion ---------- [DI] Simplify AutowirePass and other master-only cleanups | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - A few minor cleanups and fixes, and an overall simplification of AutowirePass. Commits ------- 34e5cc7698 [DI] Simplify AutowirePass and other master-only cleanups
2 parents 6d7e76d + c348c61 commit bf68286

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Console/Descriptor/JsonDescriptor.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,14 +399,14 @@ private function describeValue($value, $omitTags, $showArguments)
399399
);
400400
}
401401

402-
if ($value instanceof Definition) {
403-
return $this->getContainerDefinitionData($value, $omitTags, $showArguments);
404-
}
405-
406402
if ($value instanceof ArgumentInterface) {
407403
return $this->describeValue($value->getValues(), $omitTags, $showArguments);
408404
}
409405

406+
if ($value instanceof Definition) {
407+
return $this->getContainerDefinitionData($value, $omitTags, $showArguments);
408+
}
409+
410410
return $value;
411411
}
412412
}

Console/Descriptor/TextDescriptor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,15 +330,15 @@ protected function describeContainerDefinition(Definition $definition, array $op
330330
foreach ($arguments as $argument) {
331331
if ($argument instanceof Reference) {
332332
$argumentsInformation[] = sprintf('Service(%s)', (string) $argument);
333-
} elseif ($argument instanceof Definition) {
334-
$argumentsInformation[] = 'Inlined Service';
335333
} elseif ($argument instanceof IteratorArgument) {
336334
$argumentsInformation[] = sprintf('Iterator (%d element(s))', count($argument->getValues()));
337335
} elseif ($argument instanceof ServiceLocatorArgument) {
338336
$argumentsInformation[] = sprintf('ServiceLocator (%d service(s))', count($argument->getValues()));
339337
} elseif ($argument instanceof ClosureProxyArgument) {
340338
list($reference, $method) = $argument->getValues();
341339
$argumentsInformation[] = sprintf('ClosureProxy(Service(%s)::%s())', $reference, $method);
340+
} elseif ($argument instanceof Definition) {
341+
$argumentsInformation[] = 'Inlined Service';
342342
} else {
343343
$argumentsInformation[] = is_array($argument) ? sprintf('Array (%d element(s))', count($argument)) : $argument;
344344
}

Console/Descriptor/XmlDescriptor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,6 @@ private function getArgumentNodes(array $arguments, \DOMDocument $dom)
440440
if ($argument instanceof Reference) {
441441
$argumentXML->setAttribute('type', 'service');
442442
$argumentXML->setAttribute('id', (string) $argument);
443-
} elseif ($argument instanceof Definition) {
444-
$argumentXML->appendChild($dom->importNode($this->getContainerDefinitionDocument($argument, null, false, true)->childNodes->item(0), true));
445443
} elseif ($argument instanceof IteratorArgument) {
446444
$argumentXML->setAttribute('type', 'iterator');
447445

@@ -459,6 +457,8 @@ private function getArgumentNodes(array $arguments, \DOMDocument $dom)
459457
$argumentXML->setAttribute('type', 'closure-proxy');
460458
$argumentXML->setAttribute('id', (string) $reference);
461459
$argumentXML->setAttribute('method', $method);
460+
} elseif ($argument instanceof Definition) {
461+
$argumentXML->appendChild($dom->importNode($this->getContainerDefinitionDocument($argument, null, false, true)->childNodes->item(0), true));
462462
} elseif (is_array($argument)) {
463463
$argumentXML->setAttribute('type', 'collection');
464464

0 commit comments

Comments
 (0)