composer update
This commit is contained in:
parent
f6abc3dce2
commit
71dfaca858
1753 changed files with 45274 additions and 14619 deletions
2
vendor/symfony/validator/Constraint.php
vendored
2
vendor/symfony/validator/Constraint.php
vendored
|
@ -120,7 +120,7 @@ abstract class Constraint
|
|||
if (\is_array($options)) {
|
||||
reset($options);
|
||||
}
|
||||
if (\is_array($options) && \count($options) > 0 && \is_string(key($options))) {
|
||||
if ($options && \is_array($options) && \is_string(key($options))) {
|
||||
foreach ($options as $option => $value) {
|
||||
if (array_key_exists($option, $knownOptions)) {
|
||||
$this->$option = $value;
|
||||
|
|
|
@ -79,13 +79,13 @@ class ConstraintViolation implements ConstraintViolationInterface
|
|||
}
|
||||
|
||||
$propertyPath = (string) $this->propertyPath;
|
||||
$code = $this->code;
|
||||
$code = (string) $this->code;
|
||||
|
||||
if ('' !== $propertyPath && '[' !== $propertyPath[0] && '' !== $class) {
|
||||
$class .= '.';
|
||||
}
|
||||
|
||||
if (!empty($code)) {
|
||||
if ('' !== $code) {
|
||||
$code = ' (code '.$code.')';
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
|
||||
/**
|
||||
* @author Michael Hirschler <michael.vhirsch@gmail.com>
|
||||
|
@ -26,6 +27,10 @@ class BicValidator extends ConstraintValidator
|
|||
*/
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (!$constraint instanceof Bic) {
|
||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Bic');
|
||||
}
|
||||
|
||||
if (null === $value || '' === $value) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,10 @@ class CountValidator extends ConstraintValidator
|
|||
*/
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (!$constraint instanceof Count) {
|
||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Count');
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -129,6 +129,7 @@ class IbanValidator extends ConstraintValidator
|
|||
'TN' => 'TN59\d{2}\d{3}\d{13}\d{2}', // Tunisia
|
||||
'TR' => 'TR\d{2}\d{5}[\dA-Z]{1}[\dA-Z]{16}', // Turkey
|
||||
'UA' => 'UA\d{2}\d{6}[\dA-Z]{19}', // Ukraine
|
||||
'VA' => 'VA\d{2}\d{3}\d{15}', // Vatican City State
|
||||
'VG' => 'VG\d{2}[A-Z]{4}\d{16}', // Virgin Islands, British
|
||||
'WF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Wallis and Futuna Islands
|
||||
'XK' => 'XK\d{2}\d{4}\d{10}\d{2}', // Republic of Kosovo
|
||||
|
|
|
@ -66,14 +66,14 @@ class UuidValidator extends ConstraintValidator
|
|||
*/
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value || '' === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$constraint instanceof Uuid) {
|
||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Uuid');
|
||||
}
|
||||
|
||||
if (null === $value || '' === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) {
|
||||
throw new UnexpectedTypeException($value, 'string');
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ interface ExecutionContextInterface
|
|||
* Returns the currently validated object.
|
||||
*
|
||||
* If the validator is currently validating a class constraint, the
|
||||
* object of that class is returned. If it is a validating a property or
|
||||
* object of that class is returned. If it is validating a property or
|
||||
* getter constraint, the object that the property/getter belongs to is
|
||||
* returned.
|
||||
*
|
||||
|
|
2
vendor/symfony/validator/LICENSE
vendored
2
vendor/symfony/validator/LICENSE
vendored
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2004-2018 Fabien Potencier
|
||||
Copyright (c) 2004-2019 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -326,6 +326,10 @@
|
|||
<source>This value should be a multiple of {{ compared_value }}.</source>
|
||||
<target>{{ compared_value }}の倍数でなければなりません。</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="85">
|
||||
<source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source>
|
||||
<target>このSWIFTコードはIBANコード({{ iban }})に関連付けられていません。</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
</trans-unit>
|
||||
<trans-unit id="10">
|
||||
<source>This field is missing.</source>
|
||||
<target>Lĩnh vực này là mất tích.</target>
|
||||
<target>Lĩnh vực này bị thiếu.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="11">
|
||||
<source>This value is not a valid date.</source>
|
||||
|
@ -132,7 +132,7 @@
|
|||
</trans-unit>
|
||||
<trans-unit id="36">
|
||||
<source>This file is not a valid image.</source>
|
||||
<target>Tập tin không phải là hình ảnh.</target>
|
||||
<target>Tập tin không phải là hình ảnh hợp lệ.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="37">
|
||||
<source>This is not a valid IP address.</source>
|
||||
|
@ -148,7 +148,7 @@
|
|||
</trans-unit>
|
||||
<trans-unit id="40">
|
||||
<source>This value is not a valid country.</source>
|
||||
<target>Giá trị không phải là nước hợp lệ.</target>
|
||||
<target>Giá trị không phải là quốc gia hợp lệ.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="41">
|
||||
<source>This value is already used.</source>
|
||||
|
@ -180,7 +180,7 @@
|
|||
</trans-unit>
|
||||
<trans-unit id="48">
|
||||
<source>This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.</source>
|
||||
<target>Giá trị phải có chính xác {{ limit }} kí tự.|Giá trị phải có chính xác {{ limit }} kí tự.</target>
|
||||
<target>Giá trị này phải có chính xác {{ limit }} kí tự.|Giá trị này phải có chính xác {{ limit }} kí tự.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="49">
|
||||
<source>The file was only partially uploaded.</source>
|
||||
|
@ -204,11 +204,11 @@
|
|||
</trans-unit>
|
||||
<trans-unit id="54">
|
||||
<source>This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.</source>
|
||||
<target>Danh sách phải chứa {{ limit }} hoặc nhiều hơn thành phần.|Danh sách phải chứa {{ limit }} hoặc nhiều hơn thành phần.</target>
|
||||
<target>Danh sách phải chứa {{ limit }} thành phần hoặc nhiều hơn.|Danh sách phải chứa {{ limit }} thành phần hoặc nhiều hơn.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="55">
|
||||
<source>This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.</source>
|
||||
<target>Danh sách phải chứa {{ limit }} hoặc ít hơn thành phần.|Danh sách phải chứa {{ limit }} hoặc ít hơn thành phần.</target>
|
||||
<target>Danh sách phải chứa {{ limit }} thành phần hoặc ít hơn.|Danh sách phải chứa {{ limit }} thành phần hoặc ít hơn.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="56">
|
||||
<source>This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.</source>
|
||||
|
@ -240,11 +240,11 @@
|
|||
</trans-unit>
|
||||
<trans-unit id="63">
|
||||
<source>This value is not a valid ISSN.</source>
|
||||
<target>Giá trị không là ISSN hợp lệ.</target>
|
||||
<target>Giá trị không phải là ISSN hợp lệ.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="64">
|
||||
<source>This value is not a valid currency.</source>
|
||||
<target>Giá trị không phải là đơn vi tiền tệ hợp lệ.</target>
|
||||
<target>Giá trị không phải là đơn vị tiền tệ hợp lệ.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="65">
|
||||
<source>This value should be equal to {{ compared_value }}.</source>
|
||||
|
@ -268,7 +268,7 @@
|
|||
</trans-unit>
|
||||
<trans-unit id="70">
|
||||
<source>This value should be less than or equal to {{ compared_value }}.</source>
|
||||
<target>Giá trị không được phép nhỏ hơn hoặc bằng {{ compared_value }}.</target>
|
||||
<target>Giá trị phải nhỏ hơn hoặc bằng {{ compared_value }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="71">
|
||||
<source>This value should not be equal to {{ compared_value }}.</source>
|
||||
|
|
|
@ -53,4 +53,59 @@ EOF;
|
|||
|
||||
$this->assertSame($expected, (string) $violation);
|
||||
}
|
||||
|
||||
public function testToStringHandlesCodes()
|
||||
{
|
||||
$violation = new ConstraintViolation(
|
||||
'42 cannot be used here',
|
||||
'this is the message template',
|
||||
array(),
|
||||
array('some_value' => 42),
|
||||
'some_value',
|
||||
null,
|
||||
null,
|
||||
0
|
||||
);
|
||||
|
||||
$expected = <<<'EOF'
|
||||
Array.some_value:
|
||||
42 cannot be used here (code 0)
|
||||
EOF;
|
||||
|
||||
$this->assertSame($expected, (string) $violation);
|
||||
}
|
||||
|
||||
public function testToStringOmitsEmptyCodes()
|
||||
{
|
||||
$expected = <<<'EOF'
|
||||
Array.some_value:
|
||||
42 cannot be used here
|
||||
EOF;
|
||||
|
||||
$violation = new ConstraintViolation(
|
||||
'42 cannot be used here',
|
||||
'this is the message template',
|
||||
array(),
|
||||
array('some_value' => 42),
|
||||
'some_value',
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
|
||||
$this->assertSame($expected, (string) $violation);
|
||||
|
||||
$violation = new ConstraintViolation(
|
||||
'42 cannot be used here',
|
||||
'this is the message template',
|
||||
array(),
|
||||
array('some_value' => 42),
|
||||
'some_value',
|
||||
null,
|
||||
null,
|
||||
''
|
||||
);
|
||||
|
||||
$this->assertSame($expected, (string) $violation);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,6 +156,7 @@ class IbanValidatorTest extends ConstraintValidatorTestCase
|
|||
array('TR330006100519786457841326'), //Turkey
|
||||
array('UA213223130000026007233566001'), //Ukraine
|
||||
array('AE260211000000230064016'), //United Arab Emirates
|
||||
array('VA59001123000012345678'), //Vatican City State
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -274,6 +275,7 @@ class IbanValidatorTest extends ConstraintValidatorTestCase
|
|||
array('TR3300061005197864578413261'), //Turkey
|
||||
array('UA21AAAA1300000260072335660012'), //Ukraine
|
||||
array('AE2602110000002300640161'), //United Arab Emirates
|
||||
array('VA590011230000123456781'), //Vatican City State
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -385,6 +387,7 @@ class IbanValidatorTest extends ConstraintValidatorTestCase
|
|||
array('TR330006100519786457841327'), //Turkey
|
||||
array('UA213223130000026007233566002'), //Ukraine
|
||||
array('AE260211000000230064017'), //United Arab Emirates
|
||||
array('VA59001123000012345671'), //Vatican City State
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
namespace Symfony\Component\Validator\Tests\Validator;
|
||||
|
||||
use Symfony\Component\Translation\IdentityTranslator;
|
||||
use Symfony\Component\Validator\Constraints\All;
|
||||
use Symfony\Component\Validator\Constraints\Collection;
|
||||
use Symfony\Component\Validator\Constraints\Length;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\ConstraintValidatorFactory;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextFactory;
|
||||
use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface;
|
||||
|
@ -95,4 +99,38 @@ class RecursiveValidatorTest extends AbstractTest
|
|||
|
||||
$validator->validate($entity, null, array());
|
||||
}
|
||||
|
||||
public function testCollectionConstraintValidateAllGroupsForNestedConstraints()
|
||||
{
|
||||
$this->metadata->addPropertyConstraint('data', new Collection(array('fields' => array(
|
||||
'one' => array(new NotBlank(array('groups' => 'one')), new Length(array('min' => 2, 'groups' => 'two'))),
|
||||
'two' => array(new NotBlank(array('groups' => 'two'))),
|
||||
))));
|
||||
|
||||
$entity = new Entity();
|
||||
$entity->data = array('one' => 't', 'two' => '');
|
||||
|
||||
$violations = $this->validator->validate($entity, null, array('one', 'two'));
|
||||
|
||||
$this->assertCount(2, $violations);
|
||||
$this->assertInstanceOf(Length::class, $violations->get(0)->getConstraint());
|
||||
$this->assertInstanceOf(NotBlank::class, $violations->get(1)->getConstraint());
|
||||
}
|
||||
|
||||
public function testAllConstraintValidateAllGroupsForNestedConstraints()
|
||||
{
|
||||
$this->metadata->addPropertyConstraint('data', new All(array('constraints' => array(
|
||||
new NotBlank(array('groups' => 'one')),
|
||||
new Length(array('min' => 2, 'groups' => 'two')),
|
||||
))));
|
||||
|
||||
$entity = new Entity();
|
||||
$entity->data = array('one' => 't', 'two' => '');
|
||||
|
||||
$violations = $this->validator->validate($entity, null, array('one', 'two'));
|
||||
|
||||
$this->assertCount(2, $violations);
|
||||
$this->assertInstanceOf(NotBlank::class, $violations->get(0)->getConstraint());
|
||||
$this->assertInstanceOf(Length::class, $violations->get(1)->getConstraint());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
namespace Symfony\Component\Validator\Validator;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\Constraints\Composite;
|
||||
use Symfony\Component\Validator\Constraints\GroupSequence;
|
||||
use Symfony\Component\Validator\ConstraintValidatorFactoryInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContext;
|
||||
|
@ -787,6 +788,10 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
|
|||
if (null !== $cacheKey) {
|
||||
$constraintHash = spl_object_hash($constraint);
|
||||
|
||||
if ($constraint instanceof Composite) {
|
||||
$constraintHash .= $group;
|
||||
}
|
||||
|
||||
if ($context->isConstraintValidated($cacheKey, $constraintHash)) {
|
||||
continue;
|
||||
}
|
||||
|
|
2
vendor/symfony/validator/phpunit.xml.dist
vendored
2
vendor/symfony/validator/phpunit.xml.dist
vendored
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
|
|
Reference in a new issue