Merge branch '2.7'

* 2.7:
  [TwigBundle] allowed SecurityBundle to use the latest versions of FrameworkBundle
  [TwigBundle] fall back to security instead of tokenStorage when not available
  [FrameworkBundle] bumped deps for HttpKernel
  [TwigBundle] bumped deps for HttpKernel
  [HttpFoundation] Make use of isEmpty() method
  fix missing comma in YamlDumper
  [Console] Helper\Table->addRow optimization
  [Console] Helper\Table->addRow optimization

Conflicts:
	src/Symfony/Bundle/FrameworkBundle/composer.json
	src/Symfony/Bundle/TwigBundle/composer.json
This commit is contained in:
Fabien Potencier 2015-01-13 08:23:15 +01:00
commit 5cc6cfa71c
7 changed files with 14 additions and 9 deletions

View File

@ -86,11 +86,15 @@ class AppVariable
*/
public function getUser()
{
if (null === $this->tokenStorage) {
if (null !== $this->tokenStorage) {
$tokenStorage = $this->tokenStorage;
} elseif (null !== $this->security) {
$tokenStorage = $this->security;
} else {
throw new \RuntimeException('The "app.user" variable is not available.');
}
if (!$token = $this->tokenStorage->getToken()) {
if (!$token = $tokenStorage->getToken()) {
return;
}

View File

@ -174,8 +174,9 @@ class Table
$this->rows[] = array_values($row);
$keys = array_keys($this->rows);
$rowKey = array_pop($keys);
end($this->rows);
$rowKey = key($this->rows);
reset($this->rows);
foreach ($row as $key => $cellValue) {
if (!strstr($cellValue, "\n")) {

View File

@ -86,7 +86,7 @@ class YamlDumper extends Dumper
foreach ($attributes as $key => $value) {
$att[] = sprintf('%s: %s', $this->dumper->dump($key), $this->dumper->dump($value));
}
$att = $att ? ', '.implode(' ', $att) : '';
$att = $att ? ', '.implode(', ', $att) : '';
$tagsCode .= sprintf(" - { name: %s%s }\n", $this->dumper->dump($name), $att);
}

View File

@ -12,7 +12,7 @@ $container = new ContainerBuilder();
$container->
register('foo', 'Bar\FooClass')->
addTag('foo', array('foo' => 'foo'))->
addTag('foo', array('bar' => 'bar'))->
addTag('foo', array('bar' => 'bar', 'baz' => 'baz'))->
setFactoryClass('Bar\\FooClass')->
setFactoryMethod('getInstance')->
setArguments(array('foo', new Reference('foo.baz'), array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%'), true, new Reference('service_container')))->

View File

@ -8,7 +8,7 @@
<services>
<service id="foo" class="Bar\FooClass" factory-method="getInstance" factory-class="Bar\FooClass">
<tag name="foo" foo="foo"/>
<tag name="foo" bar="bar"/>
<tag name="foo" bar="bar" baz="baz"/>
<argument>foo</argument>
<argument type="service" id="foo.baz"/>
<argument type="collection">

View File

@ -8,7 +8,7 @@ services:
class: Bar\FooClass
tags:
- { name: foo, foo: foo }
- { name: foo, bar: bar }
- { name: foo, bar: bar, baz: baz }
factory_class: Bar\FooClass
factory_method: getInstance
arguments: [foo, '@foo.baz', { '%foo%': 'foo is %foo%', foobar: '%foo%' }, true, '@service_container']

View File

@ -268,7 +268,7 @@ class Response
{
$headers = $this->headers;
if ($this->isInformational() || in_array($this->statusCode, array(204, 304))) {
if ($this->isInformational() || $this->isEmpty()) {
$this->setContent(null);
$headers->remove('Content-Type');
$headers->remove('Content-Length');