Merge branch '4.3' into 4.4

* 4.3: (25 commits)
  fix merge
  [HttpClient] fix debug output added to stderr at shutdown
  fix cs
  Use mocks before replacing the error handler
  [Config] Do not use absolute path when computing the vendor freshness
  Bump minimum version of symfony/phpunit-bridge
  Container*::getServiceIds() should return an array of string
  [Config][ReflectionClassResource] Use ternary instead of null coaelscing operator
  [Validator] Add missing Russian and Ukrainian translations
  [Translation] Use HTTPS and fix a url
  [Config] Fix for signatures of typed properties
  [Validator] Add missing Hungarian translations
  [Validator] Add Lithuanian translation for Range validator
  Add HTTPS to a URL
  sync translation files
  PHPDoc fixes
  Add notInRange translation
  Add danish translation for Range validator
  Add german translation for Range validator
  Update validators.es.xlf
  ...
This commit is contained in:
Nicolas Grekas 2019-07-18 12:38:27 +02:00
commit ed0b361d6f
24 changed files with 148 additions and 29 deletions

View File

@ -117,7 +117,7 @@
"psr/http-client": "^1.0",
"psr/simple-cache": "^1.0",
"egulias/email-validator": "~1.2,>=1.2.8|~2.0",
"symfony/phpunit-bridge": "~3.4|~4.0|~5.0",
"symfony/phpunit-bridge": "^3.4.19|^4.1.8|~5.0",
"symfony/security-acl": "~2.8|~3.0",
"phpdocumentor/reflection-docblock": "^3.0|^4.0"
},

View File

@ -50,7 +50,7 @@ class ComposerResource implements SelfCheckingResourceInterface
{
self::refresh();
return self::$runtimeVendors === $this->vendors;
return array_values(self::$runtimeVendors) === array_values($this->vendors);
}
private static function refresh()

View File

@ -136,7 +136,7 @@ class ReflectionClassResource implements SelfCheckingResourceInterface
foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) {
yield $p->getDocComment().$p;
yield print_r($defaults[$p->name], true);
yield print_r(isset($defaults[$p->name]) ? $defaults[$p->name] : null, true);
}
}

View File

@ -134,6 +134,14 @@ EOPHP;
yield [1, 13, 'protected function prot($a = [123]) {}'];
yield [0, 14, '/** priv docblock */'];
yield [0, 15, ''];
if (\PHP_VERSION_ID >= 70400) {
// PHP7.4 typed properties without default value are
// undefined, make sure this doesn't throw an error
yield [1, 5, 'public array $pub;'];
yield [0, 7, 'protected int $prot;'];
yield [0, 9, 'private string $priv;'];
}
}
public function testEventSubscriber()

View File

@ -160,8 +160,8 @@ class DebugClassLoader
include $file;
return;
} else {
include $file;
} elseif (false === include $file) {
return;
}
} else {
($this->classLoader)($class);

View File

@ -72,8 +72,8 @@ class ErrorHandlerTest extends TestCase
public function testErrorGetLast()
{
$handler = ErrorHandler::register();
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
$handler = ErrorHandler::register();
$handler->setDefaultLogger($logger);
$handler->screamAt(E_ALL);
@ -145,9 +145,8 @@ class ErrorHandlerTest extends TestCase
public function testDefaultLogger()
{
try {
$handler = ErrorHandler::register();
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
$handler = ErrorHandler::register();
$handler->setDefaultLogger($logger, E_NOTICE);
$handler->setDefaultLogger($logger, [E_USER_NOTICE => LogLevel::CRITICAL]);
@ -333,12 +332,11 @@ class ErrorHandlerTest extends TestCase
public function testHandleException()
{
try {
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
$handler = ErrorHandler::register();
$exception = new \Exception('foo');
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
$logArgCheck = function ($level, $message, $context) {
$this->assertSame('Uncaught Exception: foo', $message);
$this->assertArrayHasKey('exception', $context);
@ -444,6 +442,7 @@ class ErrorHandlerTest extends TestCase
public function testHandleFatalError()
{
try {
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
$handler = ErrorHandler::register();
$error = [
@ -453,8 +452,6 @@ class ErrorHandlerTest extends TestCase
'line' => 123,
];
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
$logArgCheck = function ($level, $message, $context) {
$this->assertEquals('Fatal Parse Error: foo', $message);
$this->assertArrayHasKey('exception', $context);

View File

@ -320,11 +320,11 @@ class Container implements ResettableContainerInterface
/**
* Gets all service ids.
*
* @return array An array of all defined service ids
* @return string[] An array of all defined service ids
*/
public function getServiceIds()
{
return array_unique(array_merge(['service_container'], array_keys($this->fileMap), array_keys($this->methodMap), array_keys($this->services)));
return array_map('strval', array_unique(array_merge(['service_container'], array_keys($this->fileMap), array_keys($this->methodMap), array_keys($this->services))));
}
/**

View File

@ -781,13 +781,11 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
}
/**
* Gets all service ids.
*
* @return array An array of all defined service ids
* {@inheritdoc}
*/
public function getServiceIds()
{
return array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds()));
return array_map('strval', array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds())));
}
/**

View File

@ -146,9 +146,9 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
private $lockSetData = false;
/**
* @var string|null
* @var string
*/
private $name;
private $name = '';
/**
* @var bool Whether the form inherits its underlying data from its parent
@ -217,7 +217,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
return $this->propertyPath;
}
if (null === $this->name || '' === $this->name) {
if ('' === $this->name) {
return null;
}

View File

@ -319,6 +319,12 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface
if (\defined('CURLMOPT_PUSHFUNCTION')) {
curl_multi_setopt($this->multi->handle, CURLMOPT_PUSHFUNCTION, null);
}
while (CURLM_CALL_MULTI_PERFORM === curl_multi_exec($this->multi->handle, $active));
foreach ($this->multi->openHandles as $ch) {
curl_setopt($ch, CURLOPT_VERBOSE, false);
}
}
private static function handlePush($parent, $pushed, array $requestHeaders, CurlClientState $multi, int $maxPendingPushes, ?LoggerInterface $logger): int

View File

@ -216,7 +216,7 @@ class MessengerPass implements CompilerPassInterface
}
if ($type->isBuiltin()) {
throw new RuntimeException(sprintf('Invalid handler service "%s": type-hint of argument "$%s" in method "%s::__invoke()" must be a class , "%s" given.', $serviceId, $parameters[0]->getName(), $handlerClass->getName(), $type));
throw new RuntimeException(sprintf('Invalid handler service "%s": type-hint of argument "$%s" in method "%s::__invoke()" must be a class , "%s" given.', $serviceId, $parameters[0]->getName(), $handlerClass->getName(), $type instanceof \ReflectionNamedType ? $type->getName() : (string) $type));
}
return [$parameters[0]->getType()->getName()];

View File

@ -339,7 +339,7 @@ class XmlEncoder implements EncoderInterface, DecoderInterface, NormalizationAwa
$typeCastAttributes = (bool) ($context[self::TYPE_CASE_ATTRIBUTES] ?? $this->defaultContext[self::TYPE_CASE_ATTRIBUTES]);
foreach ($node->attributes as $attr) {
if (!is_numeric($attr->nodeValue) || !$typeCastAttributes) {
if (!is_numeric($attr->nodeValue) || !$typeCastAttributes || (isset($attr->nodeValue[1]) && '0' === $attr->nodeValue[0])) {
$data['@'.$attr->nodeName] = $attr->nodeValue;
continue;

View File

@ -309,6 +309,17 @@ XML;
$this->assertSame($expected, $data);
}
public function testDoesNotTypeCastStringsStartingWith0()
{
$source = <<<XML
<?xml version="1.0"?>
<document a="018"></document>
XML;
$data = $this->encoder->decode($source, 'xml');
$this->assertSame('018', $data['@a']);
}
public function testEncode()
{
$source = $this->getXmlSource();

View File

@ -12,7 +12,7 @@
namespace Symfony\Component\Translation\Loader;
/**
* @copyright Copyright (c) 2010, Union of RAD http://union-of-rad.org (http://lithify.me/)
* @copyright Copyright (c) 2010, Union of RAD https://github.com/UnionOfRAD/lithium
* @copyright Copyright (c) 2012, Clemens Tolboom
*/
class PoFileLoader extends FileLoader
@ -20,7 +20,7 @@ class PoFileLoader extends FileLoader
/**
* Parses portable object (PO) format.
*
* From http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files
* From https://www.gnu.org/software/gettext/manual/gettext.html#PO-Files
* we should be able to parse files having:
*
* white-space

View File

@ -21,9 +21,8 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException;
* @author Tim Nagel <t.nagel@infinite.net.au>
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @see http://en.wikipedia.org/wiki/Bank_card_number
* @see http://www.regular-expressions.info/creditcard.html
* @see http://www.barclaycard.co.uk/business/files/Ranges_and_Rules_September_2014.pdf
* @see https://en.wikipedia.org/wiki/Payment_card_number
* @see https://www.regular-expressions.info/creditcard.html
*/
class CardSchemeValidator extends ConstraintValidator
{

View File

@ -13,4 +13,4 @@ Resources
[send Pull Requests](https://github.com/symfony/symfony/pulls)
in the [main Symfony repository](https://github.com/symfony/symfony)
[1]: http://jcp.org/en/jsr/detail?id=303
[1]: https://jcp.org/en/jsr/detail?id=303

View File

@ -246,6 +246,10 @@
<source>Error</source>
<target>Fejl</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>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -362,6 +362,10 @@
<source>This password has been leaked in a data breach, it must not be used. Please use another password.</source>
<target>Dieses Passwort ist Teil eines Datenlecks, es darf nicht verwendet werden.</target>
</trans-unit>
<trans-unit id="94">
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Dieser Wert sollte zwischen {{ min }} und {{ max }} sein.</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -362,6 +362,10 @@
<source>This password has been leaked in a data breach, it must not be used. Please use another password.</source>
<target>Esta contraseña no se puede utilizar porque está incluida en un listado de contraseñas públicas obtenido gracias a fallos de seguridad de otros sitios y aplicaciones. Por favor utilice otra contraseña.</target>
</trans-unit>
<trans-unit id="94">
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Este valor debe estar entre {{ min }} y {{ max }}.</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -358,6 +358,14 @@
<source>This value is not a valid timezone.</source>
<target>Ez az érték nem egy érvényes időzóna.</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>Ez a jelszó korábban egy adatvédelmi incidens során illetéktelenek kezébe került, így nem használható. Kérjük, használjon másik jelszót.</target>
</trans-unit>
<trans-unit id="94">
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Ennek az értéknek {{ min }} és {{ max }} között kell lennie.</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -362,6 +362,10 @@
<source>This password has been leaked in a data breach, it must not be used. Please use another password.</source>
<target>Slaptažodis yra nutekėjęs duomenų saugumo pažeidime, jo naudoti negalima. Prašome naudoti kitą slaptažodį.</target>
</trans-unit>
<trans-unit id="94">
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Ši reikšmė turi būti tarp {{ min }} ir {{ max }}.</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -330,6 +330,10 @@
<source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source>
<target>Ten kod BIC (Business Identifier Code) nie jest powiązany z międzynarodowym numerem rachunku bankowego (IBAN) {{ iban }}.</target>
</trans-unit>
<trans-unit id="94">
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Ta wartość powinna być pomiędzy {{ min }} a {{ max }}.</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -330,6 +330,42 @@
<source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source>
<target>Данный BIC не связан с IBAN {{ iban }}.</target>
</trans-unit>
<trans-unit id="86">
<source>This value should be valid JSON.</source>
<target>Значение должно быть корректным JSON.</target>
</trans-unit>
<trans-unit id="87">
<source>This collection should contain only unique elements.</source>
<target>Эта коллекция должна содержать только уникальные элементы.</target>
</trans-unit>
<trans-unit id="88">
<source>This value should be positive.</source>
<target>Значение должно быть положительным.</target>
</trans-unit>
<trans-unit id="89">
<source>This value should be either positive or zero.</source>
<target>Значение должно быть положительным или равным нулю.</target>
</trans-unit>
<trans-unit id="90">
<source>This value should be negative.</source>
<target>Значение должно быть отрицательным.</target>
</trans-unit>
<trans-unit id="91">
<source>This value should be either negative or zero.</source>
<target>Значение должно быть отрицательным или равным нулю.</target>
</trans-unit>
<trans-unit id="92">
<source>This value is not a valid timezone.</source>
<target>Значение не является корректным часовым поясом.</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>Данный пароль был скомпрометирован в результате утечки данных и не должен быть использован. Пожалуйста, используйте другой пароль.</target>
</trans-unit>
<trans-unit id="94">
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Значение должно быть между {{ min }} и {{ max }}.</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -330,6 +330,42 @@
<source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source>
<target>Банківський код (BIC) не пов’язаний із міжнародним номером банківського рахунку (IBAN) {{ iban }}.</target>
</trans-unit>
<trans-unit id="86">
<source>This value should be valid JSON.</source>
<target>Значення має бути корректним JSON.</target>
</trans-unit>
<trans-unit id="87">
<source>This collection should contain only unique elements.</source>
<target>Ця колекція повинна мати тільки унікальни значення.</target>
</trans-unit>
<trans-unit id="88">
<source>This value should be positive.</source>
<target>Значення має бути позитивним.</target>
</trans-unit>
<trans-unit id="89">
<source>This value should be either positive or zero.</source>
<target>Значення має бути позитивним або дорівнювати нулю.</target>
</trans-unit>
<trans-unit id="90">
<source>This value should be negative.</source>
<target>Значення має бути негативним.</target>
</trans-unit>
<trans-unit id="91">
<source>This value should be either negative or zero.</source>
<target>Значення має бути негативним або дорівнювати нулю.</target>
</trans-unit>
<trans-unit id="92">
<source>This value is not a valid timezone.</source>
<target>Значення не є дійсним часовим поясом.</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>Цей пароль був скомпрометований в результаті витоку даних та не повинен використовуватися. Будь ласка, використовуйте інший пароль.</target>
</trans-unit>
<trans-unit id="94">
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Значення має бути між {{ min }} та {{ max }}.</target>
</trans-unit>
</body>
</file>
</xliff>