mirror of
https://github.com/danog/byte-stream.git
synced 2024-11-26 11:54:54 +01:00
Rename
This commit is contained in:
parent
010c215c4b
commit
4b7bd7b8ee
@ -5,13 +5,13 @@ use Amp\ByteStream\ResourceOutputStream;
|
||||
use Amp\ByteStream\ZlibOutputStream;
|
||||
use Amp\Loop;
|
||||
use function Amp\ByteStream\bufferEcho;
|
||||
use function Amp\ByteStream\readLine;
|
||||
use function Amp\ByteStream\prompt;
|
||||
|
||||
require __DIR__ . "/../vendor/autoload.php";
|
||||
|
||||
Loop::run(function () {
|
||||
yield bufferEcho("Hello from async PHP!\n");
|
||||
$question = yield readLine("What is your question? ");
|
||||
$question = yield prompt("What is your question? ");
|
||||
yield bufferEcho("I see your question is $question.\n");
|
||||
yield bufferEcho("\nUnfortunately, I'm just a small script and I can't answer that, feel free to contact us at #amphp on freenode though!\n\n");
|
||||
yield bufferEcho("Bye!\n\n");
|
||||
|
@ -177,9 +177,9 @@ function getStderr(): ResourceOutputStream
|
||||
|
||||
|
||||
/**
|
||||
* Buffered async readline function.
|
||||
* Buffered async version of the readline() function.
|
||||
*
|
||||
* Please note that this function will hungrily eat data from stdin,
|
||||
* Please note that this function will hungrily eat data from stdin,
|
||||
* buffering data even after the first newline.
|
||||
* Use getStdinLineReader()->getBuffer() to obtain the remaining buffered data.
|
||||
*
|
||||
@ -187,7 +187,7 @@ function getStderr(): ResourceOutputStream
|
||||
*
|
||||
* @return \Amp\Promise Will resolve with the read line
|
||||
*/
|
||||
function readLine(string $prompt = ''): Promise
|
||||
function prompt(string $prompt = ''): Promise
|
||||
{
|
||||
return call(static function () use ($prompt) {
|
||||
if ($prompt) {
|
||||
|
Loading…
Reference in New Issue
Block a user