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 aaddb17

Browse filesBrowse files
committed
Fix comments
1 parent a0e94fb commit aaddb17
Copy full SHA for aaddb17

File tree

1 file changed

+6
-7
lines changed
Filter options

1 file changed

+6
-7
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php
+6-7Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.