From 92a468a4db8230ddc9df3af4c07b17d09ab608f6 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 15 May 2018 16:01:02 +0200 Subject: [PATCH 1/2] Documented the support of iterators in write() and writeln() --- console.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/console.rst b/console.rst index 6ce7b4122ba..06fa4dfddd7 100644 --- a/console.rst +++ b/console.rst @@ -101,6 +101,10 @@ messages to the console):: '', ]); + // the value returned by someMethod() can be an iterator that + // generates and returns the messages with the 'yield' PHP keyword + $output->writeln($this->someMethod()); + // outputs a message followed by a "\n" $output->writeln('Whoa!'); @@ -109,6 +113,10 @@ messages to the console):: $output->write('create a user.'); } +.. versionadded:: 4.1 + The support of PHP iterators in the ``write()`` and ``writeln()`` methods + was introduced in Symfony 4.1. + Now, try executing the command: .. code-block:: terminal From 6e2b88c6bea89e0bd4ed17714fdfb6fbcb0844c2 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 21 May 2018 17:18:38 +0200 Subject: [PATCH 2/2] Added a link to PHP's iterator article --- console.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/console.rst b/console.rst index 06fa4dfddd7..ae0499f2ff8 100644 --- a/console.rst +++ b/console.rst @@ -101,8 +101,8 @@ messages to the console):: '', ]); - // the value returned by someMethod() can be an iterator that - // generates and returns the messages with the 'yield' PHP keyword + // the value returned by someMethod() can be an iterator (https://secure.php.net/iterator) + // that generates and returns the messages with the 'yield' PHP keyword $output->writeln($this->someMethod()); // outputs a message followed by a "\n"