8000 Fix comments · symfony/symfony@aaddb17 · GitHub
[go: up one dir, main page]

Skip to content

Commit aaddb17

Browse files
committed
Fix comments
1 parent a0e94fb commit aaddb17

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\DependencyInjection\Definition;
1717
use Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper;
1818
use Symfony\Component\DependencyInjection\Reference;
19+
use Symfony\Component\DependencyInjection\TypedReference;
1920

2021
/**
2122
* Overwrites a service but keeps the overridden one.
@@ -72,19 +73,17 @@ public function process(ContainerBuilder $container)
7273

7374
private function autowire(ContainerBuilder $container, Definition $definition, string $renamedId): void
7475
{
75-
if (
76-
!$definition->isAutowired() ||
76+
if (!$definition->isAutowired() ||
7777
null === ($innerClass = $container->findDefinition($renamedId)->getClass()) ||
7878
!($reflectionClass = $container->getReflectionClass($definition->getClass())) ||
79-
!$reflectionMethod = $reflectionClass->getConstructor()
79+
!$constructor = $reflectionClass->getConstructor()
8080
) {
8181
return;
8282
}
8383

8484
$innerIndex = null;
85-
foreach ($reflectionMethod->getParameters() as $index => $parameter) {
86-
if (
87-
null === ($type = ProxyHelper::getTypeHint($reflectionMethod, $parameter, true)) ||
85+
foreach ($constructor->getParameters() as $index => $parameter) {
86+
if (null === ($type = ProxyHelper::getTypeHint($constructor, $parameter, true)) ||
8887
!is_a($innerClass, $type, true)
8988
) {
9089
continue;
@@ -99,7 +98,7 @@ private function autowire(ContainerBuilder $container, Definition $definition, s
9998
}
10099

101100
if (null !== $innerIndex) {
102-
$definition->setArgument($innerIndex, new Reference($renamedId));
101+
$definition->setArgument($innerIndex, new TypedReference($renamedId, $innerClass));
103102
}
104103
}
105104
}

0 commit comments

Comments
 (0)
0