-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Support ProgressBar::iterate()
on empty array
#52605
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could deprecate passing 0
for unknown max, but that's not necessary to fix the reported issue.
I create a branch with the deprecation, that we can discuss for 7.1: 6.4...GromNaN:symfony:issue-47259-deprecate
@@ -195,7 +195,7 @@ public function getStartTime(): int | |||
|
|||
public function getMaxSteps(): int | |||
{ | |||
return $this->max; | |||
return $this->max ?? 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->max
can be null
, but keep returning 0
for backward compatibility.
Co-authored-by: Florian Reimair <[email protected]>
Merging in 7.1 as this is a behavior change. |
Thank you @GromNaN. |
Alternative to #47259
Use
$max = null
to indicate that the value is unknown. This allows0
to be displayed by directly setting the progress bar to 100%.Zero is only supported for
iterate()
. When passed to the constructor orsetMaxSteps
, it means "unknown max".