You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR was merged into the 6.4 branch.
Discussion
----------
Fix TypeError on ProgressBar
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix#54386
| License | MIT
`ProgressBar->getMessage()` returns null if the message is not defined
Commits
-------
adfe8df Fix TypeError on ProgressBar
Symfony version(s) affected
6.3.0-beta+
Description
When trying to obtain message from ProgressBar that was not set previously using
setMessage
, thegetMessage
method throws TypeError.The workaround is to catch the TypeError but it is not elegant solution.
How to reproduce
Possible Solution
ProgressBar->getMessage()
to?string
instead ofstring
, add$default
argument +?? $default
to the code.hasMessage(string $name = 'message')
to check if message is availableAdditional Context
I have custom service that updates the progress bar only if necessary and thus I have to check if message that was supplied differs from the one that is already set:
https://github.com/cojedzie/cojedzie/blob/master/api/src/DataImport/ConsoleProgressReporter.php#L52-L55
The text was updated successfully, but these errors were encountered: