Skip to content

Commit e4f62ea

Browse files
committed
Merge branch '3.4' into 4.0
* 3.4: [FrameworkBundle] fixed brackets position in method calls [Form] Fix PHPDoc for FormConfigBuilder $dataClass argument [Security] Update user phpdoc on tokens [WebProfilerBundle] Fixed icon alignment issue using Bootstrap 4.1.2 suppress side effects in 'get' or 'has' methods of NamespacedAttributeBag [HttpFoundation] reset callback on StreamedResponse when setNotModified() is called [HttpFoundation] Fixed phpdoc for get method of HeaderBag fix typo in ContainerBuilder docblock [Form/Profiler] Massively reducing memory footprint of form profiling pages by removing redundant 'form' variable from view variables. [Console] correctly return parameter's default value on "--"
2 parents dd16e10 + 2b01d59 commit e4f62ea

File tree

17 files changed

+108
-40
lines changed

17 files changed

+108
-40
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ public function testWorkflowMultipleTransitionsWithSameName()
286286
{
287287
$container = $this->createContainerFromFile('workflow_with_multiple_transitions_with_same_name');
288288

289-
$this->assertTrue($container->hasDefinition('workflow.article', 'Workflow is registered as a service'));
290-
$this->assertTrue($container->hasDefinition('workflow.article.definition', 'Workflow definition is registered as a service'));
289+
$this->assertTrue($container->hasDefinition('workflow.article'), 'Workflow is registered as a service');
290+
$this->assertTrue($container->hasDefinition('workflow.article.definition'), 'Workflow definition is registered as a service');
291291

292292
$workflowDefinition = $container->getDefinition('workflow.article.definition');
293293

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ div.sf-toolbar .sf-toolbar-block a:hover {
292292
border-width: 0;
293293
position: relative;
294294
top: 8px;
295+
vertical-align: baseline;
295296
}
296297

297298
.sf-toolbar-block .sf-toolbar-icon img + span,

src/Symfony/Component/Console/Input/ArgvInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public function getParameterOption($values, $default = false, $onlyParams = fals
301301
while (0 < count($tokens)) {
302302
$token = array_shift($tokens);
303303
if ($onlyParams && '--' === $token) {
304-
return false;
304+
return $default;
305305
}
306306

307307
foreach ($values as $value) {

src/Symfony/Component/Console/Input/ArrayInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function getParameterOption($values, $default = false, $onlyParams = fals
8181

8282
foreach ($this->parameters as $k => $v) {
8383
if ($onlyParams && ('--' === $k || (is_int($k) && '--' === $v))) {
84-
return false;
84+
return $default;
8585
}
8686

8787
if (is_int($k)) {

src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -395,25 +395,26 @@ public function testToString()
395395
/**
396396
* @dataProvider provideGetParameterOptionValues
397397
*/
398-
public function testGetParameterOptionEqualSign($argv, $key, $onlyParams, $expected)
398+
public function testGetParameterOptionEqualSign($argv, $key, $default, $onlyParams, $expected)
399399
{
400400
$input = new ArgvInput($argv);
401-
$this->assertEquals($expected, $input->getParameterOption($key, false, $onlyParams), '->getParameterOption() returns the expected value');
401+
$this->assertEquals($expected, $input->getParameterOption($key, $default, $onlyParams), '->getParameterOption() returns the expected value');
402402
}
403403

404404
public function provideGetParameterOptionValues()
405405
{
406406
return array(
407-
array(array('app/console', 'foo:bar', '-e', 'dev'), '-e', false, 'dev'),
408-
array(array('app/console', 'foo:bar', '--env=dev'), '--env', false, 'dev'),
409-
array(array('app/console', 'foo:bar', '-e', 'dev'), array('-e', '--env'), false, 'dev'),
410-
array(array('app/console', 'foo:bar', '--env=dev'), array('-e', '--env'), false, 'dev'),
411-
array(array('app/console', 'foo:bar', '--env=dev', '--en=1'), array('--en'), false, '1'),
412-
array(array('app/console', 'foo:bar', '--env=dev', '', '--en=1'), array('--en'), false, '1'),
413-
array(array('app/console', 'foo:bar', '--env', 'val'), '--env', false, 'val'),
414-
array(array('app/console', 'foo:bar', '--env', 'val', '--dummy'), '--env', false, 'val'),
415-
array(array('app/console', 'foo:bar', '--', '--env=dev'), '--env', false, 'dev'),
416-
array(array('app/console', 'foo:bar', '--', '--env=dev'), '--env', true, false),
407+
array(array('app/console', 'foo:bar'), '-e', 'default', false, 'default'),
408+
array(array('app/console', 'foo:bar', '-e', 'dev'), '-e', 'default', false, 'dev'),
409+
array(array('app/console', 'foo:bar', '--env=dev'), '--env', 'default', false, 'dev'),
410+
array(array('app/console', 'foo:bar', '-e', 'dev'), array('-e', '--env'), 'default', false, 'dev'),
411+
array(array('app/console', 'foo:bar', '--env=dev'), array('-e', '--env'), 'default', false, 'dev'),
412+
array(array('app/console', 'foo:bar', '--env=dev', '--en=1'), array('--en'), 'default', false, '1'),
413+
array(array('app/console', 'foo:bar', '--env=dev', '', '--en=1'), array('--en'), 'default', false, '1'),
414+
array(array('app/console', 'foo:bar', '--env', 'val'), '--env', 'default', false, 'val'),
415+
array(array('app/console', 'foo:bar', '--env', 'val', '--dummy'), '--env', 'default', false, 'val'),
416+
array(array('app/console', 'foo:bar', '--', '--env=dev'), '--env', 'default', false, 'dev'),
417+
array(array('app/console', 'foo:bar', '--', '--env=dev'), '--env', 'default', true, 'default'),
417418
);
418419
}
419420

src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ public function testGetParameterOption()
4747
{
4848
$input = new ArrayInput(array('name' => 'Fabien', '--foo' => 'bar'));
4949
$this->assertEquals('bar', $input->getParameterOption('--foo'), '->getParameterOption() returns the option of specified name');
50-
$this->assertFalse($input->getParameterOption('--bar'), '->getParameterOption() returns the default if an option is not present in the passed parameters');
50+
$this->assertEquals('default', $input->getParameterOption('--bar', 'default'), '->getParameterOption() returns the default value if an option is not present in the passed parameters');
5151

5252
$input = new ArrayInput(array('Fabien', '--foo' => 'bar'));
5353
$this->assertEquals('bar', $input->getParameterOption('--foo'), '->getParameterOption() returns the option of specified name');
5454

5555
$input = new ArrayInput(array('--foo', '--', '--bar' => 'woop'));
5656
$this->assertEquals('woop', $input->getParameterOption('--bar'), '->getParameterOption() returns the correct value if an option is present in the passed parameters');
57-
$this->assertFalse($input->getParameterOption('--bar', false, true), '->getParameterOption() returns false if an option is present in the passed parameters after an end of options signal');
57+
$this->assertEquals('default', $input->getParameterOption('--bar', 'default', true), '->getParameterOption() returns the default value if an option is present in the passed parameters after an end of options signal');
5858
}
5959

6060
public function testParseArguments()

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,10 +602,10 @@ private function doGet($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_
602602
* the parameters passed to the container constructor to have precedence
603603
* over the loaded ones.
604604
*
605-
* $container = new ContainerBuilder(array('foo' => 'bar'));
605+
* $container = new ContainerBuilder(new ParameterBag(array('foo' => 'bar')));
606606
* $loader = new LoaderXXX($container);
607607
* $loader->load('resource_name');
608-
* $container->register('foo', new stdClass());
608+
* $container->register('foo', 'stdClass');
609609
*
610610
* In the above example, even if the loaded resource defines a foo
611611
* parameter, the value will still be 'bar' as defined in the ContainerBuilder

src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Form\FormInterface;
1515
use Symfony\Component\Form\FormView;
1616
use Symfony\Component\Validator\ConstraintViolationInterface;
17+
use Symfony\Component\VarDumper\Caster\CutStub;
1718

1819
/**
1920
* Default implementation of {@link FormDataExtractorInterface}.
@@ -144,6 +145,10 @@ public function extractViewVariables(FormView $view)
144145
);
145146

146147
foreach ($view->vars as $varName => $value) {
148+
// Removing redundant variable from view variables
149+
if ('form' === $varName) {
150+
$value = new CutStub($value);
151+
}
147152
$data['view_vars'][$varName] = $value;
148153
}
149154

src/Symfony/Component/Form/FormConfigBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
138138
private $data;
139139

140140
/**
141-
* @var string
141+
* @var string|null
142142
*/
143143
private $dataClass;
144144

@@ -181,7 +181,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
181181
* Creates an empty form configuration.
182182
*
183183
* @param string|int $name The form name
184-
* @param string $dataClass The class of the form's data
184+
* @param string|null $dataClass The class of the form's data
185185
* @param EventDispatcherInterface $dispatcher The event dispatcher
186186
* @param array $options The form options
187187
*

src/Symfony/Component/HttpFoundation/HeaderBag.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ public function add(array $headers)
101101
/**
102102
* Returns a header value by name.
103103
*
104-
* @param string $key The header name
105-
* @param string|string[] $default The default value
106-
* @param bool $first Whether to return the first value or all header values
104+
* @param string $key The header name
105+
* @param string|string[]|null $default The default value
106+
* @param bool $first Whether to return the first value or all header values
107107
*
108-
* @return string|string[] The first header value or default value if $first is true, an array of values otherwise
108+
* @return string|string[]|null The first header value or default value if $first is true, an array of values otherwise
109109
*/
110110
public function get($key, $default = null, $first = true)
111111
{

0 commit comments

Comments
 (0)