8000 Documented the support of iterators in write() and writeln() by javiereguiluz · Pull Request #9776 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Documented the support of iterators in write() and writeln() #9776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Documented the support of iterators in write() and writeln()
  • Loading branch information
javiereguiluz committed May 15, 2018
commit 92a468a4db8230ddc9df3af4c07b17d09ab608f6
8 changes: 8 additions & 0 deletions console.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be an idea to mention the Iterator? http://php.net/manual/en/class.iterator.php Could hint towards yield support next to that, but yield is a more complex concept than just an iterator


// outputs a message followed by a "\n"
$output->writeln('Whoa!');

Expand All @@ -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
Expand Down
0