Skip to content

Commit 4cde3b9

Browse files
committed
[Console] Remove deprecated features
1 parent 5ed9cb3 commit 4cde3b9

File tree

5 files changed

+7
-480
lines changed

5 files changed

+7
-480
lines changed

src/Symfony/Component/Console/Application.php

-70
Original file line numberDiff line numberDiff line change
@@ -733,70 +733,6 @@ public function renderException(\Exception $e, OutputInterface $output)
733733
}
734734
}
735735

736-
/**
737-
* Tries to figure out the terminal width in which this application runs.
738-
*
739-
* @return int|null
740-
*
741-
* @deprecated since version 3.2, to be removed in 4.0. Create a Terminal instance instead.
742-
*/
743-
protected function getTerminalWidth()
744-
{
745-
@trigger_error(sprintf('%s is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED);
746-
747-
return $this->terminal->getWidth();
748-
}
749-
750-
/**
751-
* Tries to figure out the terminal height in which this application runs.
752-
*
753-
* @return int|null
754-
*
755-
* @deprecated since version 3.2, to be removed in 4.0. Create a Terminal instance instead.
756-
*/
757-
protected function getTerminalHeight()
758-
{
759-
@trigger_error(sprintf('%s is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED);
760-
761-
return $this->terminal->getHeight();
762-
}
763-
764-
/**
765-
* Tries to figure out the terminal dimensions based on the current environment.
766-
*
767-
* @return array Array containing width and height
768-
*
769-
* @deprecated since version 3.2, to be removed in 4.0. Create a Terminal instance instead.
770-
*/
771-
public function getTerminalDimensions()
772-
{
773-
@trigger_error(sprintf('%s is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED);
774-
775-
return array($this->terminal->getWidth(), $this->terminal->getHeight());
776-
}
777-
778-
/**
779-
* Sets terminal dimensions.
780-
*
781-
* Can be useful to force terminal dimensions for functional tests.
782-
*
783-
* @param int $width The width
784-
* @param int $height The height
785-
*
786-
* @return $this
787-
*
788-
* @deprecated since version 3.2, to be removed in 4.0. Set the COLUMNS and LINES env vars instead.
789-
*/
790-
public function setTerminalDimensions($width, $height)
791-
{
792-
@trigger_error(sprintf('%s is deprecated as of 3.2 and will be removed in 4.0. Set the COLUMNS and LINES env vars instead.', __METHOD__), E_USER_DEPRECATED);
793-
794-
putenv('COLUMNS='.$width);
795-
putenv('LINES='.$height);
796-
797-
return $this;
798-
}
799-
800736
/**
801737
* Configures the input and output instances based on the user arguments and options.
802738
*
@@ -820,12 +756,6 @@ protected function configureIO(InputInterface $input, OutputInterface $output)
820756
$inputStream = $input->getStream();
821757
}
822758

823-
// This check ensures that calling QuestionHelper::setInputStream() works
824-
// To be removed in 4.0 (in the same time as QuestionHelper::setInputStream)
825-
if (!$inputStream && $this->getHelperSet()->has('question')) {
826-
$inputStream = $this->getHelperSet()->get('question')->getInputStream(false);
827-
}
828-
829759
if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
830760
$input->setInteractive(false);
831761
}

src/Symfony/Component/Console/CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
CHANGELOG
22
=========
33

4+
4.0.0
5+
-----
6+
7+
* removed `QuestionHelper::setInputStream()/getInputStream()`
8+
* removed `Application::getTerminalWidth()/getTerminalHeight()` and
9+
`Application::setTerminalDimensions()/getTerminalDimensions()`
10+
411
3.3.0
512
-----
613

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

-41
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Console\Helper;
1313

14-
use Symfony\Component\Console\Exception\InvalidArgumentException;
1514
use Symfony\Component\Console\Exception\RuntimeException;
1615
use Symfony\Component\Console\Input\InputInterface;
1716
use Symfony\Component\Console\Input\StreamableInputInterface;
@@ -68,46 +67,6 @@ public function ask(InputInterface $input, OutputInterface $output, Question $qu
6867
return $this->validateAttempts($interviewer, $output, $question);
6968
}
7069

71-
/**
72-
* Sets the input stream to read from when interacting with the user.
73-
*
74-
* This is mainly useful for testing purpose.
75-
*
76-
* @deprecated since version 3.2, to be removed in 4.0. Use
77-
* StreamableInputInterface::setStream() instead.
78-
*
79-
* @param resource $stream The input stream
80-
*
81-
* @throws InvalidArgumentException In case the stream is not a resource
82-
*/
83-
public function setInputStream($stream)
84-
{
85-
@trigger_error(sprintf('The %s() method is deprecated since version 3.2 and will be removed in 4.0. Use %s::setStream() instead.', __METHOD__, StreamableInputInterface::class), E_USER_DEPRECATED);
86-
87-
if (!is_resource($stream)) {
88-
throw new InvalidArgumentException('Input stream must be a valid resource.');
89-
}
90-
91-
$this->inputStream = $stream;
92-
}
93-
94-
/**
95-
* Returns the helper's input stream.
96-
*
97-
* @deprecated since version 3.2, to be removed in 4.0. Use
98-
* StreamableInputInterface::getStream() instead.
99-
*
100-
* @return resource
101-
*/
102-
public function getInputStream()
103-
{
104-
if (0 === func_num_args() || func_get_arg(0)) {
105-
@trigger_error(sprintf('The %s() method is deprecated since version 3.2 and will be removed in 4.0. Use %s::getStream() instead.', __METHOD__, StreamableInputInterface::class), E_USER_DEPRECATED);
106-
}
107-
108-
return $this->inputStream;
109-
}
110-
11170
/**
11271
* {@inheritdoc}
11372
*/

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

-18
Original file line numberDiff line numberDiff line change
@@ -1287,24 +1287,6 @@ public function testRunWithDispatcherAddingInputOptions()
12871287
$this->assertEquals('some test value', $extraValue);
12881288
}
12891289

1290-
/**
1291-
* @group legacy
1292-
*/
1293-
public function testTerminalDimensions()
1294-
{
1295-
$application = new Application();
1296-
$originalDimensions = $application->getTerminalDimensions();
1297-
$this->assertCount(2, $originalDimensions);
1298-
1299-
$width = 80;
1300-
if ($originalDimensions[0] == $width) {
1301-
$width = 100;
1302-
}
1303-
1304-
$application->setTerminalDimensions($width, 80);
1305-
$this->assertSame(array($width, 80), $application->getTerminalDimensions());
1306-
}
1307-
13081290
public function testSetRunCustomDefaultCommand()
13091291
{
13101292
$command = new \FooCommand();

0 commit comments

Comments
 (0)