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

Skip to content

Commit d47e984

Browse files
author
Robin Chalas
committed
[Console] Remove deprecated features
1 parent d5f0a26 commit d47e984

File tree

6 files changed

+20
-87
lines changed

6 files changed

+20
-87
lines changed

src/Symfony/Component/Console/Application.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@
4343
use Symfony\Component\Console\Style\SymfonyStyle;
4444
use Symfony\Component\Debug\ErrorHandler;
4545
use Symfony\Component\Debug\Exception\FatalThrowableError;
46-
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
47-
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
46+
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
4847

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

9493
/**
95-
* @final since Symfony 4.3, the type-hint will be updated to the interface from symfony/contracts in 5.0
94+
* @final
9695
*/
9796
public function setDispatcher(EventDispatcherInterface $dispatcher)
9897
{
99-
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
98+
$this->dispatcher = $dispatcher;
10099
}
101100

102101
public function setCommandLoader(CommandLoaderInterface $commandLoader)

src/Symfony/Component/Console/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
CHANGELOG
22
=========
33

4+
5.0.0
5+
-----
6+
7+
* removed `TableStyle::setCrossingChar()` method in favor of `TableStyle::setDefaultCrossingChar()`
8+
* removed `TableStyle::setHorizontalBorderChar()` method in favor of `TableStyle::setDefaultCrossingChars()`
9+
* removed `TableStyle::getHorizontalBorderChar()` method in favor of `TableStyle::getBorderChars()`
10+
* removed `TableStyle::setVerticalBorderChar()` method in favor of `TableStyle::setVerticalBorderChars()`
11+
* removed `TableStyle::getVerticalBorderChar()` method in favor of `TableStyle::getBorderChars()`
12+
* `ProcessHelper::run()` accepts only `array|Symfony\Component\Process\Process` for its `command` argument
13+
* `Application::setDispatcher` accepts only `Symfony\Contracts\EventDispatcher\EventDispatcherInterface`
14+
for its `dispatcher` argument
15+
416
4.3.0
517
-----
618

src/Symfony/Component/Console/Event/ConsoleEvent.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@
1414
use Symfony\Component\Console\Command\Command;
1515
use Symfony\Component\Console\Input\InputInterface;
1616
use Symfony\Component\Console\Output\OutputInterface;
17-
use Symfony\Component\EventDispatcher\Event;
1817

1918
/**
2019
* Allows to inspect input and output of a command.
2120
*
2221
* @author Francesco Levorato <[email protected]>
2322
*/
24-
class ConsoleEvent extends Event
23+
class ConsoleEvent
2524
{
2625
protected $command;
2726

src/Symfony/Component/Console/Helper/ProcessHelper.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
* @author Fabien Potencier <[email protected]>
2323
*
24-
* @final since Symfony 4.2
24+
* @final
2525
*/
2626
class ProcessHelper extends Helper
2727
{
@@ -50,8 +50,7 @@ public function run(OutputInterface $output, $cmd, $error = null, callable $call
5050
}
5151

5252
if (!\is_array($cmd)) {
53-
@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);
54-
$cmd = [\method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline($cmd) : new Process($cmd)];
53+
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)));
5554
}
5655

5756
if (\is_string($cmd[0] ?? null)) {

src/Symfony/Component/Console/Helper/TableStyle.php

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -101,36 +101,6 @@ public function setHorizontalBorderChars(string $outside, string $inside = null)
101101
return $this;
102102
}
103103

104-
/**
105-
* Sets horizontal border character.
106-
*
107-
* @param string $horizontalBorderChar
108-
*
109-
* @return $this
110-
*
111-
* @deprecated since Symfony 4.1, use {@link setHorizontalBorderChars()} instead.
112-
*/
113-
public function setHorizontalBorderChar($horizontalBorderChar)
114-
{
115-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setHorizontalBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
116-
117-
return $this->setHorizontalBorderChars($horizontalBorderChar, $horizontalBorderChar);
118-
}
119-
120-
/**
121-
* Gets horizontal border character.
122-
*
123-
* @return string
124-
*
125-
* @deprecated since Symfony 4.1, use {@link getBorderChars()} instead.
126-
*/
127-
public function getHorizontalBorderChar()
128-
{
129-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use getBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
130-
131-
return $this->horizontalOutsideBorderChar;
132-
}
133-
134104
/**
135105
* Sets vertical border characters.
136106
*
@@ -157,36 +127,6 @@ public function setVerticalBorderChars(string $outside, string $inside = null):
157127
return $this;
158128
}
159129

160-
/**
161-
* Sets vertical border character.
162-
*
163-
* @param string $verticalBorderChar
164-
*
165-
* @return $this
166-
*
167-
* @deprecated since Symfony 4.1, use {@link setVerticalBorderChars()} instead.
168-
*/
169-
public function setVerticalBorderChar($verticalBorderChar)
170-
{
171-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setVerticalBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
172-
173-
return $this->setVerticalBorderChars($verticalBorderChar, $verticalBorderChar);
174-
}
175-
176-
/**
177-
* Gets vertical border character.
178-
*
179-
* @return string
180-
*
181-
* @deprecated since Symfony 4.1, use {@link getBorderChars()} instead.
182-
*/
183-
public function getVerticalBorderChar()
184-
{
185-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use getBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
186-
187-
return $this->verticalOutsideBorderChar;
188-
}
189-
190130
/**
191131
* Gets border characters.
192132
*
@@ -259,22 +199,6 @@ public function setDefaultCrossingChar(string $char): self
259199
return $this->setCrossingChars($char, $char, $char, $char, $char, $char, $char, $char, $char);
260200
}
261201

262-
/**
263-
* Sets crossing character.
264-
*
265-
* @param string $crossingChar
266-
*
267-
* @return $this
268-
*
269-
* @deprecated since Symfony 4.1. Use {@link setDefaultCrossingChar()} instead.
270-
*/
271-
public function setCrossingChar($crossingChar)
272-
{
273-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1. Use setDefaultCrossingChar() instead.', __METHOD__), E_USER_DEPRECATED);
274-
275-
return $this->setDefaultCrossingChar($crossingChar);
276-
}
277-
278202
/**
279203
* Gets crossing character.
280204
*

src/Symfony/Component/Console/Output/ConsoleOutputInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
* This adds information about stderr and section output stream.
1717
*
1818
* @author Dariusz Górecki <[email protected]>
19-
*
20-
* @method ConsoleSectionOutput section() Creates a new output section
2119
*/
2220
interface ConsoleOutputInterface extends OutputInterface
2321
{
@@ -29,4 +27,6 @@ interface ConsoleOutputInterface extends OutputInterface
2927
public function getErrorOutput();
3028

3129
public function setErrorOutput(OutputInterface $error);
30+
31+
public function section(): ConsoleSectionOutput;
3232
}

0 commit comments

Comments
 (0)