Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e9d3f0b

Browse files
committed
Update ProgressBar::iterate to use is_countable
1 parent d63d1ac commit e9d3f0b

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"symfony/polyfill-ctype": "~1.8",
3333
"symfony/polyfill-intl-icu": "~1.0",
3434
"symfony/polyfill-mbstring": "~1.0",
35-
"symfony/polyfill-php72": "~1.5"
35+
"symfony/polyfill-php72": "~1.5",
36+
"symfony/polyfill-php73": "^1.8.0"
3637
},
3738
"replace": {
3839
"symfony/asset": "self.version",

src/Symfony/Component/Console/Helper/ProgressBar.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,7 @@ public function setRedrawFrequency(int $freq)
250250
*/
251251
public function iterate(iterable $iterable, ?int $max = null): iterable
252252
{
253-
if (null === $max) {
254-
$max = \is_array($iterable) || $iterable instanceof \Countable ? \count($iterable) : 0;
255-
}
256-
257-
$this->start($max);
253+
$this->start($max ?? (\is_countable($iterable) ? \count($iterable) : 0));
258254

259255
foreach ($iterable as $key => $value) {
260256
yield $key => $value;

src/Symfony/Component/Console/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"require": {
1919
"php": "^7.1.3",
2020
"symfony/contracts": "^1.0",
21-
"symfony/polyfill-mbstring": "~1.0"
21+
"symfony/polyfill-mbstring": "~1.0",
22+
"symfony/polyfill-php73": "^1.8.0"
2223
},
2324
"require-dev": {
2425
"symfony/config": "~3.4|~4.0",

0 commit comments

Comments
 (0)