8000 bug #17919 #17676 - making the proxy instantiation compatible with Pr… · symfony/symfony@1618f10 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1618f10

Browse files
committed
bug #17919 #17676 - making the proxy instantiation compatible with ProxyManager 2.x by detecting proxy features (Ocramius)
This PR was submitted for the master branch but it was merged into the 3.0 branch instead (closes #17919). Discussion ---------- #17676 - making the proxy instantiation compatible with ProxyManager 2.x by detecting proxy features | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #17676 | License | MIT | Doc PR | Note: tests don't pass because the test asset being used does not respect the return type hints (PHP7) required for ProxyManager v2. Not sure if I should just hack around it, and use the PHP7 hints. Commits ------- a8f1a10 #17676 - making the proxy instantiation compatible with ProxyManager 2.x by detecting proxy features
2 parents b9cd91d + a8f1a10 commit 1618f10

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ private function getProxyClassName(Definition $definition)
119119
}
120120

121121
/**
122-
* @param Definition $definition
123-
*
124122
* @return ClassGenerator
125123
*/
126124
private function generateProxyClass(Definition $definition)

src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Dumper/PhpDumperTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy\Dumper;
1313

14+
use ProxyManager\ProxyGenerator\LazyLoading\MethodGenerator\StaticProxyConstructor;
1415
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
1516
use Symfony\Component\DependencyInjection\ContainerBuilder;
1617
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
@@ -49,8 +50,7 @@ public function testDumpContainerWithProxyService()
4950
*/
5051
public function testDumpContainerWithProxyServiceWillShareProxies()
5152
{
52-
// detecting ProxyManager v2
53-
if (class_exists('ProxyManager\ProxyGenerator\LazyLoading\MethodGenerator\StaticProxyConstructor')) {
53+
if (class_exists(StaticProxyConstructor::class)) { // detecting ProxyManager v2
5454
require_once __DIR__.'/../Fixtures/php/lazy_service_with_hints.php';
5555
} else {
5656
require_once __DIR__.'/../Fixtures/php/lazy_service.php';

src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_with_hints.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ public function __construct()
3838
public function getFooService($lazyLoad = true)
3939
{
4040
if ($lazyLoad) {
41-
$container = $this;
42-
4341
return $this->services['foo'] = new stdClass_c1d194250ee2e2b7d2eab8b8212368a8(
44-
function (&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) use ($container) {
42+
function (&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) {
4543
$wrappedInstance = $this->getFooService(false);
4644

4745
$proxy->setProxyInitializer(null);

0 commit comments

Comments
 (0)
0