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

Skip to content

Commit 3e06dd4

Browse files
committed
Fix comments
1 parent a0e94fb commit 3e06dd4

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
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.
@@ 10000 -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
}

src/Symfony/Component/DependencyInjection/Tests/Fixtures/BarDecorator.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313

1414
use Psr\Log\LoggerInterface;
1515

16-
/**
17-
* @author Kévin Dunglas <dunglas@gmail.com>
18-
*/
1916
class BarDecorator implements BarInterface
2017
{
2118
public function __construct(LoggerInterface $logger, BarInterface $decorated)

0 commit comments

Comments
 (0)
0