Merge branch '2.8' into 3.2
* 2.8: [DI] Remove unused props from the PhpDumper [ProxyManager] Cleanup fixtures [Debug] HTML-escape array key Add some phpdocs for IDE autocompletion and better SCA Fixed typo in docblock
This commit is contained in:
commit
90b55193d1
@ -26,6 +26,39 @@ use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
|
|||||||
class PhpDumperTest extends TestCase
|
class PhpDumperTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testDumpContainerWithProxyService()
|
public function testDumpContainerWithProxyService()
|
||||||
|
{
|
||||||
|
$this->assertStringMatchesFormatFile(
|
||||||
|
__DIR__.'/../Fixtures/php/lazy_service_structure.txt',
|
||||||
|
$this->dumpLazyServiceProjectServiceContainer(),
|
||||||
|
'->dump() does generate proxy lazy loading logic.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that the generated container retrieves the same proxy instance on multiple subsequent requests.
|
||||||
|
*/
|
||||||
|
public function testDumpContainerWithProxyServiceWillShareProxies()
|
||||||
|
{
|
||||||
|
if (!class_exists('LazyServiceProjectServiceContainer', false)) {
|
||||||
|
eval('?>'.$this->dumpLazyServiceProjectServiceContainer());
|
||||||
|
}
|
||||||
|
|
||||||
|
$container = new \LazyServiceProjectServiceContainer();
|
||||||
|
|
||||||
|
$proxy = $container->get('foo');
|
||||||
|
$this->assertInstanceOf('stdClass', $proxy);
|
||||||
|
$this->assertInstanceOf('ProxyManager\Proxy\LazyLoadingInterface', $proxy);
|
||||||
|
$this->assertSame($proxy, $container->get('foo'));
|
||||||
|
|
||||||
|
$this->assertFalse($proxy->isProxyInitialized());
|
||||||
|
|
||||||
|
$proxy->initializeProxy();
|
||||||
|
|
||||||
|
$this->assertTrue($proxy->isProxyInitialized());
|
||||||
|
$this->assertSame($proxy, $container->get('foo'));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function dumpLazyServiceProjectServiceContainer()
|
||||||
{
|
{
|
||||||
$container = new ContainerBuilder();
|
$container = new ContainerBuilder();
|
||||||
|
|
||||||
@ -37,38 +70,6 @@ class PhpDumperTest extends TestCase
|
|||||||
|
|
||||||
$dumper->setProxyDumper(new ProxyDumper());
|
$dumper->setProxyDumper(new ProxyDumper());
|
||||||
|
|
||||||
$dumpedString = $dumper->dump();
|
return $dumper->dump(array('class' => 'LazyServiceProjectServiceContainer'));
|
||||||
|
|
||||||
$this->assertStringMatchesFormatFile(
|
|
||||||
__DIR__.'/../Fixtures/php/lazy_service_structure.txt',
|
|
||||||
$dumpedString,
|
|
||||||
'->dump() does generate proxy lazy loading logic.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verifies that the generated container retrieves the same proxy instance on multiple subsequent requests.
|
|
||||||
*/
|
|
||||||
public function testDumpContainerWithProxyServiceWillShareProxies()
|
|
||||||
{
|
|
||||||
if (class_exists(StaticProxyConstructor::class)) { // detecting ProxyManager v2
|
|
||||||
require_once __DIR__.'/../Fixtures/php/lazy_service_with_hints.php';
|
|
||||||
} else {
|
|
||||||
require_once __DIR__.'/../Fixtures/php/lazy_service.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
$container = new \LazyServiceProjectServiceContainer();
|
|
||||||
|
|
||||||
/* @var $proxy \stdClass_c1d194250ee2e2b7d2eab8b8212368a8 */
|
|
||||||
$proxy = $container->get('foo');
|
|
||||||
$this->assertInstanceOf('stdClass_c1d194250ee2e2b7d2eab8b8212368a8', $proxy);
|
|
||||||
$this->assertSame($proxy, $container->get('foo'));
|
|
||||||
|
|
||||||
$this->assertFalse($proxy->isProxyInitialized());
|
|
||||||
|
|
||||||
$proxy->initializeProxy();
|
|
||||||
|
|
||||||
$this->assertTrue($proxy->isProxyInitialized());
|
|
||||||
$this->assertSame($proxy, $container->get('foo'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,182 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
||||||
use Symfony\Component\DependencyInjection\Container;
|
|
||||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
|
||||||
use Symfony\Component\DependencyInjection\Exception\LogicException;
|
|
||||||
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
|
||||||
use Symfony\Component\DependencyInjection\Parameter;
|
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ProjectServiceContainer.
|
|
||||||
*
|
|
||||||
* This class has been auto-generated
|
|
||||||
* by the Symfony Dependency Injection Component.
|
|
||||||
*/
|
|
||||||
class LazyServiceProjectServiceContainer extends Container
|
|
||||||
{
|
|
||||||
protected $methodMap = array(
|
|
||||||
'foo' => 'getFooService',
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->services = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the 'foo' service.
|
|
||||||
*
|
|
||||||
* This service is shared.
|
|
||||||
* This method always returns the same instance of the service.
|
|
||||||
*
|
|
||||||
* @param bool $lazyLoad whether to try lazy-loading the service with a proxy
|
|
||||||
*
|
|
||||||
* @return stdClass A stdClass instance
|
|
||||||
*/
|
|
||||||
public function getFooService($lazyLoad = true)
|
|
||||||
{
|
|
||||||
if ($lazyLoad) {
|
|
||||||
return $this->services['foo'] = new stdClass_c1d194250ee2e2b7d2eab8b8212368a8(
|
|
||||||
function (&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) {
|
|
||||||
$wrappedInstance = $this->getFooService(false);
|
|
||||||
|
|
||||||
$proxy->setProxyInitializer(null);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new \stdClass();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class stdClass_c1d194250ee2e2b7d2eab8b8212368a8 extends \stdClass implements \ProxyManager\Proxy\LazyLoadingInterface, \ProxyManager\Proxy\ValueHolderInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var \Closure|null initializer responsible for generating the wrapped object
|
|
||||||
*/
|
|
||||||
private $valueHolder5157dd96e88c0 = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var \Closure|null initializer responsible for generating the wrapped object
|
|
||||||
*/
|
|
||||||
private $initializer5157dd96e8924 = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @override constructor for lazy initialization
|
|
||||||
*
|
|
||||||
* @param \Closure|null $initializer
|
|
||||||
*/
|
|
||||||
public function __construct($initializer)
|
|
||||||
{
|
|
||||||
$this->initializer5157dd96e8924 = $initializer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $name
|
|
||||||
*/
|
|
||||||
public function __get($name)
|
|
||||||
{
|
|
||||||
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__get', array('name' => $name));
|
|
||||||
|
|
||||||
return $this->valueHolder5157dd96e88c0->$name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $name
|
|
||||||
* @param mixed $value
|
|
||||||
*/
|
|
||||||
public function __set($name, $value)
|
|
||||||
{
|
|
||||||
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__set', array('name' => $name, 'value' => $value));
|
|
||||||
|
|
||||||
$this->valueHolder5157dd96e88c0->$name = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $name
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function __isset($name)
|
|
||||||
{
|
|
||||||
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__isset', array('name' => $name));
|
|
||||||
|
|
||||||
return isset($this->valueHolder5157dd96e88c0->$name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $name
|
|
||||||
*/
|
|
||||||
public function __unset($name)
|
|
||||||
{
|
|
||||||
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__unset', array('name' => $name));
|
|
||||||
|
|
||||||
unset($this->valueHolder5157dd96e88c0->$name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __clone()
|
|
||||||
{
|
|
||||||
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__clone', array());
|
|
||||||
|
|
||||||
$this->valueHolder5157dd96e88c0 = clone $this->valueHolder5157dd96e88c0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __sleep()
|
|
||||||
{
|
|
||||||
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__sleep', array());
|
|
||||||
|
|
||||||
return array('valueHolder5157dd96e88c0');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __wakeup()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function setProxyInitializer(\Closure $initializer = null)
|
|
||||||
{
|
|
||||||
$this->initializer5157dd96e8924 = $initializer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getProxyInitializer()
|
|
||||||
{
|
|
||||||
return $this->initializer5157dd96e8924;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function initializeProxy()
|
|
||||||
{
|
|
||||||
return $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, 'initializeProxy', array());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function isProxyInitialized()
|
|
||||||
{
|
|
||||||
return null !== $this->valueHolder5157dd96e88c0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getWrappedValueHolderValue()
|
|
||||||
{
|
|
||||||
return $this->valueHolder5157dd96e88c0;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use %a
|
use %a
|
||||||
class ProjectServiceContainer extends Container
|
class LazyServiceProjectServiceContainer extends Container
|
||||||
{%a
|
{%a
|
||||||
public function getFooService($lazyLoad = true)
|
public function getFooService($lazyLoad = true)
|
||||||
{
|
{
|
||||||
|
@ -1,182 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
||||||
use Symfony\Component\DependencyInjection\Container;
|
|
||||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
|
||||||
use Symfony\Component\DependencyInjection\Exception\LogicException;
|
|
||||||
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
|
||||||
use Symfony\Component\DependencyInjection\Parameter;
|
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ProjectServiceContainer.
|
|
||||||
*
|
|
||||||
* This class has been auto-generated
|
|
||||||
* by the Symfony Dependency Injection Component.
|
|
||||||
*/
|
|
||||||
class LazyServiceProjectServiceContainer extends Container
|
|
||||||
{
|
|
||||||
protected $methodMap = array(
|
|
||||||
'foo' => 'getFooService',
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->services = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the 'foo' service.
|
|
||||||
*
|
|
||||||
* This service is shared.
|
|
||||||
* This method always returns the same instance of the service.
|
|
||||||
*
|
|
||||||
* @param bool $lazyLoad whether to try lazy-loading the service with a proxy
|
|
||||||
*
|
|
||||||
* @return stdClass A stdClass instance
|
|
||||||
*/
|
|
||||||
public function getFooService($lazyLoad = true)
|
|
||||||
{
|
|
||||||
if ($lazyLoad) {
|
|
||||||
return $this->services['foo'] = new stdClass_c1d194250ee2e2b7d2eab8b8212368a8(
|
|
||||||
function (&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) {
|
|
||||||
$wrappedInstance = $this->getFooService(false);
|
|
||||||
|
|
||||||
$proxy->setProxyInitializer(null);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new \stdClass();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class stdClass_c1d194250ee2e2b7d2eab8b8212368a8 extends \stdClass implements \ProxyManager\Proxy\LazyLoadingInterface, \ProxyManager\Proxy\ValueHolderInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var \Closure|null initializer responsible for generating the wrapped object
|
|
||||||
*/
|
|
||||||
private $valueHolder5157dd96e88c0 = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var \Closure|null initializer responsible for generating the wrapped object
|
|
||||||
*/
|
|
||||||
private $initializer5157dd96e8924 = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @override constructor for lazy initialization
|
|
||||||
*
|
|
||||||
* @param \Closure|null $initializer
|
|
||||||
*/
|
|
||||||
public function __construct($initializer)
|
|
||||||
{
|
|
||||||
$this->initializer5157dd96e8924 = $initializer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $name
|
|
||||||
*/
|
|
||||||
public function __get($name)
|
|
||||||
{
|
|
||||||
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__get', array('name' => $name));
|
|
||||||
|
|
||||||
return $this->valueHolder5157dd96e88c0->$name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $name
|
|
||||||
* @param mixed $value
|
|
||||||
*/
|
|
||||||
public function __set($name, $value)
|
|
||||||
{
|
|
||||||
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__set', array('name' => $name, 'value' => $value));
|
|
||||||
|
|
||||||
$this->valueHolder5157dd96e88c0->$name = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $name
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function __isset($name)
|
|
||||||
{
|
|
||||||
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__isset', array('name' => $name));
|
|
||||||
|
|
||||||
return isset($this->valueHolder5157dd96e88c0->$name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $name
|
|
||||||
*/
|
|
||||||
public function __unset($name)
|
|
||||||
{
|
|
||||||
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__unset', array('name' => $name));
|
|
||||||
|
|
||||||
unset($this->valueHolder5157dd96e88c0->$name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __clone()
|
|
||||||
{
|
|
||||||
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__clone', array());
|
|
||||||
|
|
||||||
$this->valueHolder5157dd96e88c0 = clone $this->valueHolder5157dd96e88c0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __sleep()
|
|
||||||
{
|
|
||||||
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__sleep', array());
|
|
||||||
|
|
||||||
return array('valueHolder5157dd96e88c0');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __wakeup()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function setProxyInitializer(\Closure $initializer = null)
|
|
||||||
{
|
|
||||||
$this->initializer5157dd96e8924 = $initializer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getProxyInitializer()
|
|
||||||
{
|
|
||||||
return $this->initializer5157dd96e8924;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function initializeProxy(): bool
|
|
||||||
{
|
|
||||||
return $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, 'initializeProxy', array());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function isProxyInitialized(): bool
|
|
||||||
{
|
|
||||||
return null !== $this->valueHolder5157dd96e88c0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getWrappedValueHolderValue()
|
|
||||||
{
|
|
||||||
return $this->valueHolder5157dd96e88c0;
|
|
||||||
}
|
|
||||||
}
|
|
@ -386,7 +386,7 @@ EOF;
|
|||||||
$formattedValue = str_replace("\n", '', $this->escapeHtml(var_export($item[1], true)));
|
$formattedValue = str_replace("\n", '', $this->escapeHtml(var_export($item[1], true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
|
$result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode(', ', $result);
|
return implode(', ', $result);
|
||||||
|
@ -267,12 +267,11 @@ class PhpDumper extends Dumper
|
|||||||
/**
|
/**
|
||||||
* Generates the require_once statement for service includes.
|
* Generates the require_once statement for service includes.
|
||||||
*
|
*
|
||||||
* @param string $id The service id
|
|
||||||
* @param Definition $definition
|
* @param Definition $definition
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function addServiceInclude($id, $definition)
|
private function addServiceInclude($definition)
|
||||||
{
|
{
|
||||||
$template = " require_once %s;\n";
|
$template = " require_once %s;\n";
|
||||||
$code = '';
|
$code = '';
|
||||||
@ -347,9 +346,9 @@ class PhpDumper extends Dumper
|
|||||||
$code .= $this->addNewInstance($sDefinition, '$'.$name, ' = ', $id);
|
$code .= $this->addNewInstance($sDefinition, '$'.$name, ' = ', $id);
|
||||||
|
|
||||||
if (!$this->hasReference($id, $sDefinition->getMethodCalls(), true) && !$this->hasReference($id, $sDefinition->getProperties(), true)) {
|
if (!$this->hasReference($id, $sDefinition->getMethodCalls(), true) && !$this->hasReference($id, $sDefinition->getProperties(), true)) {
|
||||||
$code .= $this->addServiceProperties(null, $sDefinition, $name);
|
$code .= $this->addServiceProperties($sDefinition, $name);
|
||||||
$code .= $this->addServiceMethodCalls(null, $sDefinition, $name);
|
$code .= $this->addServiceMethodCalls($sDefinition, $name);
|
||||||
$code .= $this->addServiceConfigurator(null, $sDefinition, $name);
|
$code .= $this->addServiceConfigurator($sDefinition, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
$code .= "\n";
|
$code .= "\n";
|
||||||
@ -447,13 +446,12 @@ class PhpDumper extends Dumper
|
|||||||
/**
|
/**
|
||||||
* Adds method calls to a service definition.
|
* Adds method calls to a service definition.
|
||||||
*
|
*
|
||||||
* @param string $id
|
|
||||||
* @param Definition $definition
|
* @param Definition $definition
|
||||||
* @param string $variableName
|
* @param string $variableName
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function addServiceMethodCalls($id, Definition $definition, $variableName = 'instance')
|
private function addServiceMethodCalls(Definition $definition, $variableName = 'instance')
|
||||||
{
|
{
|
||||||
$calls = '';
|
$calls = '';
|
||||||
foreach ($definition->getMethodCalls() as $call) {
|
foreach ($definition->getMethodCalls() as $call) {
|
||||||
@ -468,7 +466,7 @@ class PhpDumper extends Dumper
|
|||||||
return $calls;
|
return $calls;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addServiceProperties($id, Definition $definition, $variableName = 'instance')
|
private function addServiceProperties(Definition $definition, $variableName = 'instance')
|
||||||
{
|
{
|
||||||
$code = '';
|
$code = '';
|
||||||
foreach ($definition->getProperties() as $name => $value) {
|
foreach ($definition->getProperties() as $name => $value) {
|
||||||
@ -511,9 +509,9 @@ class PhpDumper extends Dumper
|
|||||||
}
|
}
|
||||||
|
|
||||||
$name = (string) $this->definitionVariables->offsetGet($iDefinition);
|
$name = (string) $this->definitionVariables->offsetGet($iDefinition);
|
||||||
$code .= $this->addServiceProperties(null, $iDefinition, $name);
|
$code .= $this->addServiceProperties($iDefinition, $name);
|
||||||
$code .= $this->addServiceMethodCalls(null, $iDefinition, $name);
|
$code .= $this->addServiceMethodCalls($iDefinition, $name);
|
||||||
$code .= $this->addServiceConfigurator(null, $iDefinition, $name);
|
$code .= $this->addServiceConfigurator($iDefinition, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('' !== $code) {
|
if ('' !== $code) {
|
||||||
@ -526,13 +524,12 @@ class PhpDumper extends Dumper
|
|||||||
/**
|
/**
|
||||||
* Adds configurator definition.
|
* Adds configurator definition.
|
||||||
*
|
*
|
||||||
* @param string $id
|
|
||||||
* @param Definition $definition
|
* @param Definition $definition
|
||||||
* @param string $variableName
|
* @param string $variableName
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function addServiceConfigurator($id, Definition $definition, $variableName = 'instance')
|
private function addServiceConfigurator(Definition $definition, $variableName = 'instance')
|
||||||
{
|
{
|
||||||
if (!$callable = $definition->getConfigurator()) {
|
if (!$callable = $definition->getConfigurator()) {
|
||||||
return '';
|
return '';
|
||||||
@ -641,14 +638,14 @@ EOF;
|
|||||||
}
|
}
|
||||||
|
|
||||||
$code .=
|
$code .=
|
||||||
$this->addServiceInclude($id, $definition).
|
$this->addServiceInclude($definition).
|
||||||
$this->addServiceLocalTempVariables($id, $definition).
|
$this->addServiceLocalTempVariables($id, $definition).
|
||||||
$this->addServiceInlinedDefinitions($id, $definition).
|
$this->addServiceInlinedDefinitions($id, $definition).
|
||||||
$this->addServiceInstance($id, $definition).
|
$this->addServiceInstance($id, $definition).
|
||||||
$this->addServiceInlinedDefinitionsSetup($id, $definition).
|
$this->addServiceInlinedDefinitionsSetup($id, $definition).
|
||||||
$this->addServiceProperties($id, $definition).
|
$this->addServiceProperties($definition).
|
||||||
$this->addServiceMethodCalls($id, $definition).
|
$this->addServiceMethodCalls($definition).
|
||||||
$this->addServiceConfigurator($id, $definition).
|
$this->addServiceConfigurator($definition).
|
||||||
$this->addServiceReturn($id, $definition)
|
$this->addServiceReturn($id, $definition)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ use Symfony\Component\Form\FormEvents;
|
|||||||
use Symfony\Component\Form\FormEvent;
|
use Symfony\Component\Form\FormEvent;
|
||||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
use Symfony\Component\Form\FormInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resize a collection form element based on the data sent from the client.
|
* Resize a collection form element based on the data sent from the client.
|
||||||
@ -150,6 +151,7 @@ class ResizeFormListener implements EventSubscriberInterface
|
|||||||
|
|
||||||
if ($this->deleteEmpty) {
|
if ($this->deleteEmpty) {
|
||||||
$previousData = $event->getForm()->getData();
|
$previousData = $event->getForm()->getData();
|
||||||
|
/** @var FormInterface $child */
|
||||||
foreach ($form as $name => $child) {
|
foreach ($form as $name => $child) {
|
||||||
$isNew = !isset($previousData[$name]);
|
$isNew = !isset($previousData[$name]);
|
||||||
|
|
||||||
|
@ -116,6 +116,7 @@ class ChoiceType extends AbstractType
|
|||||||
// Reconstruct the data as mapping from child names to values
|
// Reconstruct the data as mapping from child names to values
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
|
/** @var FormInterface $child */
|
||||||
foreach ($form as $child) {
|
foreach ($form as $child) {
|
||||||
$value = $child->getConfig()->getOption('value');
|
$value = $child->getConfig()->getOption('value');
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ class FormValidator extends ConstraintValidator
|
|||||||
} else {
|
} else {
|
||||||
$childrenSynchronized = true;
|
$childrenSynchronized = true;
|
||||||
|
|
||||||
|
/** @var FormInterface $child */
|
||||||
foreach ($form as $child) {
|
foreach ($form as $child) {
|
||||||
if (!$child->isSynchronized()) {
|
if (!$child->isSynchronized()) {
|
||||||
$childrenSynchronized = false;
|
$childrenSynchronized = false;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace Symfony\Component\Security\Core\Exception;
|
namespace Symfony\Component\Security\Core\Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AuthenticationServiceException is thrown when an authenticated token becomes un-authentcated between requests.
|
* AuthenticationServiceException is thrown when an authenticated token becomes un-authenticated between requests.
|
||||||
*
|
*
|
||||||
* In practice, this is due to the User changing between requests (e.g. password changes),
|
* In practice, this is due to the User changing between requests (e.g. password changes),
|
||||||
* causes the token to become un-authenticated.
|
* causes the token to become un-authenticated.
|
||||||
|
Reference in New Issue
Block a user