Skip to content

Commit 6aff5da

Browse files
jdreesenlyrixx
authored andcommitted
Add generics to the progress bar iteration methods
1 parent 0eb64cd commit 6aff5da

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Helper/ProgressBar.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,13 @@ public function maxSecondsBetweenRedraws(float $seconds): void
305305
/**
306306
* Returns an iterator that will automatically update the progress bar when iterated.
307307
*
308-
* @param int|null $max Number of steps to complete the bar (0 if indeterminate), if null it will be inferred from $iterable
308+
* @template TKey
309+
* @template TValue
310+
*
311+
* @param iterable<TKey, TValue> $iterable
312+
* @param int|null $max Number of steps to complete the bar (0 if indeterminate), if null it will be inferred from $iterable
313+
*
314+
* @return iterable<TKey, TValue>
309315
*/
310316
public function iterate(iterable $iterable, int $max = null): iterable
311317
{

Style/SymfonyStyle.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,14 @@ public function createProgressBar(int $max = 0): ProgressBar
327327

328328
/**
329329
* @see ProgressBar::iterate()
330+
*
331+
* @template TKey
332+
* @template TValue
333+
*
334+
* @param iterable<TKey, TValue> $iterable
335+
* @param int|null $max Number of steps to complete the bar (0 if indeterminate), if null it will be inferred from $iterable
336+
*
337+
* @return iterable<TKey, TValue>
330338
*/
331339
public function progressIterate(iterable $iterable, int $max = null): iterable
332340
{

0 commit comments

Comments
 (0)