[Console] Remove deprecated features

This commit is contained in:
Robin Chalas 2019-05-29 14:54:15 +02:00
parent 174a0a7576
commit 317b80facc
7 changed files with 21 additions and 88 deletions

View File

@ -43,8 +43,7 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Debug\ErrorHandler; use Symfony\Component\Debug\ErrorHandler;
use Symfony\Component\Debug\Exception\FatalThrowableError; use Symfony\Component\Debug\Exception\FatalThrowableError;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
/** /**
* An Application is the container for a collection of commands. * An Application is the container for a collection of commands.
@ -92,11 +91,11 @@ class Application
} }
/** /**
* @final since Symfony 4.3, the type-hint will be updated to the interface from symfony/contracts in 5.0 * @final
*/ */
public function setDispatcher(EventDispatcherInterface $dispatcher) public function setDispatcher(EventDispatcherInterface $dispatcher)
{ {
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher); $this->dispatcher = $dispatcher;
} }
public function setCommandLoader(CommandLoaderInterface $commandLoader) public function setCommandLoader(CommandLoaderInterface $commandLoader)

View File

@ -1,6 +1,18 @@
CHANGELOG CHANGELOG
========= =========
5.0.0
-----
* removed `TableStyle::setCrossingChar()` method in favor of `TableStyle::setDefaultCrossingChar()`
* removed `TableStyle::setHorizontalBorderChar()` method in favor of `TableStyle::setDefaultCrossingChars()`
* removed `TableStyle::getHorizontalBorderChar()` method in favor of `TableStyle::getBorderChars()`
* removed `TableStyle::setVerticalBorderChar()` method in favor of `TableStyle::setVerticalBorderChars()`
* removed `TableStyle::getVerticalBorderChar()` method in favor of `TableStyle::getBorderChars()`
* `ProcessHelper::run()` accepts only `array|Symfony\Component\Process\Process` for its `command` argument
* `Application::setDispatcher` accepts only `Symfony\Contracts\EventDispatcher\EventDispatcherInterface`
for its `dispatcher` argument
4.3.0 4.3.0
----- -----

View File

@ -14,7 +14,7 @@ namespace Symfony\Component\Console\Event;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\EventDispatcher\Event; use Symfony\Contracts\EventDispatcher\Event;
/** /**
* Allows to inspect input and output of a command. * Allows to inspect input and output of a command.

View File

@ -21,7 +21,7 @@ use Symfony\Component\Process\Process;
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
* *
* @final since Symfony 4.2 * @final
*/ */
class ProcessHelper extends Helper class ProcessHelper extends Helper
{ {
@ -50,8 +50,7 @@ class ProcessHelper extends Helper
} }
if (!\is_array($cmd)) { if (!\is_array($cmd)) {
@trigger_error(sprintf('Passing a command as a string to "%s()" is deprecated since Symfony 4.2, pass it the command as an array of arguments instead.', __METHOD__), E_USER_DEPRECATED); throw new \TypeError(sprintf('The "command" argument of "%s()" must be an array or a "%s" instance, "%s" given.', __METHOD__, Process::class, \is_object($cmd) ? \get_class($cmd) : \gettype($cmd)));
$cmd = [\method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline($cmd) : new Process($cmd)];
} }
if (\is_string($cmd[0] ?? null)) { if (\is_string($cmd[0] ?? null)) {

View File

@ -101,36 +101,6 @@ class TableStyle
return $this; return $this;
} }
/**
* Sets horizontal border character.
*
* @param string $horizontalBorderChar
*
* @return $this
*
* @deprecated since Symfony 4.1, use {@link setHorizontalBorderChars()} instead.
*/
public function setHorizontalBorderChar($horizontalBorderChar)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setHorizontalBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
return $this->setHorizontalBorderChars($horizontalBorderChar, $horizontalBorderChar);
}
/**
* Gets horizontal border character.
*
* @return string
*
* @deprecated since Symfony 4.1, use {@link getBorderChars()} instead.
*/
public function getHorizontalBorderChar()
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use getBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
return $this->horizontalOutsideBorderChar;
}
/** /**
* Sets vertical border characters. * Sets vertical border characters.
* *
@ -157,36 +127,6 @@ class TableStyle
return $this; return $this;
} }
/**
* Sets vertical border character.
*
* @param string $verticalBorderChar
*
* @return $this
*
* @deprecated since Symfony 4.1, use {@link setVerticalBorderChars()} instead.
*/
public function setVerticalBorderChar($verticalBorderChar)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setVerticalBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
return $this->setVerticalBorderChars($verticalBorderChar, $verticalBorderChar);
}
/**
* Gets vertical border character.
*
* @return string
*
* @deprecated since Symfony 4.1, use {@link getBorderChars()} instead.
*/
public function getVerticalBorderChar()
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use getBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
return $this->verticalOutsideBorderChar;
}
/** /**
* Gets border characters. * Gets border characters.
* *
@ -259,22 +199,6 @@ class TableStyle
return $this->setCrossingChars($char, $char, $char, $char, $char, $char, $char, $char, $char); return $this->setCrossingChars($char, $char, $char, $char, $char, $char, $char, $char, $char);
} }
/**
* Sets crossing character.
*
* @param string $crossingChar
*
* @return $this
*
* @deprecated since Symfony 4.1. Use {@link setDefaultCrossingChar()} instead.
*/
public function setCrossingChar($crossingChar)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1. Use setDefaultCrossingChar() instead.', __METHOD__), E_USER_DEPRECATED);
return $this->setDefaultCrossingChar($crossingChar);
}
/** /**
* Gets crossing character. * Gets crossing character.
* *

View File

@ -16,8 +16,6 @@ namespace Symfony\Component\Console\Output;
* This adds information about stderr and section output stream. * This adds information about stderr and section output stream.
* *
* @author Dariusz Górecki <darek.krk@gmail.com> * @author Dariusz Górecki <darek.krk@gmail.com>
*
* @method ConsoleSectionOutput section() Creates a new output section
*/ */
interface ConsoleOutputInterface extends OutputInterface interface ConsoleOutputInterface extends OutputInterface
{ {
@ -29,4 +27,6 @@ interface ConsoleOutputInterface extends OutputInterface
public function getErrorOutput(); public function getErrorOutput();
public function setErrorOutput(OutputInterface $error); public function setErrorOutput(OutputInterface $error);
public function section(): ConsoleSectionOutput;
} }

View File

@ -17,7 +17,6 @@ use Symfony\Component\Console\Event\ConsoleEvent;
use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Debug\ErrorHandler; use Symfony\Component\Debug\ErrorHandler;
use Symfony\Component\Debug\ExceptionHandler; use Symfony\Component\Debug\ExceptionHandler;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter; use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
use Symfony\Component\HttpKernel\Event\KernelEvent; use Symfony\Component\HttpKernel\Event\KernelEvent;
@ -63,7 +62,7 @@ class DebugHandlersListener implements EventSubscriberInterface
/** /**
* Configures the error handler. * Configures the error handler.
*/ */
public function configure(Event $event = null) public function configure(object $event = null)
{ {
if (!$event instanceof KernelEvent ? !$this->firstCall : !$event->isMasterRequest()) { if (!$event instanceof KernelEvent ? !$this->firstCall : !$event->isMasterRequest()) {
return; return;