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
This commit is contained in:
commit
4d25c4cbab
@ -196,7 +196,7 @@ final class ProgressBar
|
||||
|
||||
public function getBarOffset(): float
|
||||
{
|
||||
return floor($this->max ? $this->percent * $this->barWidth : (null === $this->redrawFreq ? min(5, $this->barWidth / 15) * $this->writeCount : $this->step) % $this->barWidth);
|
||||
return floor($this->max ? $this->percent * $this->barWidth : (null === $this->redrawFreq ? (int) (min(5, $this->barWidth / 15) * $this->writeCount) : $this->step) % $this->barWidth);
|
||||
}
|
||||
|
||||
public function getEstimated(): float
|
||||
@ -270,7 +270,7 @@ final class ProgressBar
|
||||
/**
|
||||
* Sets the redraw frequency.
|
||||
*
|
||||
* @param int|float $freq The frequency in steps
|
||||
* @param int|null $freq The frequency in steps
|
||||
*/
|
||||
public function setRedrawFrequency(?int $freq)
|
||||
{
|
||||
|
@ -442,7 +442,7 @@ class Table
|
||||
$formattedTitle = sprintf($titleFormat, Helper::substr($title, 0, $limit - $formatLength - 3).'...');
|
||||
}
|
||||
|
||||
$titleStart = ($markupLength - $titleLength) / 2;
|
||||
$titleStart = intdiv($markupLength - $titleLength, 2);
|
||||
if (false === mb_detect_encoding($markup, null, true)) {
|
||||
$markup = substr_replace($markup, $formattedTitle, $titleStart, $titleLength);
|
||||
} else {
|
||||
|
@ -535,7 +535,7 @@ And, as in uffish thought he stood, The Jabberwock, with eyes of flame, Came whi
|
||||
public function testRedrawFrequencyIsAtLeastOneIfSmallerOneGiven()
|
||||
{
|
||||
$bar = new ProgressBar($output = $this->getOutputStream(), 0, 0);
|
||||
$bar->setRedrawFrequency(0.9);
|
||||
$bar->setRedrawFrequency(0);
|
||||
$bar->start();
|
||||
$bar->advance();
|
||||
|
||||
|
@ -2224,7 +2224,9 @@ EOF;
|
||||
$classes[] = trim($tag['class'], '\\');
|
||||
}
|
||||
|
||||
$classes[] = trim($definition->getClass(), '\\');
|
||||
if ($class = $definition->getClass()) {
|
||||
$classes[] = trim($class, '\\');
|
||||
}
|
||||
$factory = $definition->getFactory();
|
||||
|
||||
if (!\is_array($factory)) {
|
||||
@ -2241,6 +2243,6 @@ EOF;
|
||||
$definition = $factory[0];
|
||||
}
|
||||
|
||||
return array_filter($classes);
|
||||
return $classes;
|
||||
}
|
||||
}
|
||||
|
@ -251,9 +251,6 @@ class JsonResponseTest extends TestCase
|
||||
{
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessage('This error is expected');
|
||||
if (!interface_exists(\JsonSerializable::class, false)) {
|
||||
$this->markTestSkipped('JsonSerializable is required.');
|
||||
}
|
||||
|
||||
$serializable = new JsonSerializableObject();
|
||||
|
||||
@ -299,12 +296,10 @@ class JsonResponseTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
if (interface_exists(\JsonSerializable::class, false)) {
|
||||
class JsonSerializableObject implements \JsonSerializable
|
||||
class JsonSerializableObject implements \JsonSerializable
|
||||
{
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
public function jsonSerialize()
|
||||
{
|
||||
throw new \Exception('This error is expected');
|
||||
}
|
||||
throw new \Exception('This error is expected');
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class PdoStoreTest extends AbstractStoreTest
|
||||
{
|
||||
$this->expectException(InvalidTtlException::class);
|
||||
|
||||
return new PdoStore('sqlite:'.self::$dbFile, [], 0.1, 0.1);
|
||||
return new PdoStore('sqlite:'.self::$dbFile, [], 0.1, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,6 +70,14 @@
|
||||
<source>Invalid or expired login link.</source>
|
||||
<target>Link za prijavu je isteako ili je neispravan.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="19">
|
||||
<source>Too many failed login attempts, please try again in %minutes% minute.</source>
|
||||
<target>Previše neuspjelih pokušaja prijave, molim pokušajte ponovo za %minutes% minutu.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="20">
|
||||
<source>Too many failed login attempts, please try again in %minutes% minutes.</source>
|
||||
<target>Previše neuspjelih pokušaja prijave, molim pokušajte ponovo za %minutes% minutu.|Previše neuspjelih pokušaja prijave, molim pokušajte ponovo za %minutes% minute.|Previše neuspjelih pokušaja prijave, molim pokušajte ponovo za %minutes% minuta.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
@ -13,7 +13,7 @@ namespace Symfony\Component\Serializer\Tests\Fixtures;
|
||||
|
||||
class JsonSerializableDummy implements \JsonSerializable
|
||||
{
|
||||
public function jsonSerialize()
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
'foo' => 'a',
|
||||
|
@ -81,7 +81,7 @@ class XliffFileLoader implements LoaderInterface
|
||||
private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain)
|
||||
{
|
||||
$xml = simplexml_import_dom($dom);
|
||||
$encoding = strtoupper($dom->encoding);
|
||||
$encoding = $dom->encoding ? strtoupper($dom->encoding) : null;
|
||||
|
||||
$namespace = 'urn:oasis:names:tc:xliff:document:1.2';
|
||||
$xml->registerXPathNamespace('xliff', $namespace);
|
||||
|
@ -42,7 +42,7 @@ class CliDescriptor implements DumpDescriptorInterface
|
||||
$io = $output instanceof SymfonyStyle ? $output : new SymfonyStyle(new ArrayInput([]), $output);
|
||||
$this->dumper->setColors($output->isDecorated());
|
||||
|
||||
$rows = [['date', date('r', $context['timestamp'])]];
|
||||
$rows = [['date', date('r', (int) $context['timestamp'])]];
|
||||
$lastIdentifier = $this->lastIdentifier;
|
||||
$this->lastIdentifier = $clientId;
|
||||
|
||||
|
@ -94,7 +94,7 @@ HTML
|
||||
|
||||
private function extractDate(array $context, string $format = 'r'): string
|
||||
{
|
||||
return date($format, $context['timestamp']);
|
||||
return date($format, (int) $context['timestamp']);
|
||||
}
|
||||
|
||||
private function renderTags(array $tags): string
|
||||
|
@ -526,7 +526,7 @@ class InlineTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getTimestampTests
|
||||
*/
|
||||
public function testParseTimestampAsUnixTimestampByDefault($yaml, $year, $month, $day, $hour, $minute, $second)
|
||||
public function testParseTimestampAsUnixTimestampByDefault(string $yaml, int $year, int $month, int $day, int $hour, int $minute, int $second)
|
||||
{
|
||||
$this->assertSame(gmmktime($hour, $minute, $second, $month, $day, $year), Inline::parse($yaml));
|
||||
}
|
||||
@ -534,37 +534,37 @@ class InlineTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getTimestampTests
|
||||
*/
|
||||
public function testParseTimestampAsDateTimeObject($yaml, $year, $month, $day, $hour, $minute, $second, $timezone)
|
||||
public function testParseTimestampAsDateTimeObject(string $yaml, int $year, int $month, int $day, int $hour, int $minute, int $second, int $microsecond, string $timezone)
|
||||
{
|
||||
$expected = new \DateTime($yaml);
|
||||
$expected->setTimeZone(new \DateTimeZone('UTC'));
|
||||
$expected->setDate($year, $month, $day);
|
||||
$expected->setTime($hour, $minute, $second, 1000000 * ($second - (int) $second));
|
||||
$expected->setTime($hour, $minute, $second, $microsecond);
|
||||
|
||||
$date = Inline::parse($yaml, Yaml::PARSE_DATETIME);
|
||||
$this->assertEquals($expected, $date);
|
||||
$this->assertSame($timezone, $date->format('O'));
|
||||
}
|
||||
|
||||
public function getTimestampTests()
|
||||
public function getTimestampTests(): array
|
||||
{
|
||||
return [
|
||||
'canonical' => ['2001-12-15T02:59:43.1Z', 2001, 12, 15, 2, 59, 43.1, '+0000'],
|
||||
'ISO-8601' => ['2001-12-15t21:59:43.10-05:00', 2001, 12, 16, 2, 59, 43.1, '-0500'],
|
||||
'spaced' => ['2001-12-15 21:59:43.10 -5', 2001, 12, 16, 2, 59, 43.1, '-0500'],
|
||||
'date' => ['2001-12-15', 2001, 12, 15, 0, 0, 0, '+0000'],
|
||||
'canonical' => ['2001-12-15T02:59:43.1Z', 2001, 12, 15, 2, 59, 43, 100000, '+0000'],
|
||||
'ISO-8601' => ['2001-12-15t21:59:43.10-05:00', 2001, 12, 16, 2, 59, 43, 100000, '-0500'],
|
||||
'spaced' => ['2001-12-15 21:59:43.10 -5', 2001, 12, 16, 2, 59, 43, 100000, '-0500'],
|
||||
'date' => ['2001-12-15', 2001, 12, 15, 0, 0, 0, 0, '+0000'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getTimestampTests
|
||||
*/
|
||||
public function testParseNestedTimestampListAsDateTimeObject($yaml, $year, $month, $day, $hour, $minute, $second)
|
||||
public function testParseNestedTimestampListAsDateTimeObject(string $yaml, int $year, int $month, int $day, int $hour, int $minute, int $second, int $microsecond)
|
||||
{
|
||||
$expected = new \DateTime($yaml);
|
||||
$expected->setTimeZone(new \DateTimeZone('UTC'));
|
||||
$expected->setDate($year, $month, $day);
|
||||
$expected->setTime($hour, $minute, $second, 1000000 * ($second - (int) $second));
|
||||
$expected->setTime($hour, $minute, $second, $microsecond);
|
||||
|
||||
$expectedNested = ['nested' => [$expected]];
|
||||
$yamlNested = "{nested: [$yaml]}";
|
||||
|
Reference in New Issue
Block a user