-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Add an iterate method to the ProgressBar class #29753
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OskarStark
approved these changes
Jan 3, 2019
Updated the code to allow passing |
ro0NL
reviewed
Jan 4, 2019
e9d3f0b
to
c5e70ee
Compare
c5e70ee
to
223a232
Compare
nicolas-grekas
approved these changes
Jan 25, 2019
223a232
to
eb35531
Compare
chalasr
approved these changes
Jan 31, 2019
Thank you @jvasseur. |
chalasr
pushed a commit
that referenced
this pull request
Jan 31, 2019
…ss (jvasseur) This PR was merged into the 4.3-dev branch. Discussion ---------- [Console] Add an iterate method to the ProgressBar class | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | symfony/symfony-docs#10949 Add an iterate method to the `ProgressBar` class that simplify updating the progress bar when iterating over an `iterable`. Before: ```php $bar->start(); foreach ($iterable as $value) { // Process $value $bar->advance(); } $bar->finish(); ``` After: ```php foreach ($bar->iterate($iterable) as $value) { // Process $value } ``` Additionally if `$iterable` is countable, the progress bar max step will automatically set to its count. If it isn't countable, nothing is done (instead of setting it to 0) to allow passing a max independently before calling `iterate`. I will try to do the doc PR soon. Commits ------- eb35531 Add an iterate method to the ProgressBar class
javiereguiluz
added a commit
to symfony/symfony-docs
that referenced
this pull request
Feb 1, 2019
… method (jvasseur) This PR was merged into the master branch. Discussion ---------- [Console] Add documentation for the ProgressBar::iterate method Doc PR for symfony/symfony#29753 Commits ------- 5c0b716 [Console] Add documentation for the ProgressBar::iterate method
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add an iterate method to the
ProgressBar
class that simplify updating the progress bar when iterating over aniterable
.Before:
After:
Additionally if
$iterable
is countable, the progress bar max step will automatically set to its count. If it isn't countable, nothing is done (instead of setting it to 0) to allow passing a max independently before callingiterate
.I will try to do the doc PR soon.