Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
jvasseur commentedJan 3, 2019
Updated the code to allow passing |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
chalasr commentedJan 31, 2019
Thank you@jvasseur. |
…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#10949Add 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:```phpforeach ($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
… method (jvasseur)This PR was merged into the master branch.Discussion----------[Console] Add documentation for the ProgressBar::iterate methodDoc PR forsymfony/symfony#29753Commits-------5c0b716 [Console] Add documentation for the ProgressBar::iterate method
Uh oh!
There was an error while loading.Please reload this page.
Add an iterate method to the
ProgressBarclass that simplify updating the progress bar when iterating over aniterable.Before:
After:
Additionally if
$iterableis 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.