8000 [ProgressBar] Empty iterable throws Exception on "maximum number of steps is not set" by freimair · Pull Request #47259 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[ProgressBar] Empty iterable throws Exception on "maximum number of steps is not set" #47259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Set max to int since it cannot be null
`max` value has been prepared to contain a `null` value, however,
the constructor with its default value of `max = 0` prevents
`$max` to ever be `null`.

Hence, declare `$max` as `int` instead of `?int`.
  • Loading branch information
freimair committed Aug 23, 2022
commit eac82fc22a299ee22defe44beb03e614c674065d
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Helper/ProgressBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ final class ProgressBar
private OutputInterface $output;
private int $step = 0;
private int $startingStep = 0;
private ?int $max = null;
private int $max = 0;
private int $startTime;
private int $stepWidth;
private float $percent = 0.0;
Expand Down
0