feature #22785 [ProxyManagerBridge] remove deprecated features (xabbuh)
This PR was merged into the 4.0-dev branch.
Discussion
----------
[ProxyManagerBridge] remove deprecated features
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
3a129494b1
[ProxyManagerBridge] remove deprecated features
This commit is contained in:
commit
044c00eb5f
@ -14,7 +14,6 @@ namespace Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper;
|
||||
use ProxyManager\Generator\ClassGenerator;
|
||||
use ProxyManager\GeneratorStrategy\BaseGeneratorStrategy;
|
||||
use ProxyManager\ProxyGenerator\LazyLoadingValueHolderGenerator;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface;
|
||||
|
||||
@ -63,7 +62,7 @@ class ProxyDumper implements DumperInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProxyFactoryCode(Definition $definition, $id)
|
||||
public function getProxyFactoryCode(Definition $definition, $id, $methodName = null)
|
||||
{
|
||||
$instantiation = 'return';
|
||||
|
||||
@ -71,12 +70,10 @@ class ProxyDumper implements DumperInterface
|
||||
$instantiation .= " \$this->services['$id'] =";
|
||||
}
|
||||
|
||||
if (func_num_args() >= 3) {
|
||||
$methodName = func_get_arg(2);
|
||||
} else {
|
||||
@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);
|
||||
$methodName = 'get'.Container::camelize($id).'Service';
|
||||
if (null === $methodName) {
|
||||
throw new \InvalidArgumentException(sprintf('Missing name of method to call to construct the service "%s".', $id));
|
||||
}
|
||||
|
||||
$proxyClass = $this->getProxyClassName($definition);
|
||||
|
||||
$generatedClass = $this->generateProxyClass($definition);
|
||||
|
@ -80,24 +80,14 @@ class ProxyDumperTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage Missing name of method to call to construct the service "foo".
|
||||
*/
|
||||
public function testGetProxyFactoryCode()
|
||||
public function testGetProxyFactoryCodeWithoutCustomMethod()
|
||||
{
|
||||
$definition = new Definition(__CLASS__);
|
||||
|
||||
$definition->setLazy(true);
|
||||
|
||||
$code = $this->dumper->getProxyFactoryCode($definition, 'foo');
|
||||
|
||||
$this->assertStringMatchesFormat(
|
||||
'%wif ($lazyLoad) {%wreturn $this->services[\'foo\'] =%s'
|
||||
.'SymfonyBridgeProxyManagerTestsLazyProxyPhpDumperProxyDumperTest_%s(%wfunction '
|
||||
.'(&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) {'
|
||||
.'%w$wrappedInstance = $this->getFooService(false);%w$proxy->setProxyInitializer(null);'
|
||||
.'%wreturn true;%w}%w);%w}%w',
|
||||
$code
|
||||
);
|
||||
$this->dumper->getProxyFactoryCode($definition, 'foo');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,6 +4,8 @@ CHANGELOG
|
||||
4.0.0
|
||||
-----
|
||||
|
||||
* added a third `$methodName` argument to the `getProxyFactoryCode()` method
|
||||
of the `DumperInterface`
|
||||
* removed support for autowiring types
|
||||
* removed `Container::isFrozen`
|
||||
* removed support for dumping an ucompiled container in `PhpDumper`
|
||||
|
@ -34,11 +34,11 @@ interface DumperInterface
|
||||
*
|
||||
* @param Definition $definition
|
||||
* @param string $id service identifier
|
||||
* @param string $methodName the method name to get the service, will be added to the interface in 4.0
|
||||
* @param string $methodName the method name to get the service
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProxyFactoryCode(Definition $definition, $id/**, $methodName = null */);
|
||||
public function getProxyFactoryCode(Definition $definition, $id, $methodName);
|
||||
|
||||
/**
|
||||
* Generates the code for the lazy proxy.
|
||||
|
@ -28,7 +28,7 @@ class NullDumperTest extends TestCase
|
||||
$definition = new Definition('stdClass');
|
||||
|
||||
$this->assertFalse($dumper->isProxyCandidate($definition));
|
||||
$this->assertSame('', $dumper->getProxyFactoryCode($definition, 'foo'));
|
||||
$this->assertSame('', $dumper->getProxyFactoryCode($definition, 'foo', 'getFooService'));
|
||||
$this->assertSame('', $dumper->getProxyCode($definition));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user