Skip to content

Commit f121acd

Browse files
committed
Fix incompatible implicit float-to-int conversions
1 parent 6eead34 commit f121acd

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function getProgressPercent(): float
193193

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

199199
public function setBarWidth(int $size)

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

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

457-
$titleStart = ($markupLength - $titleLength) / 2;
457+
$titleStart = intdiv($markupLength - $titleLength, 2);
458458
if (false === mb_detect_encoding($markup, null, true)) {
459459
$markup = substr_replace($markup, $formattedTitle, $titleStart, $titleLength);
460460
} else {

src/Symfony/Component/Console/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

src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function testInvalidTtlConstruct()
7272
{
7373
$this->expectException(InvalidTtlException::class);
7474

75-
return new PdoStore('sqlite:'.self::$dbFile, [], 0.1, 0.1);
75+
return new PdoStore('sqlite:'.self::$dbFile, [], 0.1, 0);
7676
}
7777

7878
/**

src/Symfony/Component/VarDumper/Command/Descriptor/CliDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function describe(OutputInterface $output, Data $data, array $context, in
4242
$io = $output instanceof SymfonyStyle ? $output : new SymfonyStyle(new ArrayInput([]), $output);
4343
$this->dumper->setColors($output->isDecorated());
4444

45-
$rows = [['date', date('r', $context['timestamp'])]];
45+
$rows = [['date', date('r', (int) $context['timestamp'])]];
4646
$lastIdentifier = $this->lastIdentifier;
4747
$this->lastIdentifier = $clientId;
4848

src/Symfony/Component/VarDumper/Command/Descriptor/HtmlDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function describe(OutputInterface $output, Data $data, array $context, in
9494

9595
private function extractDate(array $context, string $format = 'r'): string
9696
{
97-
return date($format, $context['timestamp']);
97+
return date($format, (int) $context['timestamp']);
9898
}
9999

100100
private function renderTags(array $tags): string

src/Symfony/Component/Yaml/Tests/InlineTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ public function getTestsForDump()
525525
*/
526526
public function testParseTimestampAsUnixTimestampByDefault($yaml, $year, $month, $day, $hour, $minute, $second)
527527
{
528-
$this->assertSame(gmmktime($hour, $minute, $second, $month, $day, $year), Inline::parse($yaml));
528+
$this->assertSame(gmmktime($hour, $minute, (int) $second, $month, $day, $year), Inline::parse($yaml));
529529
}
530530

531531
/**
@@ -536,7 +536,7 @@ public function testParseTimestampAsDateTimeObject($yaml, $year, $month, $day, $
536536
$expected = new \DateTime($yaml);
537537
$expected->setTimeZone(new \DateTimeZone('UTC'));
538538
$expected->setDate($year, $month, $day);
539-
$expected->setTime($hour, $minute, $second, 1000000 * ($second - (int) $second));
539+
$expected->setTime($hour, $minute, (int) $second, (int) (1000000 * ($second - (int) $second)));
540540

541541
$date = Inline::parse($yaml, Yaml::PARSE_DATETIME);
542542
$this->assertEquals($expected, $date);
@@ -561,7 +561,7 @@ public function testParseNestedTimestampListAsDateTimeObject($yaml, $year, $mont
561561
$expected = new \DateTime($yaml);
562562
$expected->setTimeZone(new \DateTimeZone('UTC'));
563563
$expected->setDate($year, $month, $day);
564-
$expected->setTime($hour, $minute, $second, 1000000 * ($second - (int) $second));
564+
$expected->setTime($hour, $minute, (int) $second, (int) (1000000 * ($second - (int) $second)));
565565

566566
$expectedNested = ['nested' => [$expected]];
567567
$yamlNested = "{nested: [$yaml]}";

0 commit comments

Comments
 (0)