Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1bcce3c

Browse files
committed
Merge branch '2.8'
* 2.8: add dependency required by a replaced package Add a way to group toolbar info pieces Added general sf-toolbar-block-right class Bind input before executing the COMMAND event
2 parents ed610df + a291402 commit 1bcce3c

File tree

7 files changed

+149
-66
lines changed

7 files changed

+149
-66
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig

Lines changed: 67 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -31,84 +31,89 @@
3131
{% endset %}
3232

3333
{% set text %}
34-
{% if collector.applicationname %}
34+
<div class="sf-toolbar-info-group">
35+
{% if collector.applicationname %}
36+
<div class="sf-toolbar-info-piece">
37+
<b>{{ collector.applicationname }}</b>
38+
<span>{{ collector.applicationversion }}</span>
39+
</div>
40+
{% endif %}
41+
3542
<div class="sf-toolbar-info-piece">
36-
<b>{{ collector.applicationname }}</b>
37-
<span>{{ collector.applicationversion }}</span>
43+
<b>Profiler token</b>
44+
<span>
45+
{% if profiler_url %}
46+
<a href="{{ profiler_url }}">{{ collector.token }}</a>
47+
{% else %}
48+
{{ collector.token }}
49+
{% endif %}
50+
</span>
3851
</div>
39-
{% endif %}
4052

41-
<div class="sf-toolbar-info-piece">
42-
<b>Profiler token</b>
43-
<span>
44-
{% if profiler_url %}
45-
<a href="{{ profiler_url }}">{{ collector.token }}</a>
46-
{% else %}
47-
{{ collector.token }}
48-
{% endif %}
49-
</span>
53+
{% if 'n/a' != collector.appname %}
54+
<div class="sf-toolbar-info-piece">
55+
<b>Kernel name</b>
56+
<span>{{ collector.appname }}</span>
57+
</div>
58+
{% endif %}
59+
60+
{% if 'n/a' != collector.env %}
61+
<div class="sf-toolbar-info-piece">
62+
<b>Environment</b>
63+
<span>{{ collector.env }}</span>
64+
</div>
65+
{% endif %}
66+
67+
{% if 'n/a' != collector.debug %}
68+
<div class="sf-toolbar-info-piece">
69+
<b>Debug</b>
70+
<span class="{{ debug_status_class }}">{{ collector.debug ? 'enabled' : 'disabled' }}</span>
71+
</div>
72+
{% endif %}
5073
</div>
5174

52-
{% if 'n/a' != collector.appname %}
53-
<div class="sf-toolbar-info-piece">
54-
<b>Kernel name</b>
55-
<span>{{ collector.appname }}</span>
75+
<div class="sf-toolbar-info-group">
76+
<div class="sf-toolbar-info-piece sf-toolbar-info-php">
77+
<b>PHP version</b>
78+
<span>
79+
{{ collector.phpversion }}
80+
&nbsp; <a href="{{ path('_profiler_phpinfo') }}">View phpinfo()</a>
81+
</span>
5682
</div>
57-
{% endif %}
5883

59-
{% if 'n/a' != collector.env %}
60-
<div class="sf-toolbar-info-piece">
61-
<b>Environment</b>
62-
<span>{{ collector.env }}</span>
84+
<div class="sf-toolbar-info-piece sf-toolbar-info-php-ext">
85+
<b>PHP Extensions</b>
86+
<span class="sf-toolbar-status sf-toolbar-status-{{ collector.hasxdebug ? 'green' : 'red' }}">xdebug</span>
87+
<span class="sf-toolbar-status sf-toolbar-status-{{ collector.hasaccelerator ? 'green' : 'red' }}">accel</span>
6388
</div>
64-
{% endif %}
6589

66-
{% if 'n/a' != collector.debug %}
6790
<div class="sf-toolbar-info-piece">
68-
<b>Debug</b>
69-
<span class="{{ debug_status_class }}">{{ collector.debug ? 'enabled' : 'disabled' }}</span>
91+
<b>PHP SAPI</b>
92+
<span>{{ collector.sapiName }}</span>
7093
</div>
71-
{% endif %}
72-
73-
<div class="sf-toolbar-info-piece sf-toolbar-info-php">
74-
<b>PHP version</b>
75-
<span>
76-
{{ collector.phpversion }}
77-
&nbsp; <a href="{{ path('_profiler_phpinfo') }}">View phpinfo()</a>
78-
</span>
7994
</div>
8095

81-
<div class="sf-toolbar-info-piece sf-toolbar-info-php-ext">
82-
<b>PHP Extensions</b>
83-
<span class="sf-toolbar-status sf-toolbar-status-{{ collector.hasxdebug ? 'green' : 'red' }}">xdebug</span>
84-
<span class="sf-toolbar-status sf-toolbar-status-{{ collector.hasaccelerator ? 'green' : 'red' }}">accel</span>
85-
</div>
86-
87-
<div class="sf-toolbar-info-piece">
88-
<b>PHP SAPI</b>
89-
<span>{{ collector.sapiName }}</span>
96+
<div class="sf-toolbar-info-group">
97+
{% if collector.symfonyversion is defined %}
98+
<div class="sf-toolbar-info-piece">
99+
<b>Resources</b>
100+
<span>
101+
{% if 'Silex' == collector.applicationname %}
102+
<a href="http://silex.sensiolabs.org/documentation" rel="help">
103+
Read Silex Docs
104+
</a>
105+
{% else %}
106+
<a href="https://symfony.com/doc/{{ collector.symfonyversion }}/index.html" rel="help">
107+
Read Symfony {{ collector.symfonyversion }} Docs
108+
</a>
109+
{% endif %}
110+
</span>
111+
</div>
112+
{% endif %}
90113
</div>
91-
92-
93-
{% if collector.symfonyversion is defined %}
94-
<div class="sf-toolbar-info-piece">
95-
<b>Resources</b>
96-
<span>
97-
{% if 'Silex' == collector.applicationname %}
98-
<a href="http://silex.sensiolabs.org/documentation" rel="help">
99-
Read Silex Docs
100-
</a>
101-
{% else %}
102-
<a href="https://symfony.com/doc/{{ collector.symfonyversion }}/index.html" rel="help">
103-
Read Symfony {{ collector.symfonyversion }} Docs
104-
</a>
105-
{% endif %}
106-
</span>
107-
</div>
108-
{% endif %}
109114
{% endset %}
110115

111-
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: true, name: 'config', status: block_status }) }}
116+
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: true, name: 'config', status: block_status, additional_classes: 'sf-toolbar-block-right' }) }}
112117
{% endblock %}
113118

114119
{% block menu %}

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@
104104
.sf-toolbar-block .sf-toolbar-info-piece-additional-detail {
105105
display: none;
106106
}
107+
.sf-toolbar-block .sf-toolbar-info-group {
108+
margin-bottom: 4px;
109+
padding-bottom: 2px;
110+
border-bottom: 1px solid #333333;
111+
}
112+
.sf-toolbar-block .sf-toolbar-info-group:last-child {
113+
margin-bottom: 0;
114+
padding-bottom: 0;
115+
border-bottom: none;
116+
}
107117

108118
.sf-toolbar-block .sf-toolbar-info-piece .sf-toolbar-status {
109119
padding: 2px 5px;
@@ -436,7 +446,7 @@
436446
font-size: 13px;
437447
}
438448

439-
.sf-toolbar-block-config {
449+
.sf-toolbar-block-right {
440450
float: right;
441451
margin-left: 0;
442452
margin-right: 0;

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="sf-toolbar-block sf-toolbar-block-{{ name }} sf-toolbar-status-{{ status|default('normal') }}">
1+
<div class="sf-toolbar-block sf-toolbar-block-{{ name }} sf-toolbar-status-{{ status|default('normal') }} {{ additional_classes|default('') }}">
22
{% if link %}<a href="{{ path('_profiler', { token: token, panel: name }) }}">{% endif %}
33
<div class="sf-toolbar-icon">{{ icon|default('') }}</div>
44
{% if link %}</a>{% endif %}

src/Symfony/Component/Console/Application.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Console;
1313

14+
use Symfony\Component\Console\Exception\ExceptionInterface;
1415
use Symfony\Component\Console\Helper\DebugFormatterHelper;
1516
use Symfony\Component\Console\Helper\ProcessHelper;
1617
use Symfony\Component\Console\Helper\QuestionHelper;
@@ -787,6 +788,14 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
787788
return $command->run($input, $output);
788789
}
789790

791+
// bind before the console.command event, so the listeners have access to input options/arguments
792+
try {
793+
$command->mergeApplicationDefinition();
794+
$input->bind($command->getDefinition());
795+
} catch (ExceptionInterface $e) {
796+
// ignore invalid options/arguments for now, to allow the event listeners to customize the InputDefinition
797+
}
798+
790799
$event = new ConsoleCommandEvent($command, $input, $output);
791800
$this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
792801

src/Symfony/Component/Console/Command/Command.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Console\Command;
1313

14+
use Symfony\Component\Console\Exception\ExceptionInterface;
1415
use Symfony\Component\Console\Input\InputDefinition;
1516
use Symfony\Component\Console\Input\InputOption;
1617
use Symfony\Component\Console\Input\InputArgument;
@@ -218,7 +219,7 @@ public function run(InputInterface $input, OutputInterface $output)
218219
// bind the input against the command specific arguments/options
219220
try {
220221
$input->bind($this->definition);
221-
} catch (\Exception $e) {
222+
} catch (ExceptionInterface $e) {
222223
if (!$this->ignoreValidationErrors) {
223224
throw $e;
224225
}

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

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,63 @@ public function testRunWithDispatcherSkippingCommand()
920920
$this->assertEquals(ConsoleCommandEvent::RETURN_CODE_DISABLED, $exitCode);
921921
}
922922

923+
public function testRunWithDispatcherAccessingInputOptions()
924+
{
925+
$noInteractionValue = null;
926+
$quietValue = null;
927+
928+
$dispatcher = $this->getDispatcher();
929+
$dispatcher->addListener('console.command', function (ConsoleCommandEvent $event) use (&$noInteractionValue, &$quietValue) {
930+
$input = $event->getInput();
931+
932+
$noInteractionValue = $input->getOption('no-interaction');
933+
$quietValue = $input->getOption('quiet');
934+
});
935+
936+
$application = new Application();
937+
$application->setDispatcher($dispatcher);
938+
$application->setAutoExit(false);
939+
940+
$application->register('foo')->setCode(function (InputInterface $input, OutputInterface $output) {
941+
$output->write('foo.');
942+
});
943+
944+
$tester = new ApplicationTester($application);
945+
$tester->run(array('command' => 'foo', '--no-interaction' => true));
946+
947+
$this->assertTrue($noInteractionValue);
948+
$this->assertFalse($quietValue);
949+
}
950+
951+
public function testRunWithDispatcherAddingInputOptions()
952+
{
953+
$extraValue = null;
954+
955+
$dispatcher = $this->getDispatcher();
956+
$dispatcher->addListener('console.command', function (ConsoleCommandEvent $event) use (&$extraValue) {
957+
$definition = $event->getCommand()->getDefinition();
958+
$input = $event->getInput();
959+
960+
$definition->addOption(new InputOption('extra', null, InputOption::VALUE_REQUIRED));
961+
$input->bind($definition);
962+
963+
$extraValue = $input->getOption('extra');
964+
});
965+
966+
$application = new Application();
967+
$application->setDispatcher($dispatcher);
968+
$application->setAutoExit(false);
969+
970+
$application->register('foo')->setCode(function (InputInterface $input, OutputInterface $output) {
971+
$output->write('foo.');
972+
});
973+
974+
$tester = new ApplicationTester($application);
975+
$tester->run(array('command' => 'foo', '--extra' => 'some test value'));
976+
977+
$this->assertEquals('some test value', $extraValue);
978+
}
979+
923980
public function testTerminalDimensions()
924981
{
925982
$application = new Application();

src/Symfony/Component/Security/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"php": ">=5.5.9",
2020
"symfony/event-dispatcher": "~2.8|~3.0",
2121
"symfony/http-foundation": "~2.8|~3.0",
22-
"symfony/http-kernel": "~2.8|~3.0"
22+
"symfony/http-kernel": "~2.8|~3.0",
23+
"symfony/property-access": "~2.8|~3.0.0"
2324
},
2425
"replace": {
2526
"symfony/security-core": "self.version",

0 commit comments

Comments
 (0)