Skip to content

Commit dd801b5

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: fixed CS fixed CS fixed CS Fix WebProfilerBundle compatiblity with HttpKernel < 2.7 [Validator] Deprecated PHP7-incompatible constraints and related validators [DebugBundle] Allow alternative destination for dumps [DebugBundle] Use output mechanism of dumpers instead of echoing [DebugBundle] Always collect dumps [FrameworkBundle] Applied new styles to the config:debug & config:dump-reference commands Fix tests in HHVM CS: Pre incrementation/decrementation should be used if possible Conflicts: src/Symfony/Bundle/FrameworkBundle/composer.json
2 parents eeeb14e + 9edc184 commit dd801b5

File tree

10 files changed

+24
-22
lines changed

10 files changed

+24
-22
lines changed

Command/AbstractConfigCommand.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Config\Definition\ConfigurationInterface;
1515
use Symfony\Component\Console\Helper\Table;
1616
use Symfony\Component\Console\Output\OutputInterface;
17+
use Symfony\Component\Console\Style\StyleInterface;
1718
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
1819

1920
/**
@@ -27,24 +28,21 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand
2728
{
2829
protected function listBundles(OutputInterface $output)
2930
{
30-
$output->writeln('Available registered bundles with their extension alias if available:');
31-
32-
if (class_exists('Symfony\Component\Console\Helper\Table')) {
33-
$table = new Table($output);
34-
} else {
35-
$table = $this->getHelperSet()->get('table');
36-
}
37-
38-
$table->setHeaders(array('Bundle name', 'Extension alias'));
31+
$headers = array('Bundle name', 'Extension alias');
32+
$rows = array();
3933
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
4034
$extension = $bundle->getContainerExtension();
41-
$table->addRow(array($bundle->getName(), $extension ? $extension->getAlias() : ''));
35+
$rows[] = array($bundle->getName(), $extension ? $extension->getAlias() : '');
4236
}
4337

44-
if (class_exists('Symfony\Component\Console\Helper\Table')) {
45-
$table->render();
38+
$message = 'Available registered bundles with their extension alias if available:';
39+
if ($output instanceof StyleInterface) {
40+
$output->writeln(' '.$message);
41+
$output->table($headers, $rows);
4642
} else {
47-
$table->render($output);
43+
$output->writeln($message);
44+
$table = new Table($output);
45+
$table->setHeaders($headers)->setRows($rows)->render($output);
4846
}
4947
}
5048

Command/ConfigDebugCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\Console\Input\InputArgument;
1616
use Symfony\Component\Console\Input\InputInterface;
1717
use Symfony\Component\Console\Output\OutputInterface;
18+
use Symfony\Component\Console\Style\SymfonyStyle;
1819
use Symfony\Component\Yaml\Yaml;
1920

2021
/**
@@ -57,8 +58,9 @@ protected function configure()
5758
*/
5859
protected function execute(InputInterface $input, OutputInterface $output)
5960
{
61+
$output = new SymfonyStyle($input, $output);
6062
if (false !== strpos($input->getFirstArgument(), ':d')) {
61-
$output->writeln('<comment>The use of "config:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:config" instead.</comment>');
63+
$output->caution('The use of "config:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:config" instead.');
6264
}
6365

6466
$name = $input->getArgument('name');

Command/ConfigDumpReferenceCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\Console\Input\InputOption;
1818
use Symfony\Component\Console\Input\InputInterface;
1919
use Symfony\Component\Console\Output\OutputInterface;
20+
use Symfony\Component\Console\Style\SymfonyStyle;
2021

2122
/**
2223
* A console command for dumping available configuration reference.
@@ -66,6 +67,7 @@ protected function configure()
6667
*/
6768
protected function execute(InputInterface $input, OutputInterface $output)
6869
{
70+
$output = new SymfonyStyle($input, $output);
6971
$name = $input->getArgument('name');
7072

7173
if (empty($name)) {

Command/ContainerDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ protected function validateInput(InputInterface $input)
145145
$optionsCount = 0;
146146
foreach ($options as $option) {
147147
if ($input->getOption($option)) {
148-
$optionsCount++;
148+
++$optionsCount;
149149
}
150150
}
151151

Command/RouterDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected function configure()
5555
))
5656
->setDefinition(array(
5757
new InputArgument('name', InputArgument::OPTIONAL, 'A route name'),
58-
new InputOption('show-controllers', null, InputOption::VALUE_NONE, 'Show assigned controllers in overview'),
58+
new InputOption('show-controllers', null, InputOption::VALUE_NONE, 'Show assigned controllers in overview'),
5959
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'To output route(s) in other formats', 'txt'),
6060
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw route(s)'),
6161
))

Console/Helper/DescriptorHelper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ class DescriptorHelper extends BaseDescriptorHelper
3030
public function __construct()
3131
{
3232
$this
33-
->register('txt', new TextDescriptor())
34-
->register('xml', new XmlDescriptor())
33+
->register('txt', new TextDescriptor())
34+
->register('xml', new XmlDescriptor())
3535
->register('json', new JsonDescriptor())
36-
->register('md', new MarkdownDescriptor())
36+
->register('md', new MarkdownDescriptor())
3737
;
3838
}
3939
}

Templating/Helper/CodeHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function fileExcerpt($file, $line)
135135
$content = preg_split('#<br />#', $code);
136136

137137
$lines = array();
138-
for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; $i++) {
138+
for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; ++$i) {
139139
$lines[] = '<li'.($i == $line ? ' class="selected"' : '').'><code>'.self::fixCodeMarkup($content[$i - 1]).'</code></li>';
140140
}
141141

Translation/PhpExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ protected function parseTokens($tokens, MessageCatalogue $catalog)
147147
{
148148
$tokenIterator = new \ArrayIterator($tokens);
149149

150-
for ($key = 0; $key < $tokenIterator->count(); $key++) {
150+
for ($key = 0; $key < $tokenIterator->count(); ++$key) {
151151
foreach ($this->sequences as $sequence) {
152152
$message = '';
153153
$tokenIterator->seek($key);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"require-dev": {
3636
"symfony/phpunit-bridge": "~2.7|~3.0.0",
3737
"symfony/browser-kit": "~2.4|~3.0.0",
38-
"symfony/console": "~2.6|~3.0.0",
38+
"symfony/console": "~2.7|~3.0.0",
3939
"symfony/css-selector": "~2.0,>=2.0.5|~3.0.0",
4040
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0",
4141
"symfony/finder": "~2.0,>=2.0.5|~3.0.0",

0 commit comments

Comments
 (0)