Skip to content

Commit aa28bbe

Browse files
committed
Merge branch '2.2'
* 2.2: (26 commits) [FrameworkBundle] Fixes invalid serialized objects in cache remove dead code in yaml component Fixed typo in UPGRADE-2.2 fixed typo RedisProfilerStorage wrong db-number/index-number selected [DependencyInjection] added a test for the previous merge (refs #7261) Unset loading[$id] in ContainerBuilder on exception Default validation message translation fix. remove() should not use deprecated getParent() so it does not trigger deprecation internally adjust routing tests to not use prefix in addCollection add test for uniqueness of resources added tests for addDefaults, addRequirements, addOptions adjust RouteCollectionTest for the addCollection change and refactor the tests to only skip the part that really needs the config component added tests for remove() that wasnt covered yet and special route name refactor interator test that was still assuming a tree adjust tests to no use addPrefix with options adjusted tests to not use RouteCollection::getPrefix [Routing] trigger deprecation warning for deprecated features that will be removed in 2.3 [Console] fixed StringInput binding [Console] added string input test ...
2 parents fae82da + be71bd9 commit aa28bbe

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Input/ArgvInput.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public function __construct(array $argv = null, InputDefinition $definition = nu
6868
protected function setTokens(array $tokens)
6969
{
7070
$this->tokens = $tokens;
71-
$this->parse();
7271
}
7372

7473
/**

Input/StringInput.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,19 @@ class StringInput extends ArgvInput
3333
* @param string $input An array of parameters from the CLI (in the argv format)
3434
* @param InputDefinition $definition A InputDefinition instance
3535
*
36+
* @deprecated The second argument is deprecated as it does not work (will be removed in 3.0), use 'bind' method instead
37+
*
3638
* @api
3739
*/
3840
public function __construct($input, InputDefinition $definition = null)
3941
{
40-
parent::__construct(array(), $definition);
42+
parent::__construct(array(), null);
4143

4244
$this->setTokens($this->tokenize($input));
45+
46+
if (null !== $definition) {
47+
$this->bind($definition);
48+
}
4349
}
4450

4551
/**

Tests/Input/StringInputTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
namespace Symfony\Component\Console\Tests\Input;
1313

14-
use Symfony\Component\Console\Input\StringInput;
1514
use Symfony\Component\Console\Input\InputDefinition;
1615
use Symfony\Component\Console\Input\InputOption;
16+
use Symfony\Component\Console\Input\StringInput;
1717

1818
class StringInputTest extends \PHPUnit_Framework_TestCase
1919
{
@@ -35,10 +35,14 @@ public function testInputOptionWithGivenString()
3535
array(new InputOption('foo', null, InputOption::VALUE_REQUIRED))
3636
);
3737

38-
$input = new StringInput('--foo=bar', $definition);
39-
$actual = $input->getOption('foo');
38+
// call to bind
39+
$input = new StringInput('--foo=bar');
40+
$input->bind($definition);
41+
$this->assertEquals('bar', $input->getOption('foo'));
4042

41-
$this->assertEquals('bar', $actual);
43+
// definition in constructor
44+
$input = new StringInput('--foo=bar', $definition);
45+
$this->assertEquals('bar', $input->getOption('foo'));
4246
}
4347

4448
public function getTokenizeData()

0 commit comments

Comments
 (0)