[ProxyManagerBridge] Fix support of private services (bis)
This commit is contained in:
parent
b9a3c870d9
commit
3ca0c86afe
@ -15,6 +15,7 @@ use ProxyManager\Generator\ClassGenerator;
|
|||||||
use ProxyManager\GeneratorStrategy\BaseGeneratorStrategy;
|
use ProxyManager\GeneratorStrategy\BaseGeneratorStrategy;
|
||||||
use ProxyManager\Version;
|
use ProxyManager\Version;
|
||||||
use Symfony\Component\DependencyInjection\Container;
|
use Symfony\Component\DependencyInjection\Container;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface;
|
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface;
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ class ProxyDumper implements DumperInterface
|
|||||||
$instantiation = 'return';
|
$instantiation = 'return';
|
||||||
|
|
||||||
if ($definition->isShared()) {
|
if ($definition->isShared()) {
|
||||||
$instantiation .= sprintf(' $this->%s[\'%s\'] =', $definition->isPublic() && !$definition->isPrivate() ? 'services' : 'privates', $id);
|
$instantiation .= sprintf(' $this->%s[\'%s\'] =', \method_exists(ContainerBuilder::class, 'addClassResource') || ($definition->isPublic() && !$definition->isPrivate()) ? 'services' : 'privates', $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $factoryCode) {
|
if (null === $factoryCode) {
|
||||||
|
@ -13,6 +13,7 @@ namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy\PhpDumper;
|
|||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
|
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,7 +102,7 @@ class ProxyDumperTest extends TestCase
|
|||||||
array(
|
array(
|
||||||
(new Definition(__CLASS__))
|
(new Definition(__CLASS__))
|
||||||
->setPublic(false),
|
->setPublic(false),
|
||||||
'privates',
|
\method_exists(ContainerBuilder::class, 'addClassResource') ? 'services' : 'privates',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
(new Definition(__CLASS__))
|
(new Definition(__CLASS__))
|
||||||
|
Reference in New Issue
Block a user