8000 [Console] Removed DialogHelper, ProgressHelper and TableHelper · symfony/symfony@ce13d98 · GitHub
[go: up one dir, main page]

Skip to content

Commit ce13d98

Browse files
committed
[Console] Removed DialogHelper, ProgressHelper and TableHelper
1 parent f333cb2 commit ce13d98

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+86
-2025
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ matrix:
1414
include:
1515
- php: 5.5
1616
env: components=high
17-
- php: 5.3.3
17+
- php: 5.5
1818
env: components=low
1919

2020
services: mongodb

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;
1313

1414
use Symfony\Component\Console\Descriptor\DescriptorInterface;
15-
use Symfony\Component\Console\Helper\TableHelper;
1615
use Symfony\Component\Console\Output\OutputInterface;
1716
use Symfony\Component\DependencyInjection\Alias;
1817
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -30,7 +29,7 @@ abstract class Descriptor implements DescriptorInterface
3029
/**
3130
* @var OutputInterface
3231
*/
33-
private $output;
32+
protected $output;
3433

3534
/**
3635
* {@inheritdoc}
@@ -89,22 +88,6 @@ protected function write($content, $decorated = false)
8988
$this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
9089
}
9190

92-
/**
93-
* Writes content to output.
94-
*
95-
* @param TableHelper $table
96-
* @param bool $decorated
97-
*/
98-
protected function renderTable(TableHelper $table, $decorated = false)
99-
{
100-
if (!$decorated) {
101-
$table->setCellRowFormat('%s');
102-
$table->setCellHeaderFormat('%s');
103-
}
104-
105-
$table->render($this->output);
106-
}
107-
10891
/**
10992
* Describes an InputArgument instance.
11093
*

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;
1313

14-
use Symfony\Component\Console\Helper\TableHelper;
14+
use Symfony\Component\Console\Helper\Table;
1515
use Symfony\Component\DependencyInjection\Alias;
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
1717
use Symfony\Component\DependencyInjection\Definition;
@@ -30,10 +30,10 @@ class TextDescriptor extends Descriptor
3030
*/
3131
protected function describeRouteCollection(RouteCollection $routes, array $options = array())
3232
{
33+
$table = new Table($this->output);
34+
3335
$showControllers = isset($options['show_controllers']) && $options['show_controllers'];
3436
$headers = array('Name', 'Method', 'Scheme', 'Host', 'Path');
35-
$table = new TableHelper();
36-
$table->setLayout(TableHelper::LAYOUT_COMPACT);
3737
$table->setHeaders($showControllers ? array_merge($headers, array('Controller')) : $headers);
3838

3939
foreach ($routes->all() as $name => $route) {
@@ -59,7 +59,7 @@ protected function describeRouteCollection(RouteCollection $routes, array $optio
5959
}
6060

6161
$this->writeText($this->formatSection('router', 'Current routes')."\n", $options);
62-
$this->renderTable($table, !(isset($options['raw_output']) && $options['raw_output']));
62+
$table->render();
6363
}
6464

6565
/**
@@ -100,16 +100,15 @@ protected function describeRoute(Route $route, array $options = array())
100100
*/
101101
protected function describeContainerParameters(ParameterBag $parameters, array $options = array())
102102
{
103-
$table = new TableHelper();
104-
$table->setLayout(TableHelper::LAYOUT_COMPACT);
103+
$table = new Table($this->output);
105104
$table->setHeaders(array('Parameter', 'Value'));
106105

107106
foreach ($this->sortParameters($parameters) as $parameter => $value) {
108107
$table->addRow(array($parameter, $this->formatParameter($value)));
109108
}
110109

111110
$this->writeText($this->formatSection('container', 'List of parameters')."\n", $options);
112-
$this->renderTable($table, !(isset($options['raw_output']) && $options['raw_output']));
111+
$table->render();
113112
}
114113

115114
/**
@@ -201,8 +200,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
201200
$tagsCount = count($maxTags);
202201
$tagsNames = array_keys($maxTags);
203202

204-
$table = new TableHelper();
205-
$table->setLayout(TableHelper::LAYOUT_COMPACT);
203+
$table = new Table($this->output);
206204
$table->setHeaders(array_merge(array('Service ID'), $tagsNames, array('Class name')));
207205

208206
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
@@ -232,7 +230,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
232230
}
233231
}
234232

235-
$this->renderTable($table);
233+
$table->render();
236234
}
237235

238236
/**
@@ -302,31 +300,30 @@ protected function describeEventDispatcherListeners(EventDispatcherInterface $ev
302300
$this->writeText($this->formatSection('event_dispatcher', $label)."\n", $options);
303301

304302
$registeredListeners = $eventDispatcher->getListeners($event);
303+
$table = new Table($this->output);
304+
305305
if (null !== $event) {
306306
$this->writeText("\n");
307-
$table = new TableHelper();
307+
308308
$table->setHeaders(array('Order', 'Callable'));
309309

310310
foreach ($registeredListeners as $order => $listener) {
311311
$table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($listener)));
312312
}
313-
314-
$this->renderTable($table);
315313
} else {
316314
ksort($registeredListeners);
317315
foreach ($registeredListeners as $eventListened => $eventListeners) {
318316
$this->writeText(sprintf("\n<info>[Event]</info> %s\n", $eventListened), $options);
319317

320-
$table = new TableHelper();
321318
$table->setHeaders(array('Order', 'Callable'));
322319

323320
foreach ($eventListeners as $order => $eventListener) {
324321
$table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($eventListener)));
325322
}
326-
327-
$this->renderTable($table);
328323
}
329324
}
325+
326+
$table->render();
330327
}
331328

332329
/**

src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ private function assertDescription($expectedDescription, $describedObject, array
137137
if ('json' === $this->getFormat()) {
138138
$this->assertEquals(json_decode($expectedDescription), json_decode($output->fetch()));
139139
} else {
140-
$this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $output->fetch())));
140+
$this->assertEquals($expectedDescription, $output->fetch());
141141
}
142142
}
143143

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
- Service: `service_1`
2-
- Public: yes
2+
- Public: yes
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
- Service: `service_2`
2-
- Public: no
2+
- Public: no

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ alias_2
3232
Services
3333
--------
3434
35-
- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`
35+
- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<info>[container]</info> <comment>Public</comment> services
2-
Service ID Class name
3-
alias_1 alias for "service_1"
4-
alias_2 alias for "service_2"
5-
definition_1 Full\Qualified\Class1
6-
service_container Symfony\Component\DependencyInjection\ContainerBuilder
2+
+-------------------+--------------------------------------------------------+
3+
| Service ID | Class name |
4+
+-------------------+--------------------------------------------------------+
5+
| alias_1 | alias for "service_1" |
6+
| alias_2 | alias for "service_2" |
7+
| definition_1 | Full\Qualified\Class1 |
8+
| service_container | Symfony\Component\DependencyInjection\ContainerBuilder |
9+
+-------------------+--------------------------------------------------------+

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ alias_2
4747
Services
4848
--------
4949

50-
- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`
50+
- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<info>[container]</info> <comment>Public</comment> and <comment>private</comment> services
2-
Service ID Class name
3-
alias_1 alias for "service_1"
4-
alias_2 alias for "service_2"
5-
definition_1 Full\Qualified\Class1
6-
definition_2 Full\Qualified\Class2
7-
service_container Symfony\Component\DependencyInjection\ContainerBuilder
8-
2+
+-------------------+--------------------------------------------------------+
3+
| Service ID | Class name |
4+
+-------------------+--------------------------------------------------------+
5+
| alias_1 | alias for "service_1" |
6+
| alias_2 | alias for "service_2" |
7+
| definition_1 | Full\Qualified\Class1 |
8+
| definition_2 | Full\Qualified\Class2 |
9+
| service_container | Symfony\Component\DependencyInjection\ContainerBuilder |
10+
+-------------------+--------------------------------------------------------+
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<info>[container]</info> <comment>Public</comment> and <comment>private</comment> services with tag <info>tag1</info>
2-
Service ID attr1 attr2 attr3 Class name
3-
definition_2 val1 val2 Full\Qualified\Class2
4-
" val3
2+
+--------------+-------+-------+-------+-----------------------+
3+
| Service ID | attr1 | attr2 | attr3 | Class name |
4+
+--------------+-------+-------+-------+-----------------------+
5+
| definition_2 | val1 | val2 | | Full\Qualified\Class2 |
6+
| " | | | val3 | |
7+
+--------------+-------+-------+-------+-----------------------+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
12
- Type: `function`
23
- Name: `array_key_exists`
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
array_key_exists()
1+
array_key_exists()

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_2.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
- Type: `function`
23
- Name: `staticMethod`
34
- Class: `Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass`
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::staticMethod()
1+
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::staticMethod()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
- Type: `function`
23
- Name: `method`
34
- Class: `Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass`
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::method()
1+
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::method()

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_4.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
- Type: `function`
23
- Name: `staticMethod`
34
- Class: `Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass`
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::staticMethod()
1+
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::staticMethod()

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_5.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1 10000 +
12
- Type: `function`
23
- Name: `staticMethod`
34
- Class: `Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\ExtendedCallableClass`
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\ExtendedCallableClass::parent::staticMethod()
1+
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\ExtendedCallableClass::parent::staticMethod()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
12
- Type: `closure`
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
\Closure()
1+
\Closure()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1+
12
- Type: `object`
23
- Name: `Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass`
3-
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::__invoke()
1+
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::__invoke()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
- Class: `Full\Qualified\Class1`
22
- Scope: `container`
33
- Public: yes
4-
- Synthetic: no
4+
- Synthetic: no

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
- Attr2: val2
99
- Tag: `tag1`
1010
- Attr3: val3
11-
- Tag: `tag2`
11+
- Tag: `tag2`

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/event_dispatcher_1_event1.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<info>[event_dispatcher]</info> Registered listeners for event <info>event1</info>
22

33
+-------+-------------------+
4-
| Order | Callable |
4+
| Order | Callable |
55
+-------+-------------------+
66
| #1 | global_function() |
77
| #2 | \Closure() |
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
<info>[event_dispatcher]</info> Registered listeners by event
22

33
<info>[Event]</info> event1
4-
+-------+-------------------+
5-
| Order | Callable |
6-
+-------+-------------------+
7-
| #1 | global_function() |
8-
| #2 | \Closure() |
9-
+-------+-------------------+
104

115
<info>[Event]</info> event2
126
+-------+-----------------------------------------------------------------------------------+
13-
| Order | Callable |
7+
| Order | Callable |
148
+-------+-----------------------------------------------------------------------------------+
9+
| #1 | global_function() |
10+
| #2 | \Closure() |
1511
| #1 | Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::__invoke() |
1612
+-------+-----------------------------------------------------------------------------------+
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
database_name
22
=============
33

4-
symfony
4+
symfony
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
symfony
1+
symfony

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameters_1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ Container parameters
44
- `array`: `[12,"Hello world!",true]`
55
- `boolean`: `true`
66
- `integer`: `12`
7-
- `string`: `Hello world!`
7+
- `string`: `Hello world!`
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<info>[container]</info> List of parameters
2-
Parameter Value
3-
array [12,"Hello world!",true]
4-
boolean true
5-
integer 12
6-
string Hello world!
7-
2+
+-----------+--------------------------+
3+
| Parameter | Value |
4+
+-----------+--------------------------+
5+
| array | [12,"Hello world!",true] |
6+
| boolean | true |
7+
| integer | 12 |
8+
| string | Hello world! |
9+
+-----------+--------------------------+

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
- Defaults:
77
- `name`: Joseph
88
- Requirements:
9-
- `name`: [a-z]+
9+
- `name`: [a-z]+

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
opt1: val1
1010
opt2: val2
1111
<comment>Path-Regex</comment> #^/hello(?:/(?P<name>[a-z]+))?$#s
12-
<comment>Host-Regex</comment> #^localhost$#s
12+
<comment>Host-Regex</comment> #^localhost$#s

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
- Method: PUT|POST
55
- Class: Symfony\Component\Routing\Route
66
- Defaults: NONE
7-
- Requirements: NONE
7+
- Requirements: NONE

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
opt1: val1
1010
opt2: val2
1111
<comment>Path-Regex</comment> #^/name/add$#s
12-
<comment>Host-Regex</comment> #^localhost$#s
12+
<comment>Host-Regex</comment> #^localhost$#s

0 commit comments

Comments
 (0)
0