diff --git a/console.rst b/console.rst index 6ce7b4122ba..ae0499f2ff8 100644 --- a/console.rst +++ b/console.rst @@ -101,6 +101,10 @@ messages to the console):: '', ]); + // 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" $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