Merge branch '2.8' into 3.0

* 2.8:
  [2.3][Component/Security] Fixed phpdoc in AnonymousToken constructor for user param
  prevent calling get() for service_container service
  call get() after the container was compiled
  Fixed readme of OptionsResolver
  top-level anonymous services must be public
  [DependencyInjection] Suggest ExpressionLanguage in composer.json
  added a conflict between Monolog bridge 2.8 and HTTP Kernel 3.0+
This commit is contained in:
Fabien Potencier 2016-05-09 13:14:44 -05:00
commit 273688c5d6
10 changed files with 20 additions and 8 deletions

View File

@ -24,6 +24,9 @@
"symfony/console": "~2.8|~3.0", "symfony/console": "~2.8|~3.0",
"symfony/event-dispatcher": "~2.8|~3.0" "symfony/event-dispatcher": "~2.8|~3.0"
}, },
"conflict": {
"symfony/http-kernel": ">=3.0"
},
"suggest": { "suggest": {
"symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel.", "symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel.",
"symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings. You need version ~2.3 of the console for it.", "symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings. You need version ~2.3 of the console for it.",

View File

@ -33,6 +33,8 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
$builder->register('foo1', 'ProxyManagerBridgeFooClass')->setFile(__DIR__.'/Fixtures/includes/foo.php'); $builder->register('foo1', 'ProxyManagerBridgeFooClass')->setFile(__DIR__.'/Fixtures/includes/foo.php');
$builder->getDefinition('foo1')->setLazy(true); $builder->getDefinition('foo1')->setLazy(true);
$builder->compile();
/* @var $foo1 \ProxyManager\Proxy\LazyLoadingInterface|\ProxyManager\Proxy\ValueHolderInterface */ /* @var $foo1 \ProxyManager\Proxy\LazyLoadingInterface|\ProxyManager\Proxy\ValueHolderInterface */
$foo1 = $builder->get('foo1'); $foo1 = $builder->get('foo1');

View File

@ -256,6 +256,10 @@ abstract class Descriptor implements DescriptorInterface
return $builder->getAlias($serviceId); return $builder->getAlias($serviceId);
} }
if ('service_container' === $serviceId) {
return $builder;
}
// the service has been injected in some special way, just return the service // the service has been injected in some special way, just return the service
return $builder->get($serviceId); return $builder->get($serviceId);
} }

View File

@ -100,6 +100,8 @@ class WebProfilerExtensionTest extends TestCase
$this->assertSame($listenerEnabled, $this->container->get('web_profiler.debug_toolbar')->isEnabled()); $this->assertSame($listenerEnabled, $this->container->get('web_profiler.debug_toolbar')->isEnabled());
} }
$this->assertSame($enabled, $this->container->get('web_profiler.debug_toolbar')->isEnabled());
$this->assertSaneContainer($this->getDumpedContainer()); $this->assertSaneContainer($this->getDumpedContainer());
} }

View File

@ -292,6 +292,10 @@ class XmlFileLoader extends FileLoader
if ($services = $this->getChildren($node, 'service')) { if ($services = $this->getChildren($node, 'service')) {
$definitions[$id] = array($services[0], $file, false); $definitions[$id] = array($services[0], $file, false);
$services[0]->setAttribute('id', $id); $services[0]->setAttribute('id', $id);
// anonymous services are always private
// we could not use the constant false here, because of XML parsing
$services[0]->setAttribute('public', 'false');
} }
} }
} }
@ -309,10 +313,6 @@ class XmlFileLoader extends FileLoader
// resolve definitions // resolve definitions
krsort($definitions); krsort($definitions);
foreach ($definitions as $id => list($domElement, $file, $wild)) { foreach ($definitions as $id => list($domElement, $file, $wild)) {
// anonymous services are always private
// we could not use the constant false here, because of XML parsing
$domElement->setAttribute('public', 'false');
if (null !== $definition = $this->parseDefinition($domElement, $file)) { if (null !== $definition = $this->parseDefinition($domElement, $file)) {
$this->container->setDefinition($id, $definition); $this->container->setDefinition($id, $definition);
} }

View File

@ -200,7 +200,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
$service = $container->getDefinition($id); $service = $container->getDefinition($id);
} }
$this->assertEquals('BizClass', $service->getClass(), '->load() uses the same configuration as for the anonymous ones'); $this->assertEquals('BizClass', $service->getClass(), '->load() uses the same configuration as for the anonymous ones');
$this->assertFalse($service->isPublic()); $this->assertTrue($service->isPublic());
// anonymous services are shared when using decoration definitions // anonymous services are shared when using decoration definitions
$container->compile(); $container->compile();

View File

@ -26,6 +26,7 @@
"suggest": { "suggest": {
"symfony/yaml": "", "symfony/yaml": "",
"symfony/config": "", "symfony/config": "",
"symfony/expression-language": "For using expressions in service container configuration",
"symfony/proxy-manager-bridge": "Generate service proxies to lazy load them" "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them"
}, },
"autoload": { "autoload": {

View File

@ -1,7 +1,7 @@
OptionsResolver Component OptionsResolver Component
========================= =========================
The OptionsResolver component is `array_replace on steroids. It allows you to The OptionsResolver component is `array_replace` on steroids. It allows you to
create an options system with required options, defaults, validation (type, create an options system with required options, defaults, validation (type,
value), normalization and more. value), normalization and more.

View File

@ -26,7 +26,7 @@ class AnonymousToken extends AbstractToken
* Constructor. * Constructor.
* *
* @param string $secret A secret used to make sure the token is created by the app and not by a malicious client * @param string $secret A secret used to make sure the token is created by the app and not by a malicious client
* @param string $user The user * @param string|object $user The user can be a UserInterface instance, or an object implementing a __toString method or the username as a regular string.
* @param RoleInterface[] $roles An array of roles * @param RoleInterface[] $roles An array of roles
*/ */
public function __construct($secret, $user, array $roles = array()) public function __construct($secret, $user, array $roles = array())

View File

@ -26,7 +26,7 @@ class PreAuthenticatedToken extends AbstractToken
/** /**
* Constructor. * Constructor.
* *
* @param string|object $user The user * @param string|object $user The user can be a UserInterface instance, or an object implementing a __toString method or the username as a regular string.
* @param mixed $credentials The user credentials * @param mixed $credentials The user credentials
* @param string $providerKey The provider key * @param string $providerKey The provider key
* @param RoleInterface[]|string[] $roles An array of roles * @param RoleInterface[]|string[] $roles An array of roles