File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
components/console/helpers Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -55,9 +55,20 @@ you can also set the current progress by calling the
5555 accordingly. By default, when using a ``max ``, the redraw frequency
5656 is set to *10% * of your ``max ``.
5757
58- If you don't know the number of steps in advance, just omit the steps argument
59- when creating the :class: `Symfony\\ Component\\ Console\\ Helper\\ ProgressBar `
60- instance::
58+ If you don't know the exact number of steps in advance, set it to a reasonable
59+ value and then call the ``setMaxSteps() `` method to update it as needed::
60+
61+ // start with a 50 units progressbar
62+ $progressBar = new ProgressBar($output, 50);
63+
64+ // a complex task has just been created: increase the progressbar to 200 units
65+ $progressBar->setMaxSteps(200);
66+
67+ .. versionadded :: 4.1
68+ The ``setMaxSteps() `` method was introduced in Symfony 4.1.
69+
70+ Another solution is to just omit the steps argument when creating the
71+ :class: `Symfony\\ Component\\ Console\\ Helper\\ ProgressBar ` instance::
6172
6273 $progressBar = new ProgressBar($output);
6374
You can’t perform that action at this time.
0 commit comments