Skip to content

Commit 2f93c8c

Browse files
committed
Merge branch '4.4' into 5.2
* 4.4: Fix incompatible implicit float-to-int conversions [Translation] Don't pass null to strtoupper() cs fix [DependencyInjection] Don't pass null to trim() Add return types to JsonSerializable implementations Fix Serializable deprecations triggered by token mocks Add missing security translations
2 parents 3685a3a + 9aa1eb4 commit 2f93c8c

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Helper/ProgressBar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function getProgressPercent(): float
196196

197197
public function getBarOffset(): float
198198
{
199-
return floor($this->max ? $this->percent * $this->barWidth : (null === $this->redrawFreq ? min(5, $this->barWidth / 15) * $this->writeCount : $this->step) % $this->barWidth);
199+
return floor($this->max ? $this->percent * $this->barWidth : (null === $this->redrawFreq ? (int) (min(5, $this->barWidth / 15) * $this->writeCount) : $this->step) % $this->barWidth);
200200
}
201201

202202
public function getEstimated(): float
@@ -270,7 +270,7 @@ public function setFormat(string $format)
270270
/**
271271
* Sets the redraw frequency.
272272
*
273-
* @param int|float $freq The frequency in steps
273+
* @param int|null $freq The frequency in steps
274274
*/
275275
public function setRedrawFrequency(?int $freq)
276276
{

Helper/Table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ private function renderRowSeparator(int $type = self::SEPARATOR_MID, string $tit
442442
$formattedTitle = sprintf($titleFormat, Helper::substr($title, 0, $limit - $formatLength - 3).'...');
443443
}
444444

445-
$titleStart = ($markupLength - $titleLength) / 2;
445+
$titleStart = intdiv($markupLength - $titleLength, 2);
446446
if (false === mb_detect_encoding($markup, null, true)) {
447447
$markup = substr_replace($markup, $formattedTitle, $titleStart, $titleLength);
448448
} else {

Tests/Helper/ProgressBarTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ public function testRedrawFrequencyIsAtLeastOneIfZeroGiven()
535535
public function testRedrawFrequencyIsAtLeastOneIfSmallerOneGiven()
536536
{
537537
$bar = new ProgressBar($output = $this->getOutputStream(), 0, 0);
538-
$bar->setRedrawFrequency(0.9);
538+
$bar->setRedrawFrequency(0);
539539
$bar->start();
540540
$bar->advance();
541541

0 commit comments

Comments
 (0)