Skip to content

Commit 611af8f

Browse files
committed
Remove deprecated writeln() method
1 parent 4dca630 commit 611af8f

File tree

3 files changed

+3
-41
lines changed

3 files changed

+3
-41
lines changed

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,6 @@ $stdio->write('hello');
8282
$stdio->write(" world\n");
8383
```
8484

85-
[Deprecated] The `writeln($line)` method can be used to print a line to console output.
86-
A trailing newline will be added automatically.
87-
88-
```php
89-
// deprecated
90-
$stdio->writeln('hello world');
91-
```
92-
9385
Alternatively, you can also use the `Stdio` as a writable stream.
9486
You can `pipe()` any readable stream into this stream.
9587

src/Stdio.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,6 @@ public function write($data)
162162
}
163163
}
164164

165-
/**
166-
* @deprecated
167-
*/
168-
public function writeln($line)
169-
{
170-
$this->write($line . PHP_EOL);
171-
}
172-
173165
public function end($data = null)
174166
{
175167
if ($this->ending) {

tests/StdioTest.php

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -168,29 +168,7 @@ public function testWriteAfterReadlineInputWillClearReadlineWriteOutputAndRestor
168168
$buffer .= $data;
169169
}));
170170

171-
$stdio->writeln('test');
172-
173-
$this->assertEquals("\r\033[K" . "test\n" . "> input", $buffer);
174-
}
175-
176-
public function testWriteLineWillClearReadlineWriteOutputAndRestoreReadline()
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-
$buffer = '';
189-
$output->expects($this->any())->method('write')->will($this->returnCallback(function ($data) use (&$buffer) {
190-
$buffer .= $data;
191-
}));
192-
193-
$stdio->writeln('test');
171+
$stdio->write("test\n");
194172

195173
$this->assertEquals("\r\033[K" . "test\n" . "> input", $buffer);
196174
}
@@ -212,8 +190,8 @@ public function testWriteTwoLinesWillClearReadlineWriteOutputAndRestoreReadline(
212190
$buffer .= $data;
213191
}));
214192

215-
$stdio->writeln('hello');
216-
$stdio->writeln('world');
193+
$stdio->write("hello\n");
194+
$stdio->write("world\n");
217195

218196
$this->assertEquals("\r\033[K" . "hello\n" . "> input" . "\r\033[K" . "world\n" . "> input", $buffer);
219197
}

0 commit comments

Comments
 (0)