| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Improved; |
||
| 6 | |||
| 7 | /** |
||
| 8 | * Traverse over the iterator, not capturing the values. |
||
| 9 | * This is particularly useful after `iterable_apply()`. |
||
| 10 | * |
||
| 11 | * @param iterable $iterable |
||
| 12 | * @return void |
||
| 13 | */ |
||
| 14 | function iterable_walk(iterable $iterable): void |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 15 | { |
||
| 16 | 8 | if (is_array($iterable)) { |
|
| 17 | 1 | return; // No point walking over an array |
|
| 18 | } |
||
| 19 | |||
| 20 | /** @noinspection ALL */ |
||
| 21 | 7 | foreach ($iterable as $_) { |
|
| 22 | // nop |
||
| 23 | } |
||
| 24 | } |
||
| 25 |