Skip to content

[Console] Remove deprecated code #31689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/Symfony/Component/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Debug\ErrorHandler;
use Symfony\Component\Debug\Exception\FatalThrowableError;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

/**
* An Application is the container for a collection of commands.
Expand Down Expand Up @@ -92,11 +91,11 @@ public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN
}

/**
* @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)
{
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
$this->dispatcher = $dispatcher;
}

public function setCommandLoader(CommandLoaderInterface $commandLoader)
Expand Down
12 changes: 12 additions & 0 deletions src/Symfony/Component/Console/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
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
-----

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Event/ConsoleEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
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.
Expand Down
5 changes: 2 additions & 3 deletions src/Symfony/Component/Console/Helper/ProcessHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final since Symfony 4.2
* @final
*/
class ProcessHelper extends Helper
{
Expand Down Expand Up @@ -50,8 +50,7 @@ public function run(OutputInterface $output, $cmd, $error = null, callable $call
}

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);
$cmd = [\method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline($cmd) : new Process($cmd)];
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)));
}

if (\is_string($cmd[0] ?? null)) {
Expand Down
76 changes: 0 additions & 76 deletions src/Symfony/Component/Console/Helper/TableStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,36 +101,6 @@ public function setHorizontalBorderChars(string $outside, string $inside = null)
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.
*
Expand All @@ -157,36 +127,6 @@ public function setVerticalBorderChars(string $outside, string $inside = null):
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.
*
Expand Down Expand Up @@ -259,22 +199,6 @@ public function setDefaultCrossingChar(string $char): self
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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
* This adds information about stderr and section output stream.
*
* @author Dariusz Górecki <darek.krk@gmail.com>
*
* @method ConsoleSectionOutput section() Creates a new output section
*/
interface ConsoleOutputInterface extends OutputInterface
{
Expand All @@ -29,4 +27,6 @@ interface ConsoleOutputInterface extends OutputInterface
public function getErrorOutput();

public function setErrorOutput(OutputInterface $error);

public function section(): ConsoleSectionOutput;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Debug\ErrorHandler;
use Symfony\Component\Debug\ExceptionHandler;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
use Symfony\Component\HttpKernel\Event\KernelEvent;
Expand Down Expand Up @@ -63,7 +62,7 @@ public function __construct(callable $exceptionHandler = null, LoggerInterface $
/**
* Configures the error handler.
*/
public function configure(Event $event = null)
public function configure(object $event = null)
{
if (!$event instanceof KernelEvent ? !$this->firstCall : !$event->isMasterRequest()) {
return;
Expand Down