Skip to content

Commit 4dca630

Browse files
committed
Remove deprecated overwrite() method
1 parent f751e05 commit 4dca630

File tree

3 files changed

+0
-71
lines changed

3 files changed

+0
-71
lines changed

README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,6 @@ A trailing newline will be added automatically.
9090
$stdio->writeln('hello world');
9191
```
9292

93-
[Deprecated] The `overwrite($text)` method can be used to overwrite/replace the last
94-
incomplete line with the given text:
95-
96-
```php
97-
$stdio->write('Loading…');
98-
// deprecated
99-
$stdio->overwrite('Done!');
100-
```
101-
10293
Alternatively, you can also use the `Stdio` as a writable stream.
10394
You can `pipe()` any readable stream into this stream.
10495

src/Stdio.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -170,20 +170,6 @@ public function writeln($line)
170170
$this->write($line . PHP_EOL);
171171
}
172172

173-
/**
174-
* @deprecated
175-
*/
176-
public function overwrite($data = '')
177-
{
178-
if ($this->incompleteLine !== '') {
179-
// move one line up, move to start of line and clear everything
180-
$data = "\033[A\r\033[K" . $data;
181-
$this->incompleteLine = '';
182-
}
183-
184-
$this->write($data);
185-
}
186-
187173
public function end($data = null)
188174
{
189175
if ($this->ending) {

tests/StdioTest.php

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -173,54 +173,6 @@ public function testWriteAfterReadlineInputWillClearReadlineWriteOutputAndRestor
173173
$this->assertEquals("\r\033[K" . "test\n" . "> input", $buffer);
174174
}
175175

176-
public function testOverwriteWillClearReadlineMoveToPreviousLineWriteOutputAndRestoreReadline()
177-
{
178-
$input = $this->getMockBuilder('React\Stream\ReadableStreamInterface')->getMock();
179-
$output = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();
180-
181-
//$readline = $this->getMockBuilder('Clue\React\Stdio\Readline')->disableOriginalConstructor()->getMock();
182-
$readline = new Readline($input, $output);
183-
$readline->setPrompt('> ');
184-
$readline->setInput('input');
185-
186-
$stdio = new Stdio($this->loop, $input, $output, $readline);
187-
188-
$stdio->write('first');
189-
190-
$buffer = '';
191-
$output->expects($this->any())->method('write')->will($this->returnCallback(function ($data) use (&$buffer) {
192-
$buffer .= $data;
193-
}));
194-
195-
$stdio->overwrite('overwrite');
196-
197-
$this->assertEquals("\r\033[K" . "\033[A" . "\r\033[K" . "overwrite\n" . "> input", $buffer);
198-
}
199-
200-
public function testOverwriteAfterNewlineWillClearReadlineAndWriteOutputAndRestoreReadline()
201-
{
202-
$input = $this->getMockBuilder('React\Stream\ReadableStreamInterface')->getMock();
203-
$output = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();
204-
205-
//$readline = $this->getMockBuilder('Clue\React\Stdio\Readline')->disableOriginalConstructor()->getMock();
206-
$readline = new Readline($input, $output);
207-
$readline->setPrompt('> ');
208-
$readline->setInput('input');
209-
210-
$stdio = new Stdio($this->loop, $input, $output, $readline);
211-
212-
$stdio->write("first\n");
213-
214-
$buffer = '';
215-
$output->expects($this->any())->method('write')->will($this->returnCallback(function ($data) use (&$buffer) {
216-
$buffer .= $data;
217-
}));
218-
219-
$stdio->overwrite('overwrite');
220-
221-
$this->assertEquals("\r\033[K" . "overwrite\n" . "> input", $buffer);
222-
}
223-
224176
public function testWriteLineWillClearReadlineWriteOutputAndRestoreReadline()
225177
{
226178
$input = $this->getMockBuilder('React\Stream\ReadableStreamInterface')->getMock();

0 commit comments

Comments
 (0)