Merge branch '2.3' into 2.7

* 2.3:
  Detect CLI color support for Windows 10 build 10586
  [EventDispatcher] Try first if the event is Stopped
  [FrameworkBundle] fixes grammar in container:debug command manual.

Conflicts:
	src/Symfony/Component/EventDispatcher/EventDispatcher.php
	src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php
This commit is contained in:
Nicolas Grekas 2016-04-04 19:08:16 +02:00
commit 01fb26b4d2
4 changed files with 12 additions and 4 deletions

View File

@ -80,7 +80,7 @@ Use the <info>--parameters</info> option to display all parameters:
<info>php %command.full_name% --parameters</info>
Display a specific parameter by specifying his name with the <info>--parameter</info> option:
Display a specific parameter by specifying its name with the <info>--parameter</info> option:
<info>php %command.full_name% --parameter=kernel.debug</info>

View File

@ -83,7 +83,7 @@ class StreamOutput extends Output
*
* Colorization is disabled if not supported by the stream:
*
* - Windows without Ansicon, ConEmu or Mintty
* - Windows before 10.0.10586 without Ansicon, ConEmu or Mintty
* - non tty consoles
*
* @return bool true if the stream supports colorization, false otherwise
@ -91,7 +91,11 @@ class StreamOutput extends Output
protected function hasColorSupport()
{
if (DIRECTORY_SEPARATOR === '\\') {
return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM');
return
0 >= version_compare('10.0.10586', PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD)
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');
}
return function_exists('posix_isatty') && @posix_isatty($this->stream);

View File

@ -116,6 +116,10 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
$event = new Event();
}
if (null !== $this->logger && $event->isPropagationStopped()) {
$this->logger->debug(sprintf('The "%s" event is already stopped. No listeners have been called.', $eventName));
}
$this->preProcess($eventName);
$this->preDispatch($eventName, $event);

View File

@ -155,10 +155,10 @@ class EventDispatcher implements EventDispatcherInterface
protected function doDispatch($listeners, $eventName, Event $event)
{
foreach ($listeners as $listener) {
call_user_func($listener, $event, $eventName, $this);
if ($event->isPropagationStopped()) {
break;
}
call_user_func($listener, $event, $eventName, $this);
}
}