Merge branch '3.4' into 4.3

* 3.4:
  Fix typo
  Fix unitialized variable in DeprecationErrorHandler
  fix Danish translations
  Added the missing translations for the Slovak 'sk' locale.
  Fix negative DateInterval
This commit is contained in:
Nicolas Grekas 2019-08-09 13:45:54 +02:00
commit ece1532f27
8 changed files with 223 additions and 126 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env php
<?php
// Cache-Id: https://github.com/symfony/phpunit-bridge/commit/6ce862d9166ac77f611cc97789e91cb4f51f0021
// Cache-Id: 2019-08-09 13:00 UTC
if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\nPlease run `composer update` before running this command.\n";

View File

@ -76,7 +76,6 @@ class DeprecationErrorHandler
}
self::$utilPrefix = class_exists('PHPUnit_Util_ErrorHandler') ? 'PHPUnit_Util_' : 'PHPUnit\Util\\';
self::$isAtLeastPhpUnit83 = method_exists('PHPUnit\Util\ErrorHandler', '__invoke');
$handler = new self();
$oldErrorHandler = set_error_handler([$handler, 'handleError']);
@ -318,6 +317,9 @@ class DeprecationErrorHandler
private static function getPhpUnitErrorHandler()
{
if (!isset(self::$isAtLeastPhpUnit83)) {
self::$isAtLeastPhpUnit83 = class_exists(ErrorHandler::class) && method_exists(ErrorHandler::class, '__invoke');
}
if (!self::$isAtLeastPhpUnit83) {
return (class_exists('PHPUnit_Util_ErrorHandler', false) ? 'PHPUnit_Util_' : 'PHPUnit\Util\\').'ErrorHandler::handleError';
}

View File

@ -10,7 +10,7 @@
*/
// Please update when phpunit needs to be reinstalled with fresh deps:
// Cache-Id-Version: 2019-07-04 18:00 UTC
// Cache-Id: 2019-08-09 13:00 UTC
error_reporting(-1);

View File

@ -14,122 +14,6 @@
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
<target>CSRF-token er ugyldig.</target>
</trans-unit>
<trans-unit id="64">
<source>This value is not a valid currency.</source>
<target>Denne værdi er ikke en gyldig valuta.</target>
</trans-unit>
<trans-unit id="65">
<source>This value should be equal to {{ compared_value }}.</source>
<target>Denne værdi skal være lig med {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="66">
<source>This value should be greater than {{ compared_value }}.</source>
<target>Denne værdi skal være større end {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="67">
<source>This value should be greater than or equal to {{ compared_value }}.</source>
<target>Denne værdi skal være større end eller lig med {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="68">
<source>This value should be identical to {{ compared_value_type }} {{ compared_value }}.</source>
<target>Denne værdi skal være identisk med {{ compared_value_type }} {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="69">
<source>This value should be less than {{ compared_value }}.</source>
<target>Denne værdi skal være mindre end {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="70">
<source>This value should be less than or equal to {{ compared_value }}.</source>
<target>Denne værdi skal være mindre end eller lig med {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="71">
<source>This value should not be equal to {{ compared_value }}.</source>
<target>Denne værdi bør ikke være lig med {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="72">
<source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source>
<target>Denne værdi bør ikke være identisk med {{ compared_value_type }} {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="73">
<source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source>
<target>Billedforholdet er for stort ({{ratio}}). Tilladt maksimumsforhold er {{ max_ratio }}.</target>
</trans-unit>
<trans-unit id="74">
<source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source>
<target>Billedforholdet er for lille ({{ ratio }}). Minimumsforventet forventet er {{ min_ratio }}.</target>
</trans-unit>
<trans-unit id="75">
<source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source>
<target>Billedet er firkantet ({{ width }} x {{ height }} px). Firkantede billeder er ikke tilladt.</target>
</trans-unit>
<trans-unit id="76">
<source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source>
<target>Billedet er landskabsorienteret ({{width}} x {{height}} px). Landskabsorienterede billeder er ikke tilladt</target>
</trans-unit>
<trans-unit id="77">
<source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source>
<target>Billedet er portrætorienteret ({{ width }}x{{ height }}px). Portrætorienterede billeder er ikke tilladt.</target>
</trans-unit>
<trans-unit id="78">
<source>An empty file is not allowed.</source>
<target>En tom fil er ikke tilladt.</target>
</trans-unit>
<trans-unit id="79">
<source>The host could not be resolved.</source>
<target>Værten kunne ikke løses.</target>
</trans-unit>
<trans-unit id="80">
<source>This value does not match the expected {{ charset }} charset.</source>
<target>Denne værdi stemmer ikke overens med den forventede {{ charset }} charset.</target>
</trans-unit>
<trans-unit id="81">
<source>This is not a valid Business Identifier Code (BIC).</source>
<target>Dette er ikke en gyldig Business Identifier Code (BIC).a</target>
</trans-unit>
<trans-unit id="83">
<source>This is not a valid UUID.</source>
<target>Dette er ikke en gyldig UUID.</target>
</trans-unit>
<trans-unit id="84">
<source>This value should be a multiple of {{ compared_value }}.</source>
<target>Denne værdi skal være et flertal af {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="85">
<source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source>
<target>Denne Business Identifier Code (BIC) er ikke forbundet med IBAN {{ iban }}.</target>
</trans-unit>
<trans-unit id="86">
<source>This value should be valid JSON.</source>
<target>Denne værdi skal være gyldig JSON.</target>
</trans-unit>
<trans-unit id="87">
<source>This collection should contain only unique elements.</source>
<target>Denne samling bør kun indeholde unikke elementer.</target>
</trans-unit>
<trans-unit id="88">
<source>This value should be positive.</source>
<target>Denne værdi skal være positiv.</target>
</trans-unit>
<trans-unit id="89">
<source>This value should be either positive or zero.</source>
<target>Denne værdi skal være enten positiv eller nul.</target>
</trans-unit>
<trans-unit id="90">
<source>This value should be negative.</source>
<target>Denne værdi skal være negativ.</target>
</trans-unit>
<trans-unit id="91">
<source>This value should be either negative or zero.</source>
<target>Denne værdi skal være enten negativ eller nul.</target>
</trans-unit>
<trans-unit id="92">
<source>This value is not a valid timezone.</source>
<target>Denne værdi er ikke en gyldig tidszone.</target>
</trans-unit>
<trans-unit id="93">
<source>This password has been leaked in a data breach, it must not be used. Please use another password.</source>
<target>Denne adgangskode er blevet lækket i et databrud, det må ikke bruges. Brug venligst en anden adgangskode.</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -25,7 +25,7 @@ class DateIntervalNormalizer implements NormalizerInterface, DenormalizerInterfa
const FORMAT_KEY = 'dateinterval_format';
private $defaultContext = [
self::FORMAT_KEY => 'P%yY%mM%dDT%hH%iM%sS',
self::FORMAT_KEY => '%rP%yY%mM%dDT%hH%iM%sS',
];
/**
@ -90,12 +90,34 @@ class DateIntervalNormalizer implements NormalizerInterface, DenormalizerInterfa
$dateIntervalFormat = $context[self::FORMAT_KEY] ?? $this->defaultContext[self::FORMAT_KEY];
$valuePattern = '/^'.preg_replace('/%([yYmMdDhHiIsSwW])(\w)/', '(?P<$1>\d+)$2', $dateIntervalFormat).'$/';
$signPattern = '';
switch (substr($dateIntervalFormat, 0, 2)) {
case '%R':
$signPattern = '[-+]';
$dateIntervalFormat = substr($dateIntervalFormat, 2);
break;
case '%r':
$signPattern = '-?';
$dateIntervalFormat = substr($dateIntervalFormat, 2);
break;
}
$valuePattern = '/^'.$signPattern.preg_replace('/%([yYmMdDhHiIsSwW])(\w)/', '(?P<$1>\d+)$2', $dateIntervalFormat).'$/';
if (!preg_match($valuePattern, $data)) {
throw new UnexpectedValueException(sprintf('Value "%s" contains intervals not accepted by format "%s".', $data, $dateIntervalFormat));
}
try {
if ('-' === $data[0]) {
$interval = new \DateInterval(substr($data, 1));
$interval->invert = 1;
return $interval;
}
if ('+' === $data[0]) {
return new \DateInterval(substr($data, 1));
}
return new \DateInterval($data);
} catch (\Exception $e) {
throw new UnexpectedValueException($e->getMessage(), $e->getCode(), $e);
@ -112,6 +134,6 @@ class DateIntervalNormalizer implements NormalizerInterface, DenormalizerInterfa
private function isISO8601($string)
{
return preg_match('/^P(?=\w*(?:\d|%\w))(?:\d+Y|%[yY]Y)?(?:\d+M|%[mM]M)?(?:(?:\d+D|%[dD]D)|(?:\d+W|%[wW]W))?(?:T(?:\d+H|[hH]H)?(?:\d+M|[iI]M)?(?:\d+S|[sS]S)?)?$/', $string);
return preg_match('/^[\-+]?P(?=\w*(?:\d|%\w))(?:\d+Y|%[yY]Y)?(?:\d+M|%[mM]M)?(?:(?:\d+D|%[dD]D)|(?:\d+W|%[wW]W))?(?:T(?:\d+H|[hH]H)?(?:\d+M|[iI]M)?(?:\d+S|[sS]S)?)?$/', $string);
}
}

View File

@ -29,6 +29,11 @@ class DateIntervalNormalizerTest extends TestCase
['P%yY%mM%dDT%hH%iM', 'P10Y2M3DT16H5M', 'P10Y2M3DT16H5M'],
['P%yY%mM%dDT%hH', 'P10Y2M3DT16H', 'P10Y2M3DT16H'],
['P%yY%mM%dD', 'P10Y2M3D', 'P10Y2M3DT0H'],
['%RP%yY%mM%dD', '-P10Y2M3D', '-P10Y2M3DT0H'],
['%RP%yY%mM%dD', '+P10Y2M3D', '+P10Y2M3DT0H'],
['%RP%yY%mM%dD', '+P10Y2M3D', 'P10Y2M3DT0H'],
['%rP%yY%mM%dD', '-P10Y2M3D', '-P10Y2M3DT0H'],
['%rP%yY%mM%dD', 'P10Y2M3D', 'P10Y2M3DT0H'],
];
return $data;
@ -50,7 +55,7 @@ class DateIntervalNormalizerTest extends TestCase
*/
public function testNormalizeUsingFormatPassedInContext($format, $output, $input)
{
$this->assertEquals($output, $this->normalizer->normalize(new \DateInterval($input), null, [DateIntervalNormalizer::FORMAT_KEY => $format]));
$this->assertEquals($output, $this->normalizer->normalize($this->getInterval($input), null, [DateIntervalNormalizer::FORMAT_KEY => $format]));
}
/**
@ -72,7 +77,7 @@ class DateIntervalNormalizerTest extends TestCase
private function doTestNormalizeUsingFormatPassedInConstructor($format, $output, $input, bool $legacy = false)
{
$normalizer = $legacy ? new DateIntervalNormalizer($format) : new DateIntervalNormalizer([DateIntervalNormalizer::FORMAT_KEY => $format]);
$this->assertEquals($output, $normalizer->normalize(new \DateInterval($input)));
$this->assertEquals($output, $normalizer->normalize($this->getInterval($input)));
}
public function testNormalizeInvalidObjectThrowsException()
@ -98,7 +103,7 @@ class DateIntervalNormalizerTest extends TestCase
*/
public function testDenormalizeUsingFormatPassedInContext($format, $input, $output)
{
$this->assertDateIntervalEquals(new \DateInterval($output), $this->normalizer->denormalize($input, \DateInterval::class, null, [DateIntervalNormalizer::FORMAT_KEY => $format]));
$this->assertDateIntervalEquals($this->getInterval($output), $this->normalizer->denormalize($input, \DateInterval::class, null, [DateIntervalNormalizer::FORMAT_KEY => $format]));
}
/**
@ -120,7 +125,7 @@ class DateIntervalNormalizerTest extends TestCase
private function doTestDenormalizeUsingFormatPassedInConstructor($format, $input, $output, bool $legacy = false)
{
$normalizer = $legacy ? new DateIntervalNormalizer($format) : new DateIntervalNormalizer([DateIntervalNormalizer::FORMAT_KEY => $format]);
$this->assertDateIntervalEquals(new \DateInterval($output), $normalizer->denormalize($input, \DateInterval::class));
$this->assertDateIntervalEquals($this->getInterval($output), $normalizer->denormalize($input, \DateInterval::class));
}
public function testDenormalizeExpectsString()
@ -152,4 +157,20 @@ class DateIntervalNormalizerTest extends TestCase
{
$this->assertEquals($expected->format('%RP%yY%mM%dDT%hH%iM%sS'), $actual->format('%RP%yY%mM%dDT%hH%iM%sS'));
}
private function getInterval($data)
{
if ('-' === $data[0]) {
$interval = new \DateInterval(substr($data, 1));
$interval->invert = 1;
return $interval;
}
if ('+' === $data[0]) {
return new \DateInterval(substr($data, 1));
}
return new \DateInterval($data);
}
}

View File

@ -242,10 +242,126 @@
<source>This value is not a valid ISSN.</source>
<target>Værdien er ikke en gyldig ISSN.</target>
</trans-unit>
<trans-unit id="64">
<source>This value is not a valid currency.</source>
<target>Denne værdi er ikke en gyldig valuta.</target>
</trans-unit>
<trans-unit id="65">
<source>This value should be equal to {{ compared_value }}.</source>
<target>Denne værdi skal være lig med {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="66">
<source>This value should be greater than {{ compared_value }}.</source>
<target>Denne værdi skal være større end {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="67">
<source>This value should be greater than or equal to {{ compared_value }}.</source>
<target>Denne værdi skal være større end eller lig med {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="68">
<source>This value should be identical to {{ compared_value_type }} {{ compared_value }}.</source>
<target>Denne værdi skal være identisk med {{ compared_value_type }} {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="69">
<source>This value should be less than {{ compared_value }}.</source>
<target>Denne værdi skal være mindre end {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="70">
<source>This value should be less than or equal to {{ compared_value }}.</source>
<target>Denne værdi skal være mindre end eller lig med {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="71">
<source>This value should not be equal to {{ compared_value }}.</source>
<target>Denne værdi bør ikke være lig med {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="72">
<source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source>
<target>Denne værdi bør ikke være identisk med {{ compared_value_type }} {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="73">
<source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source>
<target>Billedforholdet er for stort ({{ratio}}). Tilladt maksimumsforhold er {{ max_ratio }}.</target>
</trans-unit>
<trans-unit id="74">
<source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source>
<target>Billedforholdet er for lille ({{ ratio }}). Minimumsforventet forventet er {{ min_ratio }}.</target>
</trans-unit>
<trans-unit id="75">
<source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source>
<target>Billedet er firkantet ({{ width }} x {{ height }} px). Firkantede billeder er ikke tilladt.</target>
</trans-unit>
<trans-unit id="76">
<source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source>
<target>Billedet er landskabsorienteret ({{width}} x {{height}} px). Landskabsorienterede billeder er ikke tilladt</target>
</trans-unit>
<trans-unit id="77">
<source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source>
<target>Billedet er portrætorienteret ({{ width }}x{{ height }}px). Portrætorienterede billeder er ikke tilladt.</target>
</trans-unit>
<trans-unit id="78">
<source>An empty file is not allowed.</source>
<target>En tom fil er ikke tilladt.</target>
</trans-unit>
<trans-unit id="79">
<source>The host could not be resolved.</source>
<target>Værten kunne ikke løses.</target>
</trans-unit>
<trans-unit id="80">
<source>This value does not match the expected {{ charset }} charset.</source>
<target>Denne værdi stemmer ikke overens med den forventede {{ charset }} charset.</target>
</trans-unit>
<trans-unit id="81">
<source>This is not a valid Business Identifier Code (BIC).</source>
<target>Dette er ikke en gyldig Business Identifier Code (BIC).a</target>
</trans-unit>
<trans-unit id="82">
<source>Error</source>
<target>Fejl</target>
</trans-unit>
<trans-unit id="83">
<source>This is not a valid UUID.</source>
<target>Dette er ikke en gyldig UUID.</target>
</trans-unit>
<trans-unit id="84">
<source>This value should be a multiple of {{ compared_value }}.</source>
<target>Denne værdi skal være et flertal af {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="85">
<source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source>
<target>Denne Business Identifier Code (BIC) er ikke forbundet med IBAN {{ iban }}.</target>
</trans-unit>
<trans-unit id="86">
<source>This value should be valid JSON.</source>
<target>Denne værdi skal være gyldig JSON.</target>
</trans-unit>
<trans-unit id="87">
<source>This collection should contain only unique elements.</source>
<target>Denne samling bør kun indeholde unikke elementer.</target>
</trans-unit>
<trans-unit id="88">
<source>This value should be positive.</source>
<target>Denne værdi skal være positiv.</target>
</trans-unit>
<trans-unit id="89">
<source>This value should be either positive or zero.</source>
<target>Denne værdi skal være enten positiv eller nul.</target>
</trans-unit>
<trans-unit id="90">
<source>This value should be negative.</source>
<target>Denne værdi skal være negativ.</target>
</trans-unit>
<trans-unit id="91">
<source>This value should be either negative or zero.</source>
<target>Denne værdi skal være enten negativ eller nul.</target>
</trans-unit>
<trans-unit id="92">
<source>This value is not a valid timezone.</source>
<target>Denne værdi er ikke en gyldig tidszone.</target>
</trans-unit>
<trans-unit id="93">
<source>This password has been leaked in a data breach, it must not be used. Please use another password.</source>
<target>Denne adgangskode er blevet lækket i et databrud, det må ikke bruges. Brug venligst en anden adgangskode.</target>
</trans-unit>
<trans-unit id="94">
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Værdien skal være mellem {{ min }} og {{ max }}.</target>

View File

@ -314,6 +314,58 @@
<source>This is not a valid Business Identifier Code (BIC).</source>
<target>Táto hodnota nie je platný identifikačný kód podniku (BIC).</target>
</trans-unit>
<trans-unit id="82">
<source>Error</source>
<target>Chyba</target>
</trans-unit>
<trans-unit id="83">
<source>This is not a valid UUID.</source>
<target>Táto hodnota nie je platný UUID.</target>
</trans-unit>
<trans-unit id="84">
<source>This value should be a multiple of {{ compared_value }}.</source>
<target>Táto hodnota by mala byť násobkom {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="85">
<source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source>
<target>Tento identifikačný kód podniku (BIC) nie je spojený s IBAN {{ iban }}.</target>
</trans-unit>
<trans-unit id="86">
<source>This value should be valid JSON.</source>
<target>Táto hodnota by mala byť platný JSON.</target>
</trans-unit>
<trans-unit id="87">
<source>This collection should contain only unique elements.</source>
<target>Táto kolekcia by mala obsahovať len unikátne prkvy.</target>
</trans-unit>
<trans-unit id="88">
<source>This value should be positive.</source>
<target>Táto hodnota by mala byť kladná.</target>
</trans-unit>
<trans-unit id="89">
<source>This value should be either positive or zero.</source>
<target>Táto hodnota by mala byť kladná alebo nulová.</target>
</trans-unit>
<trans-unit id="90">
<source>This value should be negative.</source>
<target>Táto hodnota by mala byť záporná.</target>
</trans-unit>
<trans-unit id="91">
<source>This value should be either negative or zero.</source>
<target>Táto hodnota by mala byť záporná alebo nulová.</target>
</trans-unit>
<trans-unit id="92">
<source>This value is not a valid timezone.</source>
<target>Táto hodnota nie je platné časové pásmo.</target>
</trans-unit>
<trans-unit id="93">
<source>This password has been leaked in a data breach, it must not be used. Please use another password.</source>
<target>Toto heslo uniklo pri narušení ochrany dát, nie je možné ho použiť. Prosím, použite iné heslo.</target>
</trans-unit>
<trans-unit id="94">
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Táto hodnota by mala byť medzi {{ min }} a {{ max }}.</target>
</trans-unit>
</body>
</file>
</xliff>