From 4b7bd7b8eea88448bb11059de5b3f24a22ff10a8 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 22 Aug 2019 22:42:20 +0200 Subject: [PATCH] Rename --- examples/readline-echo.php | 4 ++-- lib/functions.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/readline-echo.php b/examples/readline-echo.php index 0b3d779..a4007a3 100644 --- a/examples/readline-echo.php +++ b/examples/readline-echo.php @@ -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"); diff --git a/lib/functions.php b/lib/functions.php index 7d06faa..9e39f85 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -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) {