Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e2335e8

Browse filesBrowse files
committed
[ProxyManagerBridge] remove deprecated features
1 parent 4d9d8cb commit e2335e8
Copy full SHA for e2335e8

File tree

7 files changed

+19
-26
lines changed
Filter options

7 files changed

+19
-26
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use ProxyManager\Generator\ClassGenerator;
1515
use ProxyManager\GeneratorStrategy\BaseGeneratorStrategy;
1616
use ProxyManager\ProxyGenerator\LazyLoadingValueHolderGenerator;
17-
use Symfony\Component\DependencyInjection\Container;
1817
use Symfony\Component\DependencyInjection\Definition;
1918
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface;
2019

@@ -63,20 +62,18 @@ public function isProxyCandidate(Definition $definition)
6362
/**
6463
* {@inheritdoc}
6564
*/
66-
public function getProxyFactoryCode(Definition $definition, $id)
65+
public function getProxyFactoryCode(Definition $definition, $id, $methodName = null)
6766
{
6867
$instantiation = 'return';
6968

7069
if ($definition->isShared()) {
7170
$instantiation .= " \$this->services['$id'] =";
7271
}
7372

74-
if (func_num_args() >= 3) {
75-
$methodName = func_get_arg(2);
76-
} else {
77-
@trigger_error(sprintf('You must use the third argument of %s to define the method to call to construct your service since version 3.1, not using it won\'t be supported in 4.0.', __METHOD__), E_USER_DEPRECATED);
78-
$methodName = 'get'.Container::camelize($id).'Service';
73+
if (null === $methodName) {
74+
throw new \InvalidArgumentException(sprintf('Missing name of method to call to construct the service "%s".', $id));
7975
}
76+
8077
$proxyClass = $this->getProxyClassName($definition);
8178

8279
$generatedClass = $this->generateProxyClass($definition);

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php
+4-14Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,24 +80,14 @@ public function testGetProxyFactoryCodeWithCustomMethod()
8080
}
8181

8282
/**
83-
* @group legacy
83+
* @expectedException \InvalidArgumentException
84+
* @expectedExceptionMessage Missing name of method to call to construct the service "foo".
8485
*/
85-
public function testGetProxyFactoryCode()
86+
public function testGetProxyFactoryCodeWithoutCustomMethod()
8687
{
8788
$definition = new Definition(__CLASS__);
88-
8989
$definition->setLazy(true);
90-
91-
$code = $this->dumper->getProxyFactoryCode($definition, 'foo');
92-
93-
$this->assertStringMatchesFormat(
94-
'%wif ($lazyLoad) {%wreturn $this->services[\'foo\'] =%s'
95-
.'SymfonyBridgeProxyManagerTestsLazyProxyPhpDumperProxyDumperTest_%s(%wfunction '
96-
.'(&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) {'
97-
.'%w$wrappedInstance = $this->getFooService(false);%w$proxy->setProxyInitializer(null);'
98-
.'%wreturn true;%w}%w);%w}%w',
99-
$code
100-
);
90+
$this->dumper->getProxyFactoryCode($definition, 'foo');
10191
}
10292

10393
/**

‎src/Symfony/Component/DependencyInjection/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
4.0.0
5+
-----
6+
7+
* added a third `$methodName` argument to the `getProxyFactoryCode()` method
8+
of the `DumperInterface`
9+
410
3.3.0
511
-----
612

‎src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/DumperInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/DumperInterface.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ public function isProxyCandidate(Definition $definition);
3434
*
3535
* @param Definition $definition
3636
* @param string $id service identifier
37-
* @param string $methodName the method name to get the service, will be added to the interface in 4.0
37+
* @param string $methodName the method name to get the service
3838
*
3939
* @return string
4040
*/
41-
public function getProxyFactoryCode(Definition $definition, $id/**, $methodName = null */);
41+
public function getProxyFactoryCode(Definition $definition, $id, $methodName);
4242

4343
/**
4444
* Generates the code for the lazy proxy.

‎src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/NullDumper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/NullDumper.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function isProxyCandidate(Definition $definition)
3131
/**
3232
* {@inheritdoc}
3333
*/
34-
public function getProxyFactoryCode(Definition $definition, $id)
34+
public function getProxyFactoryCode(Definition $definition, $id, $methodName)
3535
{
3636
return '';
3737
}

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function isProxyCandidate(Definition $definition)
8888
return false;
8989
}
9090

91-
public function getProxyFactoryCode(Definition $definition, $id)
91+
public function getProxyFactoryCode(Definition $definition, $id, $methodName)
9292
{
9393
return '';
9494
}

‎src/Symfony/Component/DependencyInjection/Tests/LazyProxy/PhpDumper/NullDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/LazyProxy/PhpDumper/NullDumperTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function testNullDumper()
2828
$definition = new Definition('stdClass');
2929

3030
$this->assertFalse($dumper->isProxyCandidate($definition));
31-
$this->assertSame('', $dumper->getProxyFactoryCode($definition, 'foo'));
31+
$this->assertSame('', $dumper->getProxyFactoryCode($definition, 'foo', 'getFooService'));
3232
$this->assertSame('', $dumper->getProxyCode($definition));
3333
}
3434
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.