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\Generator\ClassGenerator;
|
||||||
use ProxyManager\GeneratorStrategy\BaseGeneratorStrategy;
|
use ProxyManager\GeneratorStrategy\BaseGeneratorStrategy;
|
||||||
use ProxyManager\ProxyGenerator\LazyLoadingValueHolderGenerator;
|
use ProxyManager\ProxyGenerator\LazyLoadingValueHolderGenerator;
|
||||||
use Symfony\Component\DependencyInjection\Container;
|
|
||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface;
|
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface;
|
||||||
|
|
||||||
@ -63,7 +62,7 @@ class ProxyDumper implements DumperInterface
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function getProxyFactoryCode(Definition $definition, $id)
|
public function getProxyFactoryCode(Definition $definition, $id, $methodName = null)
|
||||||
{
|
{
|
||||||
$instantiation = 'return';
|
$instantiation = 'return';
|
||||||
|
|
||||||
@ -71,12 +70,10 @@ class ProxyDumper implements DumperInterface
|
|||||||
$instantiation .= " \$this->services['$id'] =";
|
$instantiation .= " \$this->services['$id'] =";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (func_num_args() >= 3) {
|
if (null === $methodName) {
|
||||||
$methodName = func_get_arg(2);
|
throw new \InvalidArgumentException(sprintf('Missing name of method to call to construct the service "%s".', $id));
|
||||||
} 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';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$proxyClass = $this->getProxyClassName($definition);
|
$proxyClass = $this->getProxyClassName($definition);
|
||||||
|
|
||||||
$generatedClass = $this->generateProxyClass($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 = new Definition(__CLASS__);
|
||||||
|
|
||||||
$definition->setLazy(true);
|
$definition->setLazy(true);
|
||||||
|
$this->dumper->getProxyFactoryCode($definition, 'foo');
|
||||||
$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
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,6 +4,8 @@ CHANGELOG
|
|||||||
4.0.0
|
4.0.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
* added a third `$methodName` argument to the `getProxyFactoryCode()` method
|
||||||
|
of the `DumperInterface`
|
||||||
* removed support for autowiring types
|
* removed support for autowiring types
|
||||||
* removed `Container::isFrozen`
|
* removed `Container::isFrozen`
|
||||||
* removed support for dumping an ucompiled container in `PhpDumper`
|
* removed support for dumping an ucompiled container in `PhpDumper`
|
||||||
|
@ -34,11 +34,11 @@ interface DumperInterface
|
|||||||
*
|
*
|
||||||
* @param Definition $definition
|
* @param Definition $definition
|
||||||
* @param string $id service identifier
|
* @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
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getProxyFactoryCode(Definition $definition, $id/**, $methodName = null */);
|
public function getProxyFactoryCode(Definition $definition, $id, $methodName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates the code for the lazy proxy.
|
* Generates the code for the lazy proxy.
|
||||||
|
@ -28,7 +28,7 @@ class NullDumperTest extends TestCase
|
|||||||
$definition = new Definition('stdClass');
|
$definition = new Definition('stdClass');
|
||||||
|
|
||||||
$this->assertFalse($dumper->isProxyCandidate($definition));
|
$this->assertFalse($dumper->isProxyCandidate($definition));
|
||||||
$this->assertSame('', $dumper->getProxyFactoryCode($definition, 'foo'));
|
$this->assertSame('', $dumper->getProxyFactoryCode($definition, 'foo', 'getFooService'));
|
||||||
$this->assertSame('', $dumper->getProxyCode($definition));
|
$this->assertSame('', $dumper->getProxyCode($definition));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user