10000 minor #9471 [Console] Documented the setMaxSteps() method (javieregui… · symfony/symfony-docs@3d4a077 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d4a077

Browse files
committed
minor #9471 [Console] Documented the setMaxSteps() method (javiereguiluz)
This PR was squashed before being merged into the master branch (closes #9471). Discussion ---------- [Console] Documented the setMaxSteps() method This fixes #9461. Commits ------- 9a4265d [Console] Documented the setMaxSteps() method
2 parents 814d11a + 9a4265d commit 3d4a077

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

components/console/helpers/progressbar.rst

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff 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 Progres 3D95 sBar($output);
6374

0 commit comments

Comments
 (0)
0