Skip to content

Commit 45a3ab9

Browse files
Merge branch '3.3' into 3.4
* 3.3: fixed CS Remove unused constant fix merge [Form] Add notice to upgrade to PHP v7.0.8+ Fix passing options with defaultCommand
2 parents 15ceb18 + 75c3eca commit 45a3ab9

File tree

6 files changed

+65
-7
lines changed

6 files changed

+65
-7
lines changed

src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Dumper/PhpDumperTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy\Dumper;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use ProxyManager\ProxyGenerator\LazyLoading\MethodGenerator\StaticProxyConstructor;
1615
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
1716
use Symfony\Component\DependencyInjection\ContainerBuilder;
1817
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;

src/Symfony/Component/Console/Application.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,12 @@ public function doRun(InputInterface $input, OutputInterface $output)
202202

203203
if (!$name) {
204204
$name = $this->defaultCommand;
205-
$input = new ArrayInput(array('command' => $this->defaultCommand));
205+
$this->definition->setArguments(array_merge(
206+
$this->definition->getArguments(),
207+
array(
208+
'command' => new InputArgument('command', InputArgument::OPTIONAL, $this->definition->getArgument('command')->getDescription(), $name),
209+
)
210+
));
206211
}
207212

208213
try {

src/Symfony/Component/Console/Tests/ApplicationTest.php

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public static function setUpBeforeClass()
4545
{
4646
self::$fixturesPath = realpath(__DIR__.'/Fixtures/');
4747
require_once self::$fixturesPath.'/FooCommand.php';
48+
require_once self::$fixturesPath.'/FooOptCommand.php';
4849
require_once self::$fixturesPath.'/Foo1Command.php';
4950
require_once self::$fixturesPath.'/Foo2Command.php';
5051
require_once self::$fixturesPath.'/Foo3Command.php';
@@ -1376,16 +1377,31 @@ public function testSetRunCustomDefaultCommand()
13761377
$application->setDefaultCommand($command->getName());
13771378

13781379
$tester = new ApplicationTester($application);
1379-
$tester->run(array());
1380-
$this->assertEquals('interact called'.PHP_EOL.'called'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command');
1380+
$tester->run(array(), array('interactive' => false));
1381+
$this->assertEquals('called'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command');
13811382

13821383
$application = new CustomDefaultCommandApplication();
13831384
$application->setAutoExit(false);
13841385

13851386
$tester = new ApplicationTester($application);
1386-
$tester->run(array());
1387+
$tester->run(array(), array('interactive' => false));
1388+
1389+
$this->assertEquals('called'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command');
1390+
}
1391+
1392+
public function testSetRunCustomDefaultCommandWithOption()
1393+
{
1394+
$command = new \FooOptCommand();
1395+
1396+
$application = new Application();
1397+
$application->setAutoExit(false);
1398+
$application->add($command);
1399+
$application->setDefaultCommand($command->getName());
1400+
1401+
$tester = new ApplicationTester($application);
1402+
$tester->run(array('--fooopt' => 'opt'), array('interactive' => false));
13871403

1388-
$this->assertEquals('interact called'.PHP_EOL.'called'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command');
1404+
$this->assertEquals('called'.PHP_EOL.'opt'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command');
13891405
}
13901406

13911407
public function testSetRunCustomSingleCommand()
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
use Symfony\Component\Console\Command\Command;
4+
use Symfony\Component\Console\Input\InputInterface;
5+
use Symfony\Component\Console\Input\InputOption;
6+
use Symfony\Component\Console\Output\OutputInterface;
7+
8+
class FooOptCommand extends Command
9+
{
10+
public $input;
11+
public $output;
12+
13+
protected function configure()
14+
{
15+
$this
16+
->setName('foo:bar')
17+
->setDescription('The foo:bar command')
18+
->setAliases(array('afoobar'))
19+
->addOption('fooopt', 'fo', InputOption::VALUE_OPTIONAL, 'fooopt description')
20+
;
21+
}
22+
23+
protected function interact(InputInterface $input, OutputInterface $output)
24+
{
25+
$output->writeln('interact called');
26+
}
27+
28+
protected function execute(InputInterface $input, OutputInterface $output)
29+
{
30+
$this->input = $input;
31+
$this->output = $output;
32+
33+
$output->writeln('called');
34+
$output->writeln($this->input->getOption('fooopt'));
35+
}
36+
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ public function __construct(FormDataExtractorInterface $dataExtractor)
8585
*/
8686
public function collect(Request $request, Response $response, \Exception $exception = null)
8787
{
88+
if (70000 <= \PHP_VERSION_ID && \PHP_VERSION_ID < 70800) {
89+
@trigger_error('A bug in PHP 7.0.0 to 7.0.7 is breaking the Form panel, please upgrade to 7.0.8 or higher.', E_USER_DEPRECATED);
90+
}
8891
}
8992

9093
/**

src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
class BCryptPasswordEncoderTest extends TestCase
2121
{
2222
const PASSWORD = 'password';
23-
const BYTES = '0123456789abcdef';
2423
const VALID_COST = '04';
2524

2625
/**

0 commit comments

Comments
 (0)