8000 bug #27776 [ProxyManagerBridge] Fix support of private services (bis)… · symfony/symfony@0990bbd · GitHub
[go: up one dir, main page]

Skip to content

Commit 0990bbd

Browse files
bug #27776 [ProxyManagerBridge] Fix support of private services (bis) (nicolas-grekas)
This PR was merged into the 3.4 branch. Discussion ---------- [ProxyManagerBridge] Fix support of private services (bis) | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #27756 | License | MIT | Doc PR | - Commits ------- 3ca0c86 [ProxyManagerBridge] Fix support of private services (bis)
2 parents 81465f4 + 3ca0c86 commit 0990bbd

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)
0