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

Skip to content

Commit 3ca0c86

Browse files
[ProxyManagerBridge] Fix support of private services (bis)
1 parent b9a3c87 commit 3ca0c86

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use ProxyManager\GeneratorStrategy\BaseGeneratorStrategy;
1616
use ProxyManager\Version;
1717
use Symfony\Component\DependencyInjection\Container;
18+
use Symfony\Component\DependencyInjection\ContainerBuilder;
1819
use Symfony\Component\DependencyInjection\Definition;
1920
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface;
2021

@@ -57,7 +58,7 @@ public function getProxyFactoryCode(Definition $definition, $id, $factoryCode =
5758
$instantiation = 'return';
5859

5960
if ($definition->isShared()) {
60-
$instantiation .= sprintf(' $this->%s[\'%s\'] =', $definition->isPublic() && !$definition->isPrivate() ? 'services' : 'privates', $id);
61+
$instantiation .= sprintf(' $this->%s[\'%s\'] =', \method_exists(ContainerBuilder::class, 'addClassResource') || ($definition->isPublic() && !$definition->isPrivate()) ? 'services' : 'privates', $id);
6162
}
6263

6364
if (null === $factoryCode) {

src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
16+
use Symfony\Component\DependencyInjection\ContainerBuilder;
1617
use Symfony\Component\DependencyInjection\Definition;
1718

1819
/**
@@ -101,7 +102,7 @@ public function getPrivatePublicDefinitions()
101102
array(
102103
(new Definition(__CLASS__))
103104
->setPublic(false),
104-
'privates',
105+
\method_exists(ContainerBuilder::class, 'addClassResource') ? 'services' : 'privates',
105106
),
106107
array(
107108
(new Definition(__CLASS__))

0 commit comments

Comments
 (0)