Skip to content

Commit

Permalink
bug #27776 [ProxyManagerBridge] Fix support of private services (bis)…
Browse files Browse the repository at this point in the history
… (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)
  • Loading branch information
nicolas-grekas committed Jun 29, 2018
2 parents 81465f4 + 3ca0c86 commit 0990bbd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use ProxyManager\GeneratorStrategy\BaseGeneratorStrategy;
use ProxyManager\Version;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface;

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

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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;

/**
Expand Down Expand Up @@ -101,7 +102,7 @@ public function getPrivatePublicDefinitions()
array(
(new Definition(__CLASS__))
->setPublic(false),
'privates',
\method_exists(ContainerBuilder::class, 'addClassResource') ? 'services' : 'privates',
),
array(
(new Definition(__CLASS__))
Expand Down

0 comments on commit 0990bbd

Please sign in to comment.