Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged
chalasr merged 1 commit intosymfony:masterfromjvasseur:progress-iterate
Jan 31, 2019

Conversation

@jvasseur
Copy link
Contributor

@jvasseurjvasseur commentedJan 2, 2019
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets
LicenseMIT
Doc PRsymfony/symfony-docs#10949

Add an iterate method to theProgressBar class that simplify updating the progress bar when iterating over aniterable.

Before:

$bar->start();foreach ($iterableas$value) {// Process $value$bar->advance();}$bar->finish();

After:

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 callingiterate.

I will try to do the doc PR soon.

julienfalque, Koc, ro0NL, OskarStark, HeahDude, alterphp, linaori, kevin-verschaeve, hhamon, danabrey, and 6 more reacted with heart emoji
@jvasseur
Copy link
ContributorAuthor

Updated the code to allow passing$max as a second argument instead of allowing to set the max before callingiterate.

@chalasr
Copy link
Member

Thank you@jvasseur.

@chalasrchalasr merged commiteb35531 intosymfony:masterJan 31, 2019
chalasr pushed a commit that referenced this pull requestJan 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#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
@jvasseurjvasseur deleted the progress-iterate branchJanuary 31, 2019 10:25
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestFeb 1, 2019
… 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
@nicolas-grekasnicolas-grekas modified the milestones:next,4.3Apr 30, 2019
@fabpotfabpot mentioned this pull requestMay 9, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@OskarStarkOskarStarkOskarStark approved these changes

@chalasrchalasrchalasr approved these changes

+1 more reviewer

@ro0NLro0NLro0NL left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.3

Development

Successfully merging this pull request may close these issues.

6 participants

@jvasseur@chalasr@nicolas-grekas@OskarStark@ro0NL@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp