Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aeb38f6

Browse files
committed
Freeing up some memory references
1 parent 75b11d5 commit aeb38f6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,19 @@ public function __construct(AutowirePass $autowirePass, InlineServiceDefinitions
3131

3232
public function process(ContainerBuilder $container)
3333
{
34+
// the pass should only be run once
35+
if (null === $this->autowirePass || null === $this->inlineServicePass) {
36+
return;
37+
}
38+
3439
$inlinedIds = $this->inlineServicePass->getInlinedServiceIds();
35-
foreach ($this->autowirePass->getAutowiringExceptions() as $exception) {
40+
$exceptions = $this->autowirePass->getAutowiringExceptions();
41+
42+
// free up references
43+
$this->autowirePass = null;
44+
$this->inlineServicePass = null;
45+
46+
foreach ($exceptions as $exception) {
3647
if ($container->hasDefinition($exception->getServiceId()) || in_array($exception->getServiceId(), $inlinedIds)) {
3748
throw $exception;
3849
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\DependencyInjection\Compiler;
1313

1414
use Symfony\Component\DependencyInjection\Argument\ArgumentInterface;
15-
use Symfony\Component\DependencyInjection\ContainerBuilder;
1615
use Symfony\Component\DependencyInjection\Definition;
1716
use Symfony\Component\DependencyInjection\Reference;
1817

0 commit comments

Comments
 (0)