Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
|
@ -18,6 +18,7 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
|
|||
* Used for the comparison of values.
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
abstract class AbstractComparison extends Constraint
|
||||
{
|
||||
|
|
|
@ -60,12 +60,14 @@ abstract class AbstractComparisonValidator extends ConstraintValidator
|
|||
->setParameter('{{ value }}', $this->formatValue($value, self::OBJECT_TO_STRING | self::PRETTY_DATE))
|
||||
->setParameter('{{ compared_value }}', $this->formatValue($comparedValue, self::OBJECT_TO_STRING | self::PRETTY_DATE))
|
||||
->setParameter('{{ compared_value_type }}', $this->formatTypeOf($comparedValue))
|
||||
->setCode($this->getErrorCode())
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value, self::OBJECT_TO_STRING | self::PRETTY_DATE))
|
||||
->setParameter('{{ compared_value }}', $this->formatValue($comparedValue, self::OBJECT_TO_STRING | self::PRETTY_DATE))
|
||||
->setParameter('{{ compared_value_type }}', $this->formatTypeOf($comparedValue))
|
||||
->setCode($this->getErrorCode())
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
@ -80,4 +82,13 @@ abstract class AbstractComparisonValidator extends ConstraintValidator
|
|||
* @return bool true if the relationship is valid, false otherwise
|
||||
*/
|
||||
abstract protected function compareValues($value1, $value2);
|
||||
|
||||
/**
|
||||
* Returns the error code used if the comparison fails.
|
||||
*
|
||||
* @return string|null The error code or `null` if no code should be set
|
||||
*/
|
||||
protected function getErrorCode()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
39
vendor/symfony/validator/Constraints/Bic.php
vendored
Normal file
39
vendor/symfony/validator/Constraints/Bic.php
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Validator\Constraints;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
|
||||
*
|
||||
* @author Michael Hirschler <michael.vhirsch@gmail.com>
|
||||
*/
|
||||
class Bic extends Constraint
|
||||
{
|
||||
const INVALID_LENGTH_ERROR = '66dad313-af0b-4214-8566-6c799be9789c';
|
||||
const INVALID_CHARACTERS_ERROR = 'f424c529-7add-4417-8f2d-4b656e4833e2';
|
||||
const INVALID_BANK_CODE_ERROR = '00559357-6170-4f29-aebd-d19330aa19cf';
|
||||
const INVALID_COUNTRY_CODE_ERROR = '1ce76f8d-3c1f-451c-9e62-fe9c3ed486ae';
|
||||
const INVALID_CASE_ERROR = '11884038-3312-4ae5-9d04-699f782130c7';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::INVALID_LENGTH_ERROR => 'INVALID_LENGTH_ERROR',
|
||||
self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR',
|
||||
self::INVALID_BANK_CODE_ERROR => 'INVALID_BANK_CODE_ERROR',
|
||||
self::INVALID_COUNTRY_CODE_ERROR => 'INVALID_COUNTRY_CODE_ERROR',
|
||||
self::INVALID_CASE_ERROR => 'INVALID_CASE_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This is not a valid Business Identifier Code (BIC).';
|
||||
}
|
85
vendor/symfony/validator/Constraints/BicValidator.php
vendored
Normal file
85
vendor/symfony/validator/Constraints/BicValidator.php
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Validator\Constraints;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
|
||||
/**
|
||||
* @author Michael Hirschler <michael.vhirsch@gmail.com>
|
||||
*
|
||||
* @link https://en.wikipedia.org/wiki/ISO_9362#Structure
|
||||
*/
|
||||
class BicValidator extends ConstraintValidator
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (null === $value || '' === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$canonicalize = str_replace(' ', '', $value);
|
||||
|
||||
// the bic must be either 8 or 11 characters long
|
||||
if (!in_array(strlen($canonicalize), array(8, 11))) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Bic::INVALID_LENGTH_ERROR)
|
||||
->addViolation();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// must contain alphanumeric values only
|
||||
if (!ctype_alnum($canonicalize)) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Bic::INVALID_CHARACTERS_ERROR)
|
||||
->addViolation();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// first 4 letters must be alphabetic (bank code)
|
||||
if (!ctype_alpha(substr($canonicalize, 0, 4))) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Bic::INVALID_BANK_CODE_ERROR)
|
||||
->addViolation();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// next 2 letters must be alphabetic (country code)
|
||||
if (!ctype_alpha(substr($canonicalize, 4, 2))) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Bic::INVALID_COUNTRY_CODE_ERROR)
|
||||
->addViolation();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// should contain uppercase characters only
|
||||
if (strtoupper($canonicalize) !== $canonicalize) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Bic::INVALID_CASE_ERROR)
|
||||
->addViolation();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,5 +21,11 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class Blank extends Constraint
|
||||
{
|
||||
const NOT_BLANK_ERROR = '183ad2de-533d-4796-a439-6d3c3852b549';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::NOT_BLANK_ERROR => 'NOT_BLANK_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value should be blank.';
|
||||
}
|
||||
|
|
|
@ -34,10 +34,12 @@ class BlankValidator extends ConstraintValidator
|
|||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Blank::NOT_BLANK_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Blank::NOT_BLANK_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class Callback extends Constraint
|
|||
@trigger_error('The "methods" option of the '.__CLASS__.' class is deprecated since version 2.4 and will be removed in 3.0. Use the "callback" option instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
if (is_array($options) && !isset($options['callback']) && !isset($options['methods']) && !isset($options['groups'])) {
|
||||
if (is_array($options) && !isset($options['callback']) && !isset($options['methods']) && !isset($options['groups']) && !isset($options['payload'])) {
|
||||
if (is_callable($options) || !$options) {
|
||||
$options = array('callback' => $options);
|
||||
} else {
|
||||
|
|
|
@ -24,8 +24,8 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class CardScheme extends Constraint
|
||||
{
|
||||
const NOT_NUMERIC_ERROR = 1;
|
||||
const INVALID_FORMAT_ERROR = 2;
|
||||
const NOT_NUMERIC_ERROR = 'a2ad9231-e827-485f-8a1e-ef4d9a6d5c2e';
|
||||
const INVALID_FORMAT_ERROR = 'a8faedbf-1c2f-4695-8d22-55783be8efed';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::NOT_NUMERIC_ERROR => 'NOT_NUMERIC_ERROR',
|
||||
|
|
|
@ -21,9 +21,9 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class Choice extends Constraint
|
||||
{
|
||||
const NO_SUCH_CHOICE_ERROR = 1;
|
||||
const TOO_FEW_ERROR = 2;
|
||||
const TOO_MANY_ERROR = 3;
|
||||
const NO_SUCH_CHOICE_ERROR = '8e179f1b-97aa-4560-a02f-2a8b42e49df7';
|
||||
const TOO_FEW_ERROR = '11edd7eb-5872-4b6e-9f12-89923999fd0e';
|
||||
const TOO_MANY_ERROR = '9bd98e49-211c-433f-8630-fd1c2d0f08c3';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::NO_SUCH_CHOICE_ERROR => 'NO_SUCH_CHOICE_ERROR',
|
||||
|
|
|
@ -21,8 +21,8 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
|
|||
*/
|
||||
class Collection extends Composite
|
||||
{
|
||||
const MISSING_FIELD_ERROR = 1;
|
||||
const NO_SUCH_FIELD_ERROR = 2;
|
||||
const MISSING_FIELD_ERROR = '2fa2158c-2a7f-484b-98aa-975522539ff8';
|
||||
const NO_SUCH_FIELD_ERROR = '7703c766-b5d5-4cef-ace7-ae0dd82304e9';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::MISSING_FIELD_ERROR => 'MISSING_FIELD_ERROR',
|
||||
|
|
|
@ -22,8 +22,8 @@ use Symfony\Component\Validator\Exception\MissingOptionsException;
|
|||
*/
|
||||
class Count extends Constraint
|
||||
{
|
||||
const TOO_FEW_ERROR = 1;
|
||||
const TOO_MANY_ERROR = 2;
|
||||
const TOO_FEW_ERROR = 'bef8e338-6ae5-4caf-b8e2-50e7b0579e69';
|
||||
const TOO_MANY_ERROR = '756b1212-697c-468d-a9ad-50dd783bb169';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::TOO_FEW_ERROR => 'TOO_FEW_ERROR',
|
||||
|
|
|
@ -21,5 +21,11 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class Country extends Constraint
|
||||
{
|
||||
const NO_SUCH_COUNTRY_ERROR = '8f900c12-61bd-455d-9398-996cd040f7f0';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::NO_SUCH_COUNTRY_ERROR => 'NO_SUCH_COUNTRY_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value is not a valid country.';
|
||||
}
|
||||
|
|
|
@ -48,10 +48,12 @@ class CountryValidator extends ConstraintValidator
|
|||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Country::NO_SUCH_COUNTRY_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Country::NO_SUCH_COUNTRY_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,15 @@ use Symfony\Component\Validator\Constraint;
|
|||
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
|
||||
*
|
||||
* @author Miha Vrhovnik <miha.vrhovnik@pagein.si>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class Currency extends Constraint
|
||||
{
|
||||
const NO_SUCH_CURRENCY_ERROR = '69945ac1-2db4-405f-bec7-d2772f73df52';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::NO_SUCH_CURRENCY_ERROR => 'NO_SUCH_CURRENCY_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value is not a valid currency.';
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
|||
* Validates whether a value is a valid currency.
|
||||
*
|
||||
* @author Miha Vrhovnik <miha.vrhovnik@pagein.si>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class CurrencyValidator extends ConstraintValidator
|
||||
{
|
||||
|
@ -48,10 +49,12 @@ class CurrencyValidator extends ConstraintValidator
|
|||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Currency::NO_SUCH_CURRENCY_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Currency::NO_SUCH_CURRENCY_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class Date extends Constraint
|
||||
{
|
||||
const INVALID_FORMAT_ERROR = 1;
|
||||
const INVALID_DATE_ERROR = 2;
|
||||
const INVALID_FORMAT_ERROR = '69819696-02ac-4a99-9ff0-14e127c4d1bc';
|
||||
const INVALID_DATE_ERROR = '3c184ce5-b31d-4de7-8b76-326da7b2be93';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR',
|
||||
|
|
|
@ -21,9 +21,9 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class DateTime extends Constraint
|
||||
{
|
||||
const INVALID_FORMAT_ERROR = 1;
|
||||
const INVALID_DATE_ERROR = 2;
|
||||
const INVALID_TIME_ERROR = 3;
|
||||
const INVALID_FORMAT_ERROR = '1a9da513-2640-4f84-9b6a-4d99dcddc628';
|
||||
const INVALID_DATE_ERROR = 'd52afa47-620d-4d99-9f08-f4d85b36e33c';
|
||||
const INVALID_TIME_ERROR = '5e797c9d-74f7-4098-baa3-94390c447b27';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR',
|
||||
|
|
|
@ -21,9 +21,9 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class Email extends Constraint
|
||||
{
|
||||
const INVALID_FORMAT_ERROR = 1;
|
||||
const MX_CHECK_FAILED_ERROR = 2;
|
||||
const HOST_CHECK_FAILED_ERROR = 3;
|
||||
const INVALID_FORMAT_ERROR = 'bd79c0ab-ddba-46cc-a703-a7a4b08de310';
|
||||
const MX_CHECK_FAILED_ERROR = 'bf447c1c-0266-4e10-9c6c-573df282e413';
|
||||
const HOST_CHECK_FAILED_ERROR = '7da53a8b-56f3-4288-bb3e-ee9ede4ef9a1';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::INVALID_FORMAT_ERROR => 'STRICT_CHECK_FAILED_ERROR',
|
||||
|
|
|
@ -93,7 +93,7 @@ class EmailValidator extends ConstraintValidator
|
|||
return;
|
||||
}
|
||||
|
||||
$host = substr($value, strpos($value, '@') + 1);
|
||||
$host = substr($value, strrpos($value, '@') + 1);
|
||||
|
||||
// Check for host DNS resource records
|
||||
if ($constraint->checkMX) {
|
||||
|
|
|
@ -16,8 +16,15 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class EqualTo extends AbstractComparison
|
||||
{
|
||||
const NOT_EQUAL_ERROR = '478618a7-95ba-473d-9101-cabd45e49115';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::NOT_EQUAL_ERROR => 'NOT_EQUAL_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value should be equal to {{ compared_value }}.';
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
* Validates values are equal (==).
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class EqualToValidator extends AbstractComparisonValidator
|
||||
{
|
||||
|
@ -25,4 +26,12 @@ class EqualToValidator extends AbstractComparisonValidator
|
|||
{
|
||||
return $value1 == $value2;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getErrorCode()
|
||||
{
|
||||
return EqualTo::NOT_EQUAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,12 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class Expression extends Constraint
|
||||
{
|
||||
const EXPRESSION_FAILED_ERROR = '6b3befbc-2f01-4ddf-be21-b57898905284';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::EXPRESSION_FAILED_ERROR => 'EXPRESSION_FAILED_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value is not valid.';
|
||||
public $expression;
|
||||
|
||||
|
|
|
@ -37,18 +37,10 @@ class ExpressionValidator extends ConstraintValidator
|
|||
*/
|
||||
private $expressionLanguage;
|
||||
|
||||
/**
|
||||
* @param PropertyAccessorInterface|null $propertyAccessor Optional as of Symfony 2.5
|
||||
*
|
||||
* @throws UnexpectedTypeException If the property accessor is invalid
|
||||
*/
|
||||
public function __construct($propertyAccessor = null)
|
||||
public function __construct(PropertyAccessorInterface $propertyAccessor = null, ExpressionLanguage $expressionLanguage = null)
|
||||
{
|
||||
if (null !== $propertyAccessor && !$propertyAccessor instanceof PropertyAccessorInterface) {
|
||||
throw new UnexpectedTypeException($propertyAccessor, 'null or \Symfony\Component\PropertyAccess\PropertyAccessorInterface');
|
||||
}
|
||||
|
||||
$this->propertyAccessor = $propertyAccessor;
|
||||
$this->expressionLanguage = $expressionLanguage;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,10 +80,12 @@ class ExpressionValidator extends ConstraintValidator
|
|||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Expression::EXPRESSION_FAILED_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Expression::EXPRESSION_FAILED_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
|
10
vendor/symfony/validator/Constraints/File.php
vendored
10
vendor/symfony/validator/Constraints/File.php
vendored
|
@ -24,11 +24,11 @@ class File extends Constraint
|
|||
{
|
||||
// Check the Image constraint for clashes if adding new constants here
|
||||
|
||||
const NOT_FOUND_ERROR = 1;
|
||||
const NOT_READABLE_ERROR = 2;
|
||||
const EMPTY_ERROR = 3;
|
||||
const TOO_LARGE_ERROR = 4;
|
||||
const INVALID_MIME_TYPE_ERROR = 5;
|
||||
const NOT_FOUND_ERROR = 'd2a3fb6e-7ddc-4210-8fbf-2ab345ce1998';
|
||||
const NOT_READABLE_ERROR = 'c20c92a4-5bfa-4202-9477-28e800e0f6ff';
|
||||
const EMPTY_ERROR = '5d743385-9775-4aa5-8ff5-495fb1e60137';
|
||||
const TOO_LARGE_ERROR = 'df8637af-d466-48c6-a59d-e7126250a654';
|
||||
const INVALID_MIME_TYPE_ERROR = '744f00bc-4389-4c74-92de-9a43cde55534';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::NOT_FOUND_ERROR => 'NOT_FOUND_ERROR',
|
||||
|
|
|
@ -16,8 +16,15 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class GreaterThan extends AbstractComparison
|
||||
{
|
||||
const TOO_LOW_ERROR = '778b7ae0-84d3-481a-9dec-35fdb64b1d78';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::TOO_LOW_ERROR => 'TOO_LOW_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value should be greater than {{ compared_value }}.';
|
||||
}
|
||||
|
|
|
@ -16,8 +16,15 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class GreaterThanOrEqual extends AbstractComparison
|
||||
{
|
||||
const TOO_LOW_ERROR = 'ea4e51d1-3342-48bd-87f1-9e672cd90cad';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::TOO_LOW_ERROR => 'TOO_LOW_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value should be greater than or equal to {{ compared_value }}.';
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
* Validates values are greater than or equal to the previous (>=).
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class GreaterThanOrEqualValidator extends AbstractComparisonValidator
|
||||
{
|
||||
|
@ -25,4 +26,12 @@ class GreaterThanOrEqualValidator extends AbstractComparisonValidator
|
|||
{
|
||||
return $value1 >= $value2;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getErrorCode()
|
||||
{
|
||||
return GreaterThanOrEqual::TOO_LOW_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
* Validates values are greater than the previous (>).
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class GreaterThanValidator extends AbstractComparisonValidator
|
||||
{
|
||||
|
@ -25,4 +26,12 @@ class GreaterThanValidator extends AbstractComparisonValidator
|
|||
{
|
||||
return $value1 > $value2;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getErrorCode()
|
||||
{
|
||||
return GreaterThan::TOO_LOW_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
*
|
||||
* @Annotation
|
||||
* @Target({"CLASS", "ANNOTATION"})
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class GroupSequenceProvider
|
||||
{
|
||||
|
|
14
vendor/symfony/validator/Constraints/Iban.php
vendored
14
vendor/symfony/validator/Constraints/Iban.php
vendored
|
@ -24,14 +24,14 @@ use Symfony\Component\Validator\Constraint;
|
|||
class Iban extends Constraint
|
||||
{
|
||||
/** @deprecated, to be removed in 3.0. */
|
||||
const TOO_SHORT_ERROR = 1;
|
||||
const INVALID_COUNTRY_CODE_ERROR = 2;
|
||||
const INVALID_CHARACTERS_ERROR = 3;
|
||||
const TOO_SHORT_ERROR = '88e5e319-0aeb-4979-a27e-3d9ce0c16166';
|
||||
const INVALID_COUNTRY_CODE_ERROR = 'de78ee2c-bd50-44e2-aec8-3d8228aeadb9';
|
||||
const INVALID_CHARACTERS_ERROR = '8d3d85e4-784f-4719-a5bc-d9e40d45a3a5';
|
||||
/** @deprecated, to be removed in 3.0. */
|
||||
const INVALID_CASE_ERROR = 4;
|
||||
const CHECKSUM_FAILED_ERROR = 5;
|
||||
const INVALID_FORMAT_ERROR = 6;
|
||||
const NOT_SUPPORTED_COUNTRY_CODE_ERROR = 7;
|
||||
const INVALID_CASE_ERROR = 'f4bf62fe-03ec-42af-a53b-68e21b1e7274';
|
||||
const CHECKSUM_FAILED_ERROR = 'b9401321-f9bf-4dcb-83c1-f31094440795';
|
||||
const INVALID_FORMAT_ERROR = 'c8d318f1-2ecc-41ba-b983-df70d225cf5a';
|
||||
const NOT_SUPPORTED_COUNTRY_CODE_ERROR = 'e2c259f3-4b46-48e6-b72e-891658158ec8';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR',
|
||||
|
|
|
@ -16,8 +16,15 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class IdenticalTo extends AbstractComparison
|
||||
{
|
||||
const NOT_IDENTICAL_ERROR = '2a8cc50f-58a2-4536-875e-060a2ce69ed5';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::NOT_IDENTICAL_ERROR => 'NOT_IDENTICAL_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.';
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
* Validates values are identical (===).
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class IdenticalToValidator extends AbstractComparisonValidator
|
||||
{
|
||||
|
@ -25,4 +26,12 @@ class IdenticalToValidator extends AbstractComparisonValidator
|
|||
{
|
||||
return $value1 === $value2;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getErrorCode()
|
||||
{
|
||||
return IdenticalTo::NOT_IDENTICAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
22
vendor/symfony/validator/Constraints/Image.php
vendored
22
vendor/symfony/validator/Constraints/Image.php
vendored
|
@ -20,18 +20,16 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
*/
|
||||
class Image extends File
|
||||
{
|
||||
// Don't reuse values used in File
|
||||
|
||||
const SIZE_NOT_DETECTED_ERROR = 10;
|
||||
const TOO_WIDE_ERROR = 11;
|
||||
const TOO_NARROW_ERROR = 12;
|
||||
const TOO_HIGH_ERROR = 13;
|
||||
const TOO_LOW_ERROR = 14;
|
||||
const RATIO_TOO_BIG_ERROR = 15;
|
||||
const RATIO_TOO_SMALL_ERROR = 16;
|
||||
const SQUARE_NOT_ALLOWED_ERROR = 17;
|
||||
const LANDSCAPE_NOT_ALLOWED_ERROR = 18;
|
||||
const PORTRAIT_NOT_ALLOWED_ERROR = 19;
|
||||
const SIZE_NOT_DETECTED_ERROR = '6d55c3f4-e58e-4fe3-91ee-74b492199956';
|
||||
const TOO_WIDE_ERROR = '7f87163d-878f-47f5-99ba-a8eb723a1ab2';
|
||||
const TOO_NARROW_ERROR = '9afbd561-4f90-4a27-be62-1780fc43604a';
|
||||
const TOO_HIGH_ERROR = '7efae81c-4877-47ba-aa65-d01ccb0d4645';
|
||||
const TOO_LOW_ERROR = 'aef0cb6a-c07f-4894-bc08-1781420d7b4c';
|
||||
const RATIO_TOO_BIG_ERROR = '70cafca6-168f-41c9-8c8c-4e47a52be643';
|
||||
const RATIO_TOO_SMALL_ERROR = '59b8c6ef-bcf2-4ceb-afff-4642ed92f12e';
|
||||
const SQUARE_NOT_ALLOWED_ERROR = '5d41425b-facb-47f7-a55a-de9fbe45cb46';
|
||||
const LANDSCAPE_NOT_ALLOWED_ERROR = '6f895685-7cf2-4d65-b3da-9029c5581d88';
|
||||
const PORTRAIT_NOT_ALLOWED_ERROR = '65608156-77da-4c79-a88c-02ef6d18c782';
|
||||
|
||||
// Include the mapping from the base class
|
||||
|
||||
|
|
6
vendor/symfony/validator/Constraints/Ip.php
vendored
6
vendor/symfony/validator/Constraints/Ip.php
vendored
|
@ -44,6 +44,8 @@ class Ip extends Constraint
|
|||
const V6_ONLY_PUBLIC = '6_public';
|
||||
const ALL_ONLY_PUBLIC = 'all_public';
|
||||
|
||||
const INVALID_IP_ERROR = 'b1b427ae-9f6f-41b0-aa9b-84511fbb3c5b';
|
||||
|
||||
protected static $versions = array(
|
||||
self::V4,
|
||||
self::V6,
|
||||
|
@ -62,6 +64,10 @@ class Ip extends Constraint
|
|||
self::ALL_ONLY_PUBLIC,
|
||||
);
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::INVALID_IP_ERROR => 'INVALID_IP_ERROR',
|
||||
);
|
||||
|
||||
public $version = self::V4;
|
||||
|
||||
public $message = 'This is not a valid IP address.';
|
||||
|
|
|
@ -97,10 +97,12 @@ class IpValidator extends ConstraintValidator
|
|||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Ip::INVALID_IP_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Ip::INVALID_IP_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,5 +21,11 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class IsFalse extends Constraint
|
||||
{
|
||||
const NOT_FALSE_ERROR = 'd53a91b0-def3-426a-83d7-269da7ab4200';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::NOT_FALSE_ERROR => 'NOT_FALSE_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value should be false.';
|
||||
}
|
||||
|
|
|
@ -37,10 +37,12 @@ class IsFalseValidator extends ConstraintValidator
|
|||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(IsFalse::NOT_FALSE_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(IsFalse::NOT_FALSE_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,5 +21,11 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class IsNull extends Constraint
|
||||
{
|
||||
const NOT_NULL_ERROR = '60d2f30b-8cfa-4372-b155-9656634de120';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::NOT_NULL_ERROR => 'NOT_NULL_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value should be null.';
|
||||
}
|
||||
|
|
|
@ -34,10 +34,12 @@ class IsNullValidator extends ConstraintValidator
|
|||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(IsNull::NOT_NULL_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(IsNull::NOT_NULL_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,5 +21,11 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class IsTrue extends Constraint
|
||||
{
|
||||
const NOT_TRUE_ERROR = '2beabf1c-54c0-4882-a928-05249b26e23b';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::NOT_TRUE_ERROR => 'NOT_TRUE_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value should be true.';
|
||||
}
|
||||
|
|
|
@ -38,10 +38,12 @@ class IsTrueValidator extends ConstraintValidator
|
|||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(IsTrue::NOT_TRUE_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(IsTrue::NOT_TRUE_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
|
10
vendor/symfony/validator/Constraints/Isbn.php
vendored
10
vendor/symfony/validator/Constraints/Isbn.php
vendored
|
@ -23,11 +23,11 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class Isbn extends Constraint
|
||||
{
|
||||
const TOO_SHORT_ERROR = 1;
|
||||
const TOO_LONG_ERROR = 2;
|
||||
const INVALID_CHARACTERS_ERROR = 3;
|
||||
const CHECKSUM_FAILED_ERROR = 4;
|
||||
const TYPE_NOT_RECOGNIZED_ERROR = 5;
|
||||
const TOO_SHORT_ERROR = '949acbb0-8ef5-43ed-a0e9-032dfd08ae45';
|
||||
const TOO_LONG_ERROR = '3171387d-f80a-47b3-bd6e-60598545316a';
|
||||
const INVALID_CHARACTERS_ERROR = '23d21cea-da99-453d-98b1-a7d916fbb339';
|
||||
const CHECKSUM_FAILED_ERROR = '2881c032-660f-46b6-8153-d352d9706640';
|
||||
const TYPE_NOT_RECOGNIZED_ERROR = 'fa54a457-f042-441f-89c4-066ee5bdd3e1';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR',
|
||||
|
|
12
vendor/symfony/validator/Constraints/Issn.php
vendored
12
vendor/symfony/validator/Constraints/Issn.php
vendored
|
@ -22,12 +22,12 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class Issn extends Constraint
|
||||
{
|
||||
const TOO_SHORT_ERROR = 1;
|
||||
const TOO_LONG_ERROR = 2;
|
||||
const MISSING_HYPHEN_ERROR = 3;
|
||||
const INVALID_CHARACTERS_ERROR = 4;
|
||||
const INVALID_CASE_ERROR = 5;
|
||||
const CHECKSUM_FAILED_ERROR = 6;
|
||||
const TOO_SHORT_ERROR = '6a20dd3d-f463-4460-8e7b-18a1b98abbfb';
|
||||
const TOO_LONG_ERROR = '37cef893-5871-464e-8b12-7fb79324833c';
|
||||
const MISSING_HYPHEN_ERROR = '2983286f-8134-4693-957a-1ec4ef887b15';
|
||||
const INVALID_CHARACTERS_ERROR = 'a663d266-37c2-4ece-a914-ae891940c588';
|
||||
const INVALID_CASE_ERROR = '7b6dd393-7523-4a6c-b84d-72b91bba5e1a';
|
||||
const CHECKSUM_FAILED_ERROR = 'b0f92dbc-667c-48de-b526-ad9586d43e85';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR',
|
||||
|
|
|
@ -21,5 +21,11 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class Language extends Constraint
|
||||
{
|
||||
const NO_SUCH_LANGUAGE_ERROR = 'ee65fec4-9a20-4202-9f39-ca558cd7bdf7';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::NO_SUCH_LANGUAGE_ERROR => 'NO_SUCH_LANGUAGE_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value is not a valid language.';
|
||||
}
|
||||
|
|
|
@ -48,10 +48,12 @@ class LanguageValidator extends ConstraintValidator
|
|||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Language::NO_SUCH_LANGUAGE_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Language::NO_SUCH_LANGUAGE_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,12 +22,14 @@ use Symfony\Component\Validator\Exception\MissingOptionsException;
|
|||
*/
|
||||
class Length extends Constraint
|
||||
{
|
||||
const TOO_SHORT_ERROR = 1;
|
||||
const TOO_LONG_ERROR = 2;
|
||||
const TOO_SHORT_ERROR = '9ff3fdc4-b214-49db-8718-39c315e33d45';
|
||||
const TOO_LONG_ERROR = 'd94b19cc-114f-4f44-9cc4-4138e80a87b9';
|
||||
const INVALID_CHARACTERS_ERROR = '35e6a710-aa2e-4719-b58e-24b35749b767';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR',
|
||||
self::TOO_LONG_ERROR => 'TOO_LONG_ERROR',
|
||||
self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR',
|
||||
);
|
||||
|
||||
public $maxMessage = 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.';
|
||||
|
|
|
@ -39,32 +39,13 @@ class LengthValidator extends ConstraintValidator
|
|||
}
|
||||
|
||||
$stringValue = (string) $value;
|
||||
$invalidCharset = false;
|
||||
|
||||
if ('UTF8' === $charset = strtoupper($constraint->charset)) {
|
||||
$charset = 'UTF-8';
|
||||
$charset = 'UTF-8'; // iconv on Windows requires "UTF-8" instead of "UTF8"
|
||||
}
|
||||
|
||||
if ('UTF-8' === $charset) {
|
||||
if (!preg_match('//u', $stringValue)) {
|
||||
$invalidCharset = true;
|
||||
} elseif (function_exists('utf8_decode')) {
|
||||
$length = strlen(utf8_decode($stringValue));
|
||||
} else {
|
||||
preg_replace('/./u', '', $stringValue, -1, $length);
|
||||
}
|
||||
} elseif (function_exists('mb_strlen')) {
|
||||
if (@mb_check_encoding($stringValue, $constraint->charset)) {
|
||||
$length = mb_strlen($stringValue, $constraint->charset);
|
||||
} else {
|
||||
$invalidCharset = true;
|
||||
}
|
||||
} elseif (function_exists('iconv_strlen')) {
|
||||
$length = @iconv_strlen($stringValue, $constraint->charset);
|
||||
$invalidCharset = false === $length;
|
||||
} else {
|
||||
$length = strlen($stringValue);
|
||||
}
|
||||
$length = @iconv_strlen($stringValue, $charset);
|
||||
$invalidCharset = false === $length;
|
||||
|
||||
if ($invalidCharset) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
|
@ -72,12 +53,14 @@ class LengthValidator extends ConstraintValidator
|
|||
->setParameter('{{ value }}', $this->formatValue($stringValue))
|
||||
->setParameter('{{ charset }}', $constraint->charset)
|
||||
->setInvalidValue($value)
|
||||
->setCode(Length::INVALID_CHARACTERS_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->charsetMessage)
|
||||
->setParameter('{{ value }}', $this->formatValue($stringValue))
|
||||
->setParameter('{{ charset }}', $constraint->charset)
|
||||
->setInvalidValue($value)
|
||||
->setCode(Length::INVALID_CHARACTERS_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,15 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class LessThan extends AbstractComparison
|
||||
{
|
||||
const TOO_HIGH_ERROR = '079d7420-2d13-460c-8756-de810eeb37d2';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value should be less than {{ compared_value }}.';
|
||||
}
|
||||
|
|
|
@ -16,8 +16,15 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class LessThanOrEqual extends AbstractComparison
|
||||
{
|
||||
const TOO_HIGH_ERROR = '079d7420-2d13-460c-8756-de810eeb37d2';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value should be less than or equal to {{ compared_value }}.';
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
* Validates values are less than or equal to the previous (<=).
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class LessThanOrEqualValidator extends AbstractComparisonValidator
|
||||
{
|
||||
|
@ -25,4 +26,12 @@ class LessThanOrEqualValidator extends AbstractComparisonValidator
|
|||
{
|
||||
return $value1 <= $value2;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getErrorCode()
|
||||
{
|
||||
return LessThanOrEqual::TOO_HIGH_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
* Validates values are less than the previous (<).
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class LessThanValidator extends AbstractComparisonValidator
|
||||
{
|
||||
|
@ -25,4 +26,12 @@ class LessThanValidator extends AbstractComparisonValidator
|
|||
{
|
||||
return $value1 < $value2;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getErrorCode()
|
||||
{
|
||||
return LessThan::TOO_HIGH_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,5 +21,11 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class Locale extends Constraint
|
||||
{
|
||||
const NO_SUCH_LOCALE_ERROR = 'a0af4293-1f1a-4a1c-a328-979cba6182a2';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::NO_SUCH_LOCALE_ERROR => 'NO_SUCH_LOCALE_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value is not a valid locale.';
|
||||
}
|
||||
|
|
|
@ -43,15 +43,18 @@ class LocaleValidator extends ConstraintValidator
|
|||
|
||||
$value = (string) $value;
|
||||
$locales = Intl::getLocaleBundle()->getLocaleNames();
|
||||
$aliases = Intl::getLocaleBundle()->getAliases();
|
||||
|
||||
if (!isset($locales[$value])) {
|
||||
if (!isset($locales[$value]) && !in_array($value, $aliases)) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Locale::NO_SUCH_LOCALE_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Locale::NO_SUCH_LOCALE_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class Luhn extends Constraint
|
||||
{
|
||||
const INVALID_CHARACTERS_ERROR = 1;
|
||||
const CHECKSUM_FAILED_ERROR = 2;
|
||||
const INVALID_CHARACTERS_ERROR = 'dfad6d23-1b74-4374-929b-5cbb56fc0d9e';
|
||||
const CHECKSUM_FAILED_ERROR = '4d760774-3f50-4cd5-a6d5-b10a3299d8d3';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR',
|
||||
|
|
|
@ -21,5 +21,11 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class NotBlank extends Constraint
|
||||
{
|
||||
const IS_BLANK_ERROR = 'c1051bb4-d103-4f74-8988-acbcafc7fdc3';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::IS_BLANK_ERROR => 'IS_BLANK_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value should not be blank.';
|
||||
}
|
||||
|
|
|
@ -34,10 +34,12 @@ class NotBlankValidator extends ConstraintValidator
|
|||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(NotBlank::IS_BLANK_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(NotBlank::IS_BLANK_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,15 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class NotEqualTo extends AbstractComparison
|
||||
{
|
||||
const IS_EQUAL_ERROR = 'aa2e33da-25c8-4d76-8c6c-812f02ea89dd';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::IS_EQUAL_ERROR => 'IS_EQUAL_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value should not be equal to {{ compared_value }}.';
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
* Validates values are all unequal (!=).
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class NotEqualToValidator extends AbstractComparisonValidator
|
||||
{
|
||||
|
@ -25,4 +26,12 @@ class NotEqualToValidator extends AbstractComparisonValidator
|
|||
{
|
||||
return $value1 != $value2;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getErrorCode()
|
||||
{
|
||||
return NotEqualTo::IS_EQUAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,15 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class NotIdenticalTo extends AbstractComparison
|
||||
{
|
||||
const IS_IDENTICAL_ERROR = '4aaac518-0dda-4129-a6d9-e216b9b454a0';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::IS_IDENTICAL_ERROR => 'IS_IDENTICAL_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.';
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
* Validates values aren't identical (!==).
|
||||
*
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class NotIdenticalToValidator extends AbstractComparisonValidator
|
||||
{
|
||||
|
@ -25,4 +26,12 @@ class NotIdenticalToValidator extends AbstractComparisonValidator
|
|||
{
|
||||
return $value1 !== $value2;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getErrorCode()
|
||||
{
|
||||
return NotIdenticalTo::IS_IDENTICAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,5 +21,11 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class NotNull extends Constraint
|
||||
{
|
||||
const IS_NULL_ERROR = 'ad32d13f-c3d4-423b-909a-857b961eb720';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::IS_NULL_ERROR => 'IS_NULL_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value should not be null.';
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Symfony\Component\Validator\Constraints;
|
|||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
|
||||
/**
|
||||
|
@ -30,7 +31,17 @@ class NotNullValidator extends ConstraintValidator
|
|||
}
|
||||
|
||||
if (null === $value) {
|
||||
$this->context->addViolation($constraint->message);
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(NotNull::IS_NULL_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(NotNull::IS_NULL_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
30
vendor/symfony/validator/Constraints/Range.php
vendored
30
vendor/symfony/validator/Constraints/Range.php
vendored
|
@ -22,14 +22,32 @@ use Symfony\Component\Validator\Exception\MissingOptionsException;
|
|||
*/
|
||||
class Range extends Constraint
|
||||
{
|
||||
const INVALID_VALUE_ERROR = 1;
|
||||
const BEYOND_RANGE_ERROR = 2;
|
||||
const BELOW_RANGE_ERROR = 3;
|
||||
const INVALID_CHARACTERS_ERROR = 'ad9a9798-7a99-4df7-8ce9-46e416a1e60b';
|
||||
const TOO_HIGH_ERROR = '2d28afcb-e32e-45fb-a815-01c431a86a69';
|
||||
const TOO_LOW_ERROR = '76454e69-502c-46c5-9643-f447d837c4d5';
|
||||
|
||||
/**
|
||||
* @deprecated Deprecated since version 2.8, to be removed in 3.0. Use
|
||||
* {@link INVALID_CHARACTERS_ERROR} instead.
|
||||
*/
|
||||
const INVALID_VALUE_ERROR = self::INVALID_CHARACTERS_ERROR;
|
||||
|
||||
/**
|
||||
* @deprecated Deprecated since version 2.8, to be removed in 3.0. Use
|
||||
* {@link TOO_HIGH_ERROR} instead.
|
||||
*/
|
||||
const BEYOND_RANGE_ERROR = self::TOO_HIGH_ERROR;
|
||||
|
||||
/**
|
||||
* @deprecated Deprecated since version 2.8, to be removed in 3.0. Use
|
||||
* {@link TOO_LOW_ERROR} instead.
|
||||
*/
|
||||
const BELOW_RANGE_ERROR = self::TOO_LOW_ERROR;
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::INVALID_VALUE_ERROR => 'INVALID_VALUE_ERROR',
|
||||
self::BEYOND_RANGE_ERROR => 'BEYOND_RANGE_ERROR',
|
||||
self::BELOW_RANGE_ERROR => 'BELOW_RANGE_ERROR',
|
||||
self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR',
|
||||
self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR',
|
||||
self::TOO_LOW_ERROR => 'TOO_LOW_ERROR',
|
||||
);
|
||||
|
||||
public $minMessage = 'This value should be {{ limit }} or more.';
|
||||
|
|
|
@ -38,12 +38,12 @@ class RangeValidator extends ConstraintValidator
|
|||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->invalidMessage)
|
||||
->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE))
|
||||
->setCode(Range::INVALID_VALUE_ERROR)
|
||||
->setCode(Range::INVALID_CHARACTERS_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->invalidMessage)
|
||||
->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE))
|
||||
->setCode(Range::INVALID_VALUE_ERROR)
|
||||
->setCode(Range::INVALID_CHARACTERS_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
|
||||
|
@ -72,13 +72,13 @@ class RangeValidator extends ConstraintValidator
|
|||
$this->context->buildViolation($constraint->maxMessage)
|
||||
->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE))
|
||||
->setParameter('{{ limit }}', $this->formatValue($max, self::PRETTY_DATE))
|
||||
->setCode(Range::BEYOND_RANGE_ERROR)
|
||||
->setCode(Range::TOO_HIGH_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->maxMessage)
|
||||
->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE))
|
||||
->setParameter('{{ limit }}', $this->formatValue($max, self::PRETTY_DATE))
|
||||
->setCode(Range::BEYOND_RANGE_ERROR)
|
||||
->setCode(Range::TOO_HIGH_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
|
||||
|
@ -90,13 +90,13 @@ class RangeValidator extends ConstraintValidator
|
|||
$this->context->buildViolation($constraint->minMessage)
|
||||
->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE))
|
||||
->setParameter('{{ limit }}', $this->formatValue($min, self::PRETTY_DATE))
|
||||
->setCode(Range::BELOW_RANGE_ERROR)
|
||||
->setCode(Range::TOO_LOW_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->minMessage)
|
||||
->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE))
|
||||
->setParameter('{{ limit }}', $this->formatValue($min, self::PRETTY_DATE))
|
||||
->setCode(Range::BELOW_RANGE_ERROR)
|
||||
->setCode(Range::TOO_LOW_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,12 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class Regex extends Constraint
|
||||
{
|
||||
const REGEX_FAILED_ERROR = 'de1e3db3-5ed4-4941-aae4-59f3667cc3a3';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::REGEX_FAILED_ERROR => 'REGEX_FAILED_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value is not valid.';
|
||||
public $pattern;
|
||||
public $htmlPattern;
|
||||
|
|
|
@ -47,10 +47,12 @@ class RegexValidator extends ConstraintValidator
|
|||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Regex::REGEX_FAILED_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Regex::REGEX_FAILED_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class Time extends Constraint
|
||||
{
|
||||
const INVALID_FORMAT_ERROR = 1;
|
||||
const INVALID_TIME_ERROR = 2;
|
||||
const INVALID_FORMAT_ERROR = '9d27b2bb-f755-4fbf-b725-39b1edbdebdf';
|
||||
const INVALID_TIME_ERROR = '8532f9e1-84b2-4d67-8989-0818bc38533b';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR',
|
||||
|
|
|
@ -21,6 +21,12 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class Type extends Constraint
|
||||
{
|
||||
const INVALID_TYPE_ERROR = 'ba785a8c-82cb-4283-967c-3cf342181b40';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::INVALID_TYPE_ERROR => 'INVALID_TYPE_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value should be of type {{ type }}.';
|
||||
public $type;
|
||||
|
||||
|
|
|
@ -51,11 +51,13 @@ class TypeValidator extends ConstraintValidator
|
|||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setParameter('{{ type }}', $constraint->type)
|
||||
->setCode(Type::INVALID_TYPE_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setParameter('{{ type }}', $constraint->type)
|
||||
->setCode(Type::INVALID_TYPE_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
|
6
vendor/symfony/validator/Constraints/Url.php
vendored
6
vendor/symfony/validator/Constraints/Url.php
vendored
|
@ -21,6 +21,12 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class Url extends Constraint
|
||||
{
|
||||
const INVALID_URL_ERROR = '57c2f299-1154-4870-89bb-ef3b1f5ad229';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::INVALID_URL_ERROR => 'INVALID_URL_ERROR',
|
||||
);
|
||||
|
||||
public $message = 'This value is not a valid URL.';
|
||||
public $dnsMessage = 'The host could not be resolved.';
|
||||
public $protocols = array('http', 'https');
|
||||
|
|
|
@ -34,7 +34,7 @@ class UrlValidator extends ConstraintValidator
|
|||
\] # a IPv6 address
|
||||
)
|
||||
(:[0-9]+)? # a port (optional)
|
||||
(/?|/\S+|\?|\#) # a /, nothing, a / with something, a query or a fragment
|
||||
(/?|/\S+|\?\S*|\#\S*) # a /, nothing, a / with something, a query or a fragment
|
||||
$~ixu';
|
||||
|
||||
/**
|
||||
|
@ -65,10 +65,12 @@ class UrlValidator extends ConstraintValidator
|
|||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Url::INVALID_URL_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Url::INVALID_URL_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
|
||||
|
@ -81,12 +83,14 @@ class UrlValidator extends ConstraintValidator
|
|||
if (!checkdnsrr($host, 'ANY')) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->dnsMessage)
|
||||
->setParameter('{{ value }}', $this->formatValue($host))
|
||||
->addViolation();
|
||||
->setParameter('{{ value }}', $this->formatValue($host))
|
||||
->setCode(Url::INVALID_URL_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->dnsMessage)
|
||||
->setParameter('{{ value }}', $this->formatValue($host))
|
||||
->addViolation();
|
||||
->setParameter('{{ value }}', $this->formatValue($host))
|
||||
->setCode(Url::INVALID_URL_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
12
vendor/symfony/validator/Constraints/Uuid.php
vendored
12
vendor/symfony/validator/Constraints/Uuid.php
vendored
|
@ -21,12 +21,12 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class Uuid extends Constraint
|
||||
{
|
||||
const TOO_SHORT_ERROR = 1;
|
||||
const TOO_LONG_ERROR = 2;
|
||||
const INVALID_CHARACTERS_ERROR = 3;
|
||||
const INVALID_HYPHEN_PLACEMENT_ERROR = 4;
|
||||
const INVALID_VERSION_ERROR = 5;
|
||||
const INVALID_VARIANT_ERROR = 6;
|
||||
const TOO_SHORT_ERROR = 'aa314679-dac9-4f54-bf97-b2049df8f2a3';
|
||||
const TOO_LONG_ERROR = '494897dd-36f8-4d31-8923-71a8d5f3000d';
|
||||
const INVALID_CHARACTERS_ERROR = '51120b12-a2bc-41bf-aa53-cd73daf330d0';
|
||||
const INVALID_HYPHEN_PLACEMENT_ERROR = '98469c83-0309-4f5d-bf95-a496dcaa869c';
|
||||
const INVALID_VERSION_ERROR = '21ba13b4-b185-4882-ac6f-d147355987eb';
|
||||
const INVALID_VARIANT_ERROR = '164ef693-2b9d-46de-ad7f-836201f0c2db';
|
||||
|
||||
protected static $errorNames = array(
|
||||
self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR',
|
||||
|
|
Reference in a new issue