Update to Drupal 8.2.6. For more information, see https://www.drupal.org/project/drupal/releases/8.2.6
This commit is contained in:
parent
db56c09587
commit
f1e72395cb
588 changed files with 26857 additions and 2777 deletions
|
@ -24,7 +24,7 @@ interface ClassBasedInterface
|
|||
/**
|
||||
* Returns the name of the backing PHP class.
|
||||
*
|
||||
* @return string The name of the backing class.
|
||||
* @return string The name of the backing class
|
||||
*/
|
||||
public function getClassName();
|
||||
}
|
||||
|
|
7
vendor/symfony/validator/Constraint.php
vendored
7
vendor/symfony/validator/Constraint.php
vendored
|
@ -129,6 +129,9 @@ abstract class Constraint
|
|||
unset($options['value']);
|
||||
}
|
||||
|
||||
if (is_array($options)) {
|
||||
reset($options);
|
||||
}
|
||||
if (is_array($options) && count($options) > 0 && is_string(key($options))) {
|
||||
foreach ($options as $option => $value) {
|
||||
if (array_key_exists($option, $knownOptions)) {
|
||||
|
@ -207,8 +210,6 @@ abstract class Constraint
|
|||
* @throws InvalidOptionsException If an invalid option name is given
|
||||
*
|
||||
* @internal This method should not be used or overwritten in userland code.
|
||||
*
|
||||
* @since 2.6
|
||||
*/
|
||||
public function __get($option)
|
||||
{
|
||||
|
@ -296,8 +297,6 @@ abstract class Constraint
|
|||
* @internal This method may be replaced by an implementation of
|
||||
* {@link \Serializable} in the future. Please don't use or
|
||||
* overwrite it.
|
||||
*
|
||||
* @since 2.6
|
||||
*/
|
||||
public function __sleep()
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface
|
|||
const OBJECT_TO_STRING = 2;
|
||||
|
||||
/**
|
||||
* @var ExecutionContextInterface
|
||||
* @var ExecutionContextInterface2Dot5
|
||||
*/
|
||||
protected $context;
|
||||
|
||||
|
@ -119,7 +119,7 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface
|
|||
* (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped
|
||||
* in double quotes ("). Objects, arrays and resources are formatted as
|
||||
* "object", "array" and "resource". If the $format bitmask contains
|
||||
* the PRETTY_DATE bit, then {@link \DateTime} objects will be formatted
|
||||
* the PRETTY_DATE bit, then {@link \DateTime} objects will be formatted
|
||||
* as RFC-3339 dates ("Y-m-d H:i:s").
|
||||
*
|
||||
* Be careful when passing message parameters to a constraint violation
|
||||
|
|
|
@ -105,7 +105,7 @@ class ConstraintViolation implements ConstraintViolationInterface
|
|||
/**
|
||||
* Converts the violation into a string for debugging purposes.
|
||||
*
|
||||
* @return string The violation as string.
|
||||
* @return string The violation as string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ interface ConstraintViolationInterface
|
|||
/**
|
||||
* Returns the violation message.
|
||||
*
|
||||
* @return string The violation message.
|
||||
* @return string The violation message
|
||||
*/
|
||||
public function getMessage();
|
||||
|
||||
|
@ -49,7 +49,7 @@ interface ConstraintViolationInterface
|
|||
* returned by {@link getMessageParameters}. Typically you'll pass the
|
||||
* message template and parameters to a translation engine.
|
||||
*
|
||||
* @return string The raw violation message.
|
||||
* @return string The raw violation message
|
||||
*/
|
||||
public function getMessageTemplate();
|
||||
|
||||
|
@ -78,7 +78,7 @@ interface ConstraintViolationInterface
|
|||
* This method returns the value of the parameter for choosing the right
|
||||
* pluralization form (in this case "choices").
|
||||
*
|
||||
* @return int|null The number to use to pluralize of the message.
|
||||
* @return int|null The number to use to pluralize of the message
|
||||
*
|
||||
* @deprecated since version 2.7, to be replaced by getPlural() in 3.0.
|
||||
*/
|
||||
|
@ -119,7 +119,7 @@ interface ConstraintViolationInterface
|
|||
/**
|
||||
* Returns a machine-digestible error code for the violation.
|
||||
*
|
||||
* @return string|null The error code.
|
||||
* @return string|null The error code
|
||||
*/
|
||||
public function getCode();
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class ConstraintViolationList implements \IteratorAggregate, ConstraintViolation
|
|||
/**
|
||||
* Converts the violation into a string for debugging purposes.
|
||||
*
|
||||
* @return string The violation as string.
|
||||
* @return string The violation as string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
|
@ -107,6 +107,8 @@ class ConstraintViolationList implements \IteratorAggregate, ConstraintViolation
|
|||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return \ArrayIterator|ConstraintViolationInterface[]
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
|
|
|
@ -21,23 +21,23 @@ interface ConstraintViolationListInterface extends \Traversable, \Countable, \Ar
|
|||
/**
|
||||
* Adds a constraint violation to this list.
|
||||
*
|
||||
* @param ConstraintViolationInterface $violation The violation to add.
|
||||
* @param ConstraintViolationInterface $violation The violation to add
|
||||
*/
|
||||
public function add(ConstraintViolationInterface $violation);
|
||||
|
||||
/**
|
||||
* Merges an existing violation list into this list.
|
||||
*
|
||||
* @param ConstraintViolationListInterface $otherList The list to merge.
|
||||
* @param ConstraintViolationListInterface $otherList The list to merge
|
||||
*/
|
||||
public function addAll(ConstraintViolationListInterface $otherList);
|
||||
|
||||
/**
|
||||
* Returns the violation at a given offset.
|
||||
*
|
||||
* @param int $offset The offset of the violation.
|
||||
* @param int $offset The offset of the violation
|
||||
*
|
||||
* @return ConstraintViolationInterface The violation.
|
||||
* @return ConstraintViolationInterface The violation
|
||||
*
|
||||
* @throws \OutOfBoundsException If the offset does not exist.
|
||||
*/
|
||||
|
@ -46,24 +46,24 @@ interface ConstraintViolationListInterface extends \Traversable, \Countable, \Ar
|
|||
/**
|
||||
* Returns whether the given offset exists.
|
||||
*
|
||||
* @param int $offset The violation offset.
|
||||
* @param int $offset The violation offset
|
||||
*
|
||||
* @return bool Whether the offset exists.
|
||||
* @return bool Whether the offset exists
|
||||
*/
|
||||
public function has($offset);
|
||||
|
||||
/**
|
||||
* Sets a violation at a given offset.
|
||||
*
|
||||
* @param int $offset The violation offset.
|
||||
* @param ConstraintViolationInterface $violation The violation.
|
||||
* @param int $offset The violation offset
|
||||
* @param ConstraintViolationInterface $violation The violation
|
||||
*/
|
||||
public function set($offset, ConstraintViolationInterface $violation);
|
||||
|
||||
/**
|
||||
* Removes a violation at a given offset.
|
||||
*
|
||||
* @param int $offset The offset to remove.
|
||||
* @param int $offset The offset to remove
|
||||
*/
|
||||
public function remove($offset);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ abstract class AbstractComparisonValidator extends ConstraintValidator
|
|||
// the DateTime constructor:
|
||||
// http://php.net/manual/en/datetime.formats.php
|
||||
if (is_string($comparedValue)) {
|
||||
if ($value instanceof \DatetimeImmutable) {
|
||||
if ($value instanceof \DateTimeImmutable) {
|
||||
// If $value is immutable, convert the compared value to a
|
||||
// DateTimeImmutable too
|
||||
$comparedValue = new \DatetimeImmutable($comparedValue);
|
||||
|
|
|
@ -23,8 +23,6 @@ class Callback extends Constraint
|
|||
{
|
||||
/**
|
||||
* @var string|callable
|
||||
*
|
||||
* @since 2.4
|
||||
*/
|
||||
public $callback;
|
||||
|
||||
|
|
|
@ -74,8 +74,10 @@ class CardSchemeValidator extends ConstraintValidator
|
|||
'/^6[0-9]{11,18}$/',
|
||||
),
|
||||
// All MasterCard numbers start with the numbers 51 through 55. All have 16 digits.
|
||||
// October 2016 MasterCard numbers can also start with 222100 through 272099.
|
||||
'MASTERCARD' => array(
|
||||
'/^5[1-5][0-9]{14}$/',
|
||||
'/^2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12})$/',
|
||||
),
|
||||
// All Visa card numbers start with a 4. New cards have 16 digits. Old cards have 13.
|
||||
'VISA' => array(
|
||||
|
|
|
@ -24,8 +24,6 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
|
|||
* let {@link getCompositeOption()} return the name of the property which
|
||||
* contains the nested constraints.
|
||||
*
|
||||
* @since 2.6
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
abstract class Composite extends Constraint
|
||||
|
|
|
@ -56,8 +56,8 @@ class EmailValidator extends ConstraintValidator
|
|||
}
|
||||
|
||||
if ($constraint->strict) {
|
||||
if (!class_exists('\Egulias\EmailValidator\EmailValidator')) {
|
||||
throw new RuntimeException('Strict email validation requires egulias/email-validator');
|
||||
if (!class_exists('\Egulias\EmailValidator\EmailValidator') || interface_exists('\Egulias\EmailValidator\Validation\EmailValidation')) {
|
||||
throw new RuntimeException('Strict email validation requires egulias/email-validator:~1.2');
|
||||
}
|
||||
|
||||
$strictValidator = new \Egulias\EmailValidator\EmailValidator();
|
||||
|
|
12
vendor/symfony/validator/Constraints/File.php
vendored
12
vendor/symfony/validator/Constraints/File.php
vendored
|
@ -88,20 +88,22 @@ class File extends Constraint
|
|||
|
||||
private function normalizeBinaryFormat($maxSize)
|
||||
{
|
||||
$sizeInt = (int) $maxSize;
|
||||
|
||||
if (ctype_digit((string) $maxSize)) {
|
||||
$this->maxSize = (int) $maxSize;
|
||||
$this->maxSize = $sizeInt;
|
||||
$this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat;
|
||||
} elseif (preg_match('/^\d++k$/i', $maxSize)) {
|
||||
$this->maxSize = $maxSize * 1000;
|
||||
$this->maxSize = $sizeInt * 1000;
|
||||
$this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat;
|
||||
} elseif (preg_match('/^\d++M$/i', $maxSize)) {
|
||||
$this->maxSize = $maxSize * 1000000;
|
||||
$this->maxSize = $sizeInt * 1000000;
|
||||
$this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat;
|
||||
} elseif (preg_match('/^\d++Ki$/i', $maxSize)) {
|
||||
$this->maxSize = $maxSize << 10;
|
||||
$this->maxSize = $sizeInt << 10;
|
||||
$this->binaryFormat = null === $this->binaryFormat ? true : $this->binaryFormat;
|
||||
} elseif (preg_match('/^\d++Mi$/i', $maxSize)) {
|
||||
$this->maxSize = $maxSize << 20;
|
||||
$this->maxSize = $sizeInt << 20;
|
||||
$this->binaryFormat = null === $this->binaryFormat ? true : $this->binaryFormat;
|
||||
} else {
|
||||
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size', $this->maxSize));
|
||||
|
|
|
@ -19,7 +19,7 @@ use Symfony\Component\Validator\Exception\OutOfBoundsException;
|
|||
* When validating a group sequence, each group will only be validated if all
|
||||
* of the previous groups in the sequence succeeded. For example:
|
||||
*
|
||||
* $validator->validate($address, null, new GroupSequence('Basic', 'Strict'));
|
||||
* $validator->validate($address, null, new GroupSequence(array('Basic', 'Strict')));
|
||||
*
|
||||
* In the first step, all constraints that belong to the group "Basic" will be
|
||||
* validated. If none of the constraints fail, the validator will then validate
|
||||
|
|
|
@ -21,7 +21,7 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
|||
* @author Michael Schummel
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @link http://www.michael-schummel.de/2007/10/05/iban-prufung-mit-php/
|
||||
* @see http://www.michael-schummel.de/2007/10/05/iban-prufung-mit-php/
|
||||
*/
|
||||
class IbanValidator extends ConstraintValidator
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ class IbanValidator extends ConstraintValidator
|
|||
* a BBAN (Basic Bank Account Number) which has a fixed length per country and,
|
||||
* included within it, a bank identifier with a fixed position and a fixed length per country
|
||||
*
|
||||
* @link http://www.swift.com/dsp/resources/documents/IBAN_Registry.pdf
|
||||
* @see http://www.swift.com/dsp/resources/documents/IBAN_Registry.pdf
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
|
|
@ -144,14 +144,14 @@ class IsbnValidator extends ConstraintValidator
|
|||
// If we test the length before the loop, we get an ERROR_TOO_SHORT
|
||||
// when actually an ERROR_INVALID_CHARACTERS is wanted, e.g. for
|
||||
// "0-45122_5244" (typo)
|
||||
if (!isset($isbn{$i})) {
|
||||
if (!isset($isbn[$i])) {
|
||||
return Isbn::TOO_SHORT_ERROR;
|
||||
}
|
||||
|
||||
if ('X' === $isbn{$i}) {
|
||||
if ('X' === $isbn[$i]) {
|
||||
$digit = 10;
|
||||
} elseif (ctype_digit($isbn{$i})) {
|
||||
$digit = $isbn{$i};
|
||||
} elseif (ctype_digit($isbn[$i])) {
|
||||
$digit = $isbn[$i];
|
||||
} else {
|
||||
return Isbn::INVALID_CHARACTERS_ERROR;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ class IsbnValidator extends ConstraintValidator
|
|||
$checkSum += $digit * (10 - $i);
|
||||
}
|
||||
|
||||
if (isset($isbn{$i})) {
|
||||
if (isset($isbn[$i])) {
|
||||
return Isbn::TOO_LONG_ERROR;
|
||||
}
|
||||
|
||||
|
@ -190,11 +190,11 @@ class IsbnValidator extends ConstraintValidator
|
|||
$checkSum = 0;
|
||||
|
||||
for ($i = 0; $i < 13; $i += 2) {
|
||||
$checkSum += $isbn{$i};
|
||||
$checkSum += $isbn[$i];
|
||||
}
|
||||
|
||||
for ($i = 1; $i < 12; $i += 2) {
|
||||
$checkSum += $isbn{$i}
|
||||
$checkSum += $isbn[$i]
|
||||
* 3;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class IssnValidator extends ConstraintValidator
|
|||
|
||||
// 1234-567X
|
||||
// ^
|
||||
if (isset($canonical{4}) && '-' === $canonical{4}) {
|
||||
if (isset($canonical[4]) && '-' === $canonical[4]) {
|
||||
// remove hyphen
|
||||
$canonical = substr($canonical, 0, 4).substr($canonical, 5);
|
||||
} elseif ($constraint->requireHyphen) {
|
||||
|
@ -121,7 +121,7 @@ class IssnValidator extends ConstraintValidator
|
|||
|
||||
// 1234567X
|
||||
// ^ digit, x or X
|
||||
if (!ctype_digit($canonical{7}) && 'x' !== $canonical{7} && 'X' !== $canonical{7}) {
|
||||
if (!ctype_digit($canonical[7]) && 'x' !== $canonical[7] && 'X' !== $canonical[7]) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
|
@ -139,7 +139,7 @@ class IssnValidator extends ConstraintValidator
|
|||
|
||||
// 1234567X
|
||||
// ^ case-sensitive?
|
||||
if ($constraint->caseSensitive && 'x' === $canonical{7}) {
|
||||
if ($constraint->caseSensitive && 'x' === $canonical[7]) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
|
@ -156,14 +156,14 @@ class IssnValidator extends ConstraintValidator
|
|||
}
|
||||
|
||||
// Calculate a checksum. "X" equals 10.
|
||||
$checkSum = 'X' === $canonical{7}
|
||||
|| 'x' === $canonical{7}
|
||||
$checkSum = 'X' === $canonical[7]
|
||||
|| 'x' === $canonical[7]
|
||||
? 10
|
||||
: $canonical{7};
|
||||
: $canonical[7];
|
||||
|
||||
for ($i = 0; $i < 7; ++$i) {
|
||||
// Multiply the first digit by 8, the second by 7, etc.
|
||||
$checkSum += (8 - $i) * $canonical{$i};
|
||||
$checkSum += (8 - $i) * $canonical[$i];
|
||||
}
|
||||
|
||||
if (0 !== $checkSum % 11) {
|
||||
|
|
|
@ -40,13 +40,10 @@ class LengthValidator extends ConstraintValidator
|
|||
|
||||
$stringValue = (string) $value;
|
||||
|
||||
if ('UTF8' === $charset = strtoupper($constraint->charset)) {
|
||||
$charset = 'UTF-8'; // iconv on Windows requires "UTF-8" instead of "UTF8"
|
||||
if (!$invalidCharset = !@mb_check_encoding($stringValue, $constraint->charset)) {
|
||||
$length = mb_strlen($stringValue, $constraint->charset);
|
||||
}
|
||||
|
||||
$length = @iconv_strlen($stringValue, $charset);
|
||||
$invalidCharset = false === $length;
|
||||
|
||||
if ($invalidCharset) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->charsetMessage)
|
||||
|
|
|
@ -81,7 +81,7 @@ class LuhnValidator extends ConstraintValidator
|
|||
// ^ ^ ^ ^ ^ ^
|
||||
// = 7 + 9 + 7 + 9 + 7 + 3
|
||||
for ($i = $length - 1; $i >= 0; $i -= 2) {
|
||||
$checkSum += $value{$i};
|
||||
$checkSum += $value[$i];
|
||||
}
|
||||
|
||||
// Starting with the second last digit and walking left, double every
|
||||
|
@ -91,7 +91,7 @@ class LuhnValidator extends ConstraintValidator
|
|||
// ^ ^ ^ ^ ^
|
||||
// = 1+8 + 4 + 6 + 1+6 + 2
|
||||
for ($i = $length - 2; $i >= 0; $i -= 2) {
|
||||
$checkSum += array_sum(str_split($value{$i} * 2));
|
||||
$checkSum += array_sum(str_split($value[$i] * 2));
|
||||
}
|
||||
|
||||
if (0 === $checkSum || 0 !== $checkSum % 10) {
|
||||
|
|
|
@ -56,7 +56,7 @@ class Regex extends Constraint
|
|||
* Pattern is also ignored if match=false since the pattern should
|
||||
* then be reversed before application.
|
||||
*
|
||||
* @link http://dev.w3.org/html5/spec/single-page.html#the-pattern-attribute
|
||||
* @see http://dev.w3.org/html5/spec/single-page.html#the-pattern-attribute
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
|
|
|
@ -17,8 +17,6 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
|
|||
/**
|
||||
* @Annotation
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class Traverse extends Constraint
|
||||
|
|
|
@ -25,13 +25,13 @@ class UrlValidator extends ConstraintValidator
|
|||
(%s):// # protocol
|
||||
(([\pL\pN-]+:)?([\pL\pN-]+)@)? # basic auth
|
||||
(
|
||||
([\pL\pN\pS-\.])+(\.?([\pL]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
|
||||
| # or
|
||||
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # a IP address
|
||||
| # or
|
||||
([\pL\pN\pS-\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
|
||||
| # or
|
||||
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address
|
||||
| # or
|
||||
\[
|
||||
(?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::))))
|
||||
\] # a IPv6 address
|
||||
\] # an IPv6 address
|
||||
)
|
||||
(:[0-9]+)? # a port (optional)
|
||||
(/?|/\S+|\?\S*|\#\S*) # a /, nothing, a / with something, a query or a fragment
|
||||
|
|
|
@ -81,6 +81,10 @@ class UuidValidator extends ConstraintValidator
|
|||
return;
|
||||
}
|
||||
|
||||
if (!$constraint instanceof Uuid) {
|
||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Uuid');
|
||||
}
|
||||
|
||||
if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) {
|
||||
throw new UnexpectedTypeException($value, 'string');
|
||||
}
|
||||
|
@ -114,7 +118,7 @@ class UuidValidator extends ConstraintValidator
|
|||
|
||||
for ($i = 0; $i < $l; ++$i) {
|
||||
// Check length
|
||||
if (!isset($trimmed{$i})) {
|
||||
if (!isset($trimmed[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
|
@ -133,7 +137,7 @@ class UuidValidator extends ConstraintValidator
|
|||
// Hyphens must occur every fifth position
|
||||
// xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx
|
||||
// ^ ^ ^ ^ ^ ^ ^
|
||||
if ('-' === $trimmed{$i}) {
|
||||
if ('-' === $trimmed[$i]) {
|
||||
if ($i !== $h) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
|
@ -162,7 +166,7 @@ class UuidValidator extends ConstraintValidator
|
|||
}
|
||||
|
||||
// Check characters
|
||||
if (!ctype_xdigit($trimmed{$i})) {
|
||||
if (!ctype_xdigit($trimmed[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
|
@ -180,7 +184,7 @@ class UuidValidator extends ConstraintValidator
|
|||
}
|
||||
|
||||
// Check length again
|
||||
if (isset($trimmed{$i})) {
|
||||
if (isset($trimmed[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
|
@ -209,7 +213,7 @@ class UuidValidator extends ConstraintValidator
|
|||
|
||||
for ($i = 0; $i < self::STRICT_LENGTH; ++$i) {
|
||||
// Check length
|
||||
if (!isset($value{$i})) {
|
||||
if (!isset($value[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
|
@ -228,24 +232,18 @@ class UuidValidator extends ConstraintValidator
|
|||
// Check hyphen placement
|
||||
// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
// ^ ^ ^ ^
|
||||
if ('-' === $value{$i}) {
|
||||
if ('-' === $value[$i]) {
|
||||
if ($i !== $h) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter(
|
||||
'{{ value }}',
|
||||
$this->formatValue($value)
|
||||
)
|
||||
->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR)
|
||||
->addViolation();
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR)
|
||||
->addViolation();
|
||||
} else {
|
||||
$this->buildViolation($constraint->message)
|
||||
->setParameter(
|
||||
'{{ value }}',
|
||||
$this->formatValue($value)
|
||||
)
|
||||
->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR)
|
||||
->addViolation();
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR)
|
||||
->addViolation();
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -261,7 +259,7 @@ class UuidValidator extends ConstraintValidator
|
|||
}
|
||||
|
||||
// Check characters
|
||||
if (!ctype_xdigit($value{$i})) {
|
||||
if (!ctype_xdigit($value[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
|
@ -296,7 +294,7 @@ class UuidValidator extends ConstraintValidator
|
|||
}
|
||||
|
||||
// Check length again
|
||||
if (isset($value{$i})) {
|
||||
if (isset($value[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
|
@ -311,7 +309,7 @@ class UuidValidator extends ConstraintValidator
|
|||
}
|
||||
|
||||
// Check version
|
||||
if (!in_array($value{self::STRICT_VERSION_POSITION}, $constraint->versions)) {
|
||||
if (!in_array($value[self::STRICT_VERSION_POSITION], $constraint->versions)) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
|
@ -329,7 +327,7 @@ class UuidValidator extends ConstraintValidator
|
|||
// 0b10xx
|
||||
// & 0b1100 (12)
|
||||
// = 0b1000 (8)
|
||||
if ((hexdec($value{self::STRICT_VARIANT_POSITION}) & 12) !== 8) {
|
||||
if ((hexdec($value[self::STRICT_VARIANT_POSITION]) & 12) !== 8) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
|
|
|
@ -27,8 +27,6 @@ use Symfony\Component\Validator\Violation\ConstraintViolationBuilder;
|
|||
/**
|
||||
* The context used and created by {@link ExecutionContextFactory}.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @see ExecutionContextInterface
|
||||
|
@ -289,6 +287,11 @@ class ExecutionContext implements ExecutionContextInterface
|
|||
return $this->group;
|
||||
}
|
||||
|
||||
public function getConstraint()
|
||||
{
|
||||
return $this->constraint;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -17,8 +17,6 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|||
/**
|
||||
* Creates new {@link ExecutionContext} instances.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @internal You should not instantiate or use this class. Code against
|
||||
|
|
|
@ -19,8 +19,6 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|||
* You can use a custom factory if you want to customize the execution context
|
||||
* that is passed through the validation run.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
interface ExecutionContextFactoryInterface
|
||||
|
|
|
@ -56,8 +56,6 @@ use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface;
|
|||
* cannot store a context and expect that the methods still return the same
|
||||
* results later on.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
interface ExecutionContextInterface extends LegacyExecutionContextInterface
|
||||
|
@ -111,7 +109,7 @@ interface ExecutionContextInterface extends LegacyExecutionContextInterface
|
|||
*
|
||||
* In other cases, null is returned.
|
||||
*
|
||||
* @return object|null The currently validated object or null.
|
||||
* @return object|null The currently validated object or null
|
||||
*/
|
||||
public function getObject();
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|||
/**
|
||||
* An execution context that is compatible with the legacy API (< 2.5).
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated since version 2.5, to be removed in 3.0.
|
||||
|
|
|
@ -22,8 +22,6 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|||
*
|
||||
* Implemented for backward compatibility with Symfony < 2.5.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated since version 2.5, to be removed in 3.0.
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
namespace Symfony\Component\Validator\Exception;
|
||||
|
||||
/**
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class UnsupportedMetadataException extends InvalidArgumentException
|
||||
|
|
20
vendor/symfony/validator/ExecutionContext.php
vendored
20
vendor/symfony/validator/ExecutionContext.php
vendored
|
@ -66,13 +66,13 @@ class ExecutionContext implements ExecutionContextInterface
|
|||
/**
|
||||
* Creates a new execution context.
|
||||
*
|
||||
* @param GlobalExecutionContextInterface $globalContext The global context storing node-independent state.
|
||||
* @param TranslatorInterface $translator The translator for translating violation messages.
|
||||
* @param null|string $translationDomain The domain of the validation messages.
|
||||
* @param MetadataInterface $metadata The metadata of the validated node.
|
||||
* @param mixed $value The value of the validated node.
|
||||
* @param string $group The current validation group.
|
||||
* @param string $propertyPath The property path to the current node.
|
||||
* @param GlobalExecutionContextInterface $globalContext The global context storing node-independent state
|
||||
* @param TranslatorInterface $translator The translator for translating violation messages
|
||||
* @param null|string $translationDomain The domain of the validation messages
|
||||
* @param MetadataInterface $metadata The metadata of the validated node
|
||||
* @param mixed $value The value of the validated node
|
||||
* @param string $group The current validation group
|
||||
* @param string $propertyPath The property path to the current node
|
||||
*/
|
||||
public function __construct(GlobalExecutionContextInterface $globalContext, TranslatorInterface $translator, $translationDomain = null, MetadataInterface $metadata = null, $value = null, $group = null, $propertyPath = '')
|
||||
{
|
||||
|
@ -266,8 +266,8 @@ class ExecutionContext implements ExecutionContextInterface
|
|||
/**
|
||||
* Executes the validators of the given constraints for the given value.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param Constraint[] $constraints The constraints to match against.
|
||||
* @param mixed $value The value to validate
|
||||
* @param Constraint[] $constraints The constraints to match against
|
||||
*/
|
||||
private function executeConstraintValidators($value, array $constraints)
|
||||
{
|
||||
|
@ -286,7 +286,7 @@ class ExecutionContext implements ExecutionContextInterface
|
|||
* is passed, an array containing the current
|
||||
* group of the context is returned.
|
||||
*
|
||||
* @return array An array of validation groups.
|
||||
* @return array An array of validation groups
|
||||
*/
|
||||
private function resolveGroups($groups)
|
||||
{
|
||||
|
|
|
@ -145,8 +145,8 @@ interface ExecutionContextInterface
|
|||
* Any violations generated during the validation will be added to the
|
||||
* violation list that you can access with {@link getViolations}.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param string $subPath The path to append to the context's property path.
|
||||
* @param mixed $value The value to validate
|
||||
* @param string $subPath The path to append to the context's property path
|
||||
* @param null|string|string[] $groups The groups to validate in. If you don't pass any
|
||||
* groups here, the current group of the context
|
||||
* will be used.
|
||||
|
@ -181,9 +181,9 @@ interface ExecutionContextInterface
|
|||
* $context->validate($address->street, new NotNull(), 'street');
|
||||
* </pre>
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against.
|
||||
* @param string $subPath The path to append to the context's property path.
|
||||
* @param mixed $value The value to validate
|
||||
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against
|
||||
* @param string $subPath The path to append to the context's property path
|
||||
* @param null|string|string[] $groups The groups to validate in. If you don't pass any
|
||||
* groups here, the current group of the context
|
||||
* will be used.
|
||||
|
@ -197,7 +197,7 @@ interface ExecutionContextInterface
|
|||
/**
|
||||
* Returns the violations generated by the validator so far.
|
||||
*
|
||||
* @return ConstraintViolationListInterface The constraint violation list.
|
||||
* @return ConstraintViolationListInterface The constraint violation list
|
||||
*/
|
||||
public function getViolations();
|
||||
|
||||
|
@ -210,7 +210,7 @@ interface ExecutionContextInterface
|
|||
*
|
||||
* The current value is returned by {@link getValue}.
|
||||
*
|
||||
* @return mixed The root value of the validation.
|
||||
* @return mixed The root value of the validation
|
||||
*/
|
||||
public function getRoot();
|
||||
|
||||
|
@ -220,7 +220,7 @@ interface ExecutionContextInterface
|
|||
* If you want to retrieve the object that was originally passed to the
|
||||
* validator, use {@link getRoot}.
|
||||
*
|
||||
* @return mixed The currently validated value.
|
||||
* @return mixed The currently validated value
|
||||
*/
|
||||
public function getValue();
|
||||
|
||||
|
@ -245,7 +245,7 @@ interface ExecutionContextInterface
|
|||
/**
|
||||
* Returns the used metadata factory.
|
||||
*
|
||||
* @return MetadataFactoryInterface The metadata factory.
|
||||
* @return MetadataFactoryInterface The metadata factory
|
||||
*
|
||||
* @deprecated since version 2.5, to be removed in 3.0.
|
||||
* Use {@link Context\ExecutionContextInterface::getValidator()}
|
||||
|
@ -258,7 +258,7 @@ interface ExecutionContextInterface
|
|||
/**
|
||||
* Returns the validation group that is currently being validated.
|
||||
*
|
||||
* @return string The current validation group.
|
||||
* @return string The current validation group
|
||||
*/
|
||||
public function getGroup();
|
||||
|
||||
|
@ -269,7 +269,7 @@ interface ExecutionContextInterface
|
|||
* {@link ClassBasedInterface} or if no metadata is available for the
|
||||
* current node, this method returns null.
|
||||
*
|
||||
* @return string|null The class name or null, if no class name could be found.
|
||||
* @return string|null The class name or null, if no class name could be found
|
||||
*/
|
||||
public function getClassName();
|
||||
|
||||
|
@ -280,7 +280,7 @@ interface ExecutionContextInterface
|
|||
* {@link PropertyMetadataInterface} or if no metadata is available for the
|
||||
* current node, this method returns null.
|
||||
*
|
||||
* @return string|null The property name or null, if no property name could be found.
|
||||
* @return string|null The property name or null, if no property name could be found
|
||||
*/
|
||||
public function getPropertyName();
|
||||
|
||||
|
|
|
@ -35,14 +35,14 @@ interface GlobalExecutionContextInterface
|
|||
/**
|
||||
* Returns the violations generated by the validator so far.
|
||||
*
|
||||
* @return ConstraintViolationListInterface A list of constraint violations.
|
||||
* @return ConstraintViolationListInterface A list of constraint violations
|
||||
*/
|
||||
public function getViolations();
|
||||
|
||||
/**
|
||||
* Returns the value at which validation was started in the object graph.
|
||||
*
|
||||
* @return mixed The root value.
|
||||
* @return mixed The root value
|
||||
*
|
||||
* @see ExecutionContextInterface::getRoot()
|
||||
*/
|
||||
|
@ -51,21 +51,21 @@ interface GlobalExecutionContextInterface
|
|||
/**
|
||||
* Returns the visitor instance used to validate the object graph nodes.
|
||||
*
|
||||
* @return ValidationVisitorInterface The validation visitor.
|
||||
* @return ValidationVisitorInterface The validation visitor
|
||||
*/
|
||||
public function getVisitor();
|
||||
|
||||
/**
|
||||
* Returns the factory for constraint validators.
|
||||
*
|
||||
* @return ConstraintValidatorFactoryInterface The constraint validator factory.
|
||||
* @return ConstraintValidatorFactoryInterface The constraint validator factory
|
||||
*/
|
||||
public function getValidatorFactory();
|
||||
|
||||
/**
|
||||
* Returns the factory for validation metadata objects.
|
||||
*
|
||||
* @return MetadataFactoryInterface The metadata factory.
|
||||
* @return MetadataFactoryInterface The metadata factory
|
||||
*/
|
||||
public function getMetadataFactory();
|
||||
}
|
||||
|
|
2
vendor/symfony/validator/LICENSE
vendored
2
vendor/symfony/validator/LICENSE
vendored
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2004-2016 Fabien Potencier
|
||||
Copyright (c) 2004-2017 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
|
||||
|
|
|
@ -27,8 +27,6 @@ namespace Symfony\Component\Validator\Mapping;
|
|||
* Although the constants currently represent a boolean switch, they are
|
||||
* implemented as bit mask in order to allow future extensions.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @see TraversalStrategy
|
||||
|
|
|
@ -261,7 +261,7 @@ class ClassMetadata extends ElementMetadata implements ClassMetadataInterface
|
|||
* @param string $property The name of the property
|
||||
* @param Constraint $constraint The constraint
|
||||
*
|
||||
* @return ClassMetadata This object
|
||||
* @return $this
|
||||
*/
|
||||
public function addPropertyConstraint($property, Constraint $constraint)
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ class ClassMetadata extends ElementMetadata implements ClassMetadataInterface
|
|||
* @param string $property
|
||||
* @param Constraint[] $constraints
|
||||
*
|
||||
* @return ClassMetadata
|
||||
* @return $this
|
||||
*/
|
||||
public function addPropertyConstraints($property, array $constraints)
|
||||
{
|
||||
|
@ -302,7 +302,7 @@ class ClassMetadata extends ElementMetadata implements ClassMetadataInterface
|
|||
* @param string $property The name of the property
|
||||
* @param Constraint $constraint The constraint
|
||||
*
|
||||
* @return ClassMetadata This object
|
||||
* @return $this
|
||||
*/
|
||||
public function addGetterConstraint($property, Constraint $constraint)
|
||||
{
|
||||
|
@ -323,7 +323,7 @@ class ClassMetadata extends ElementMetadata implements ClassMetadataInterface
|
|||
* @param string $property
|
||||
* @param Constraint[] $constraints
|
||||
*
|
||||
* @return ClassMetadata
|
||||
* @return $this
|
||||
*/
|
||||
public function addGetterConstraints($property, array $constraints)
|
||||
{
|
||||
|
@ -346,10 +346,18 @@ class ClassMetadata extends ElementMetadata implements ClassMetadataInterface
|
|||
}
|
||||
|
||||
foreach ($source->getConstrainedProperties() as $property) {
|
||||
if ($this->hasPropertyMetadata($property)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($source->getPropertyMetadata($property) as $member) {
|
||||
$member = clone $member;
|
||||
|
||||
foreach ($member->getConstraints() as $constraint) {
|
||||
if (in_array($constraint::DEFAULT_GROUP, $constraint->groups, true)) {
|
||||
$member->constraintsByGroup[$this->getDefaultGroup()][] = $constraint;
|
||||
}
|
||||
|
||||
$constraint->addImplicitGroupName($this->getDefaultGroup());
|
||||
}
|
||||
|
||||
|
@ -447,7 +455,7 @@ class ClassMetadata extends ElementMetadata implements ClassMetadataInterface
|
|||
*
|
||||
* @param array $groupSequence An array of group names
|
||||
*
|
||||
* @return ClassMetadata
|
||||
* @return $this
|
||||
*
|
||||
* @throws GroupDefinitionException
|
||||
*/
|
||||
|
|
|
@ -24,8 +24,6 @@ use Symfony\Component\Validator\PropertyMetadataContainerInterface as LegacyProp
|
|||
* by a group sequence for that class and whether instances of that class
|
||||
* should be traversed or not.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @see MetadataInterface
|
||||
|
|
|
@ -101,8 +101,11 @@ class LazyLoadingMetadataFactory implements MetadataFactoryInterface
|
|||
return $this->loadedClasses[$class];
|
||||
}
|
||||
|
||||
if (null !== $this->cache && false !== ($this->loadedClasses[$class] = $this->cache->read($class))) {
|
||||
return $this->loadedClasses[$class];
|
||||
if (null !== $this->cache && false !== ($metadata = $this->cache->read($class))) {
|
||||
// Include constraints from the parent class
|
||||
$this->mergeConstraints($metadata);
|
||||
|
||||
return $this->loadedClasses[$class] = $metadata;
|
||||
}
|
||||
|
||||
if (!class_exists($class) && !interface_exists($class)) {
|
||||
|
@ -111,19 +114,6 @@ class LazyLoadingMetadataFactory implements MetadataFactoryInterface
|
|||
|
||||
$metadata = new ClassMetadata($class);
|
||||
|
||||
// Include constraints from the parent class
|
||||
if ($parent = $metadata->getReflectionClass()->getParentClass()) {
|
||||
$metadata->mergeConstraints($this->getMetadataFor($parent->name));
|
||||
}
|
||||
|
||||
// Include constraints from all implemented interfaces
|
||||
foreach ($metadata->getReflectionClass()->getInterfaces() as $interface) {
|
||||
if ('Symfony\Component\Validator\GroupSequenceProviderInterface' === $interface->name) {
|
||||
continue;
|
||||
}
|
||||
$metadata->mergeConstraints($this->getMetadataFor($interface->name));
|
||||
}
|
||||
|
||||
if (null !== $this->loader) {
|
||||
$this->loader->loadClassMetadata($metadata);
|
||||
}
|
||||
|
@ -132,9 +122,46 @@ class LazyLoadingMetadataFactory implements MetadataFactoryInterface
|
|||
$this->cache->write($metadata);
|
||||
}
|
||||
|
||||
// Include constraints from the parent class
|
||||
$this->mergeConstraints($metadata);
|
||||
|
||||
return $this->loadedClasses[$class] = $metadata;
|
||||
}
|
||||
|
||||
private function mergeConstraints(ClassMetadata $metadata)
|
||||
{
|
||||
// Include constraints from the parent class
|
||||
if ($parent = $metadata->getReflectionClass()->getParentClass()) {
|
||||
$metadata->mergeConstraints($this->getMetadataFor($parent->name));
|
||||
}
|
||||
|
||||
$interfaces = $metadata->getReflectionClass()->getInterfaces();
|
||||
|
||||
$interfaces = array_filter($interfaces, function ($interface) use ($parent, $interfaces) {
|
||||
$interfaceName = $interface->getName();
|
||||
|
||||
if ($parent && $parent->implementsInterface($interfaceName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($interfaces as $i) {
|
||||
if ($i !== $interface && $i->implementsInterface($interfaceName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
// Include constraints from all directly implemented interfaces
|
||||
foreach ($interfaces as $interface) {
|
||||
if ('Symfony\Component\Validator\GroupSequenceProviderInterface' === $interface->name) {
|
||||
continue;
|
||||
}
|
||||
$metadata->mergeConstraints($this->getMetadataFor($interface->name));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -16,8 +16,6 @@ use Symfony\Component\Validator\MetadataFactoryInterface as LegacyMetadataFactor
|
|||
/**
|
||||
* Returns {@link \Symfony\Component\Validator\Mapping\MetadataInterface} instances for values.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
interface MetadataFactoryInterface extends LegacyMetadataFactoryInterface
|
||||
|
|
|
@ -23,8 +23,6 @@ use Symfony\Component\Validator\ValidationVisitorInterface;
|
|||
*
|
||||
* This class supports serialization and cloning.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class GenericMetadata implements MetadataInterface
|
||||
|
@ -123,7 +121,7 @@ class GenericMetadata implements MetadataInterface
|
|||
*
|
||||
* @param Constraint $constraint The constraint to add
|
||||
*
|
||||
* @return GenericMetadata This object
|
||||
* @return $this
|
||||
*
|
||||
* @throws ConstraintDefinitionException When trying to add the
|
||||
* {@link Traverse} constraint
|
||||
|
@ -169,7 +167,7 @@ class GenericMetadata implements MetadataInterface
|
|||
*
|
||||
* @param Constraint[] $constraints The constraints to add
|
||||
*
|
||||
* @return GenericMetadata This object
|
||||
* @return $this
|
||||
*/
|
||||
public function addConstraints(array $constraints)
|
||||
{
|
||||
|
|
|
@ -84,7 +84,7 @@ class XmlFileLoader extends FileLoader
|
|||
$options = array();
|
||||
}
|
||||
} elseif (strlen((string) $node) > 0) {
|
||||
$options = trim($node);
|
||||
$options = XmlUtils::phpize(trim($node));
|
||||
} else {
|
||||
$options = null;
|
||||
}
|
||||
|
@ -182,13 +182,7 @@ class XmlFileLoader extends FileLoader
|
|||
return simplexml_import_dom($dom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the validation metadata from the given XML class description.
|
||||
*
|
||||
* @param ClassMetadata $metadata The metadata to load
|
||||
* @param array $classDescription The XML class description
|
||||
*/
|
||||
private function loadClassMetadataFromXml(ClassMetadata $metadata, $classDescription)
|
||||
private function loadClassMetadataFromXml(ClassMetadata $metadata, \SimpleXMLElement $classDescription)
|
||||
{
|
||||
if (count($classDescription->{'group-sequence-provider'}) > 0) {
|
||||
$metadata->setGroupSequenceProvider(true);
|
||||
|
|
|
@ -46,13 +46,7 @@ class YamlFileLoader extends FileLoader
|
|||
$this->yamlParser = new YamlParser();
|
||||
}
|
||||
|
||||
// This method may throw an exception. Do not modify the class'
|
||||
// state before it completes
|
||||
if (false === ($classes = $this->parseFile($this->file))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->classes = $classes;
|
||||
$this->classes = $this->parseFile($this->file);
|
||||
|
||||
if (isset($this->classes['namespaces'])) {
|
||||
foreach ($this->classes['namespaces'] as $alias => $namespace) {
|
||||
|
@ -111,7 +105,7 @@ class YamlFileLoader extends FileLoader
|
|||
*
|
||||
* @param string $path The path of the YAML file
|
||||
*
|
||||
* @return array|null The class descriptions or null, if the file was empty
|
||||
* @return array The class descriptions
|
||||
*
|
||||
* @throws \InvalidArgumentException If the file could not be loaded or did
|
||||
* not contain a YAML array
|
||||
|
@ -126,7 +120,7 @@ class YamlFileLoader extends FileLoader
|
|||
|
||||
// empty file
|
||||
if (null === $classes) {
|
||||
return;
|
||||
return array();
|
||||
}
|
||||
|
||||
// not an array
|
||||
|
|
|
@ -24,8 +24,6 @@ use Symfony\Component\Validator\MetadataInterface as LegacyMetadataInterface;
|
|||
* against their class' metadata and whether traversable objects should be
|
||||
* traversed or not.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @see CascadingStrategy
|
||||
|
|
|
@ -39,7 +39,7 @@ class PropertyMetadata extends MemberMetadata
|
|||
public function __construct($class, $name)
|
||||
{
|
||||
if (!property_exists($class, $name)) {
|
||||
throw new ValidatorException(sprintf('Property %s does not exist in class %s', $name, $class));
|
||||
throw new ValidatorException(sprintf('Property "%s" does not exist in class "%s"', $name, $class));
|
||||
}
|
||||
|
||||
parent::__construct($class, $name, $name);
|
||||
|
@ -58,8 +58,14 @@ class PropertyMetadata extends MemberMetadata
|
|||
*/
|
||||
protected function newReflectionMember($objectOrClassName)
|
||||
{
|
||||
$originalClass = is_string($objectOrClassName) ? $objectOrClassName : get_class($objectOrClassName);
|
||||
|
||||
while (!property_exists($objectOrClassName, $this->getName())) {
|
||||
$objectOrClassName = get_parent_class($objectOrClassName);
|
||||
|
||||
if (false === $objectOrClassName) {
|
||||
throw new ValidatorException(sprintf('Property "%s" does not exist in class "%s".', $this->getName(), $originalClass));
|
||||
}
|
||||
}
|
||||
|
||||
$member = new \ReflectionProperty($objectOrClassName, $this->getName());
|
||||
|
|
|
@ -24,8 +24,6 @@ use Symfony\Component\Validator\PropertyMetadataInterface as LegacyPropertyMetad
|
|||
* should be validated against their class' metadata and whether traversable
|
||||
* objects should be traversed or not.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @see MetadataInterface
|
||||
|
|
|
@ -23,8 +23,6 @@ namespace Symfony\Component\Validator\Mapping;
|
|||
*
|
||||
* The traversal strategy is ignored for arrays. Arrays are always iterated.
|
||||
*
|
||||
* @since 2.1
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @see CascadingStrategy
|
||||
|
|
|
@ -24,7 +24,7 @@ interface PropertyMetadataContainerInterface
|
|||
/**
|
||||
* Check if there's any metadata attached to the given named property.
|
||||
*
|
||||
* @param string $property The property name.
|
||||
* @param string $property The property name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -36,7 +36,7 @@ interface PropertyMetadataContainerInterface
|
|||
* If your implementation does not support properties, simply throw an
|
||||
* exception in this method (for example a <tt>BadMethodCallException</tt>).
|
||||
*
|
||||
* @param string $property The property name.
|
||||
* @param string $property The property name
|
||||
*
|
||||
* @return PropertyMetadataInterface[] A list of metadata instances. Empty if
|
||||
* no metadata exists for the property.
|
||||
|
|
|
@ -31,16 +31,16 @@ interface PropertyMetadataInterface extends MetadataInterface
|
|||
/**
|
||||
* Returns the name of the property.
|
||||
*
|
||||
* @return string The property name.
|
||||
* @return string The property name
|
||||
*/
|
||||
public function getPropertyName();
|
||||
|
||||
/**
|
||||
* Extracts the value of the property from the given container.
|
||||
*
|
||||
* @param mixed $containingValue The container to extract the property value from.
|
||||
* @param mixed $containingValue The container to extract the property value from
|
||||
*
|
||||
* @return mixed The value of the property.
|
||||
* @return mixed The value of the property
|
||||
*/
|
||||
public function getPropertyValue($containingValue);
|
||||
}
|
||||
|
|
2
vendor/symfony/validator/README.md
vendored
2
vendor/symfony/validator/README.md
vendored
|
@ -7,7 +7,7 @@ The Validator component provides tools to validate values following the
|
|||
Resources
|
||||
---------
|
||||
|
||||
* [Documentation](https://symfony.com/doc/current/book/validation.html)
|
||||
* [Documentation](https://symfony.com/doc/current/components/validator.html)
|
||||
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
|
||||
* [Report issues](https://github.com/symfony/symfony/issues) and
|
||||
[send Pull Requests](https://github.com/symfony/symfony/pulls)
|
||||
|
|
|
@ -16,8 +16,6 @@ namespace Symfony\Component\Validator\Util;
|
|||
*
|
||||
* For more extensive functionality, use Symfony's PropertyAccess component.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class PropertyPath
|
||||
|
@ -39,7 +37,7 @@ class PropertyPath
|
|||
public static function append($basePath, $subPath)
|
||||
{
|
||||
if ('' !== (string) $subPath) {
|
||||
if ('[' === $subPath{0}) {
|
||||
if ('[' === $subPath[0]) {
|
||||
return $basePath.$subPath;
|
||||
}
|
||||
|
||||
|
|
4
vendor/symfony/validator/Validation.php
vendored
4
vendor/symfony/validator/Validation.php
vendored
|
@ -42,7 +42,7 @@ final class Validation
|
|||
* If you want to configure the validator, use
|
||||
* {@link createValidatorBuilder()} instead.
|
||||
*
|
||||
* @return ValidatorInterface The new validator.
|
||||
* @return ValidatorInterface The new validator
|
||||
*/
|
||||
public static function createValidator()
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ final class Validation
|
|||
/**
|
||||
* Creates a configurable builder for validator objects.
|
||||
*
|
||||
* @return ValidatorBuilderInterface The new builder.
|
||||
* @return ValidatorBuilderInterface The new builder
|
||||
*/
|
||||
public static function createValidatorBuilder()
|
||||
{
|
||||
|
|
12
vendor/symfony/validator/ValidationVisitor.php
vendored
12
vendor/symfony/validator/ValidationVisitor.php
vendored
|
@ -70,12 +70,12 @@ class ValidationVisitor implements ValidationVisitorInterface, GlobalExecutionCo
|
|||
/**
|
||||
* Creates a new validation visitor.
|
||||
*
|
||||
* @param mixed $root The value passed to the validator.
|
||||
* @param MetadataFactoryInterface $metadataFactory The factory for obtaining metadata instances.
|
||||
* @param ConstraintValidatorFactoryInterface $validatorFactory The factory for creating constraint validators.
|
||||
* @param TranslatorInterface $translator The translator for translating violation messages.
|
||||
* @param string|null $translationDomain The domain of the translation messages.
|
||||
* @param ObjectInitializerInterface[] $objectInitializers The initializers for preparing objects before validation.
|
||||
* @param mixed $root The value passed to the validator
|
||||
* @param MetadataFactoryInterface $metadataFactory The factory for obtaining metadata instances
|
||||
* @param ConstraintValidatorFactoryInterface $validatorFactory The factory for creating constraint validators
|
||||
* @param TranslatorInterface $translator The translator for translating violation messages
|
||||
* @param string|null $translationDomain The domain of the translation messages
|
||||
* @param ObjectInitializerInterface[] $objectInitializers The initializers for preparing objects before validation
|
||||
*
|
||||
* @throws UnexpectedTypeException If any of the object initializers is not an instance of ObjectInitializerInterface
|
||||
*/
|
||||
|
|
|
@ -56,11 +56,11 @@ interface ValidationVisitorInterface
|
|||
* does not find metadata for the given value, it will fail with an
|
||||
* exception.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param string $group The validation group to validate.
|
||||
* @param string $propertyPath The current property path in the validation graph.
|
||||
* @param bool $traverse Whether to traverse the value if it is traversable.
|
||||
* @param bool $deep Whether to traverse nested traversable values recursively.
|
||||
* @param mixed $value The value to validate
|
||||
* @param string $group The validation group to validate
|
||||
* @param string $propertyPath The current property path in the validation graph
|
||||
* @param bool $traverse Whether to traverse the value if it is traversable
|
||||
* @param bool $deep Whether to traverse nested traversable values recursively
|
||||
*
|
||||
* @throws Exception\NoSuchMetadataException If no metadata can be found for
|
||||
* the given value.
|
||||
|
@ -73,10 +73,10 @@ interface ValidationVisitorInterface
|
|||
* This method implements the Visitor design pattern. See also
|
||||
* {@link ValidationVisitorInterface}.
|
||||
*
|
||||
* @param MetadataInterface $metadata The metadata holding the constraints.
|
||||
* @param mixed $value The value to validate.
|
||||
* @param string $group The validation group to validate.
|
||||
* @param string $propertyPath The current property path in the validation graph.
|
||||
* @param MetadataInterface $metadata The metadata holding the constraints
|
||||
* @param mixed $value The value to validate
|
||||
* @param string $group The validation group to validate
|
||||
* @param string $propertyPath The current property path in the validation graph
|
||||
*/
|
||||
public function visit(MetadataInterface $metadata, $value, $group, $propertyPath);
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@ use Symfony\Component\Validator\ConstraintViolationListInterface;
|
|||
/**
|
||||
* A validator in a specific execution context.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
interface ContextualValidatorInterface
|
||||
|
@ -31,7 +29,7 @@ interface ContextualValidatorInterface
|
|||
*
|
||||
* @param string $path The path to append
|
||||
*
|
||||
* @return ContextualValidatorInterface This validator
|
||||
* @return $this
|
||||
*/
|
||||
public function atPath($path);
|
||||
|
||||
|
@ -48,7 +46,7 @@ interface ContextualValidatorInterface
|
|||
* validate. If none is given,
|
||||
* "Default" is assumed
|
||||
*
|
||||
* @return ContextualValidatorInterface This validator
|
||||
* @return $this
|
||||
*/
|
||||
public function validate($value, $constraints = null, $groups = null);
|
||||
|
||||
|
@ -61,7 +59,7 @@ interface ContextualValidatorInterface
|
|||
* @param array|null $groups The validation groups to validate. If
|
||||
* none is given, "Default" is assumed
|
||||
*
|
||||
* @return ContextualValidatorInterface This validator
|
||||
* @return $this
|
||||
*/
|
||||
public function validateProperty($object, $propertyName, $groups = null);
|
||||
|
||||
|
@ -76,7 +74,7 @@ interface ContextualValidatorInterface
|
|||
* @param array|null $groups The validation groups to validate. If
|
||||
* none is given, "Default" is assumed
|
||||
*
|
||||
* @return ContextualValidatorInterface This validator
|
||||
* @return $this
|
||||
*/
|
||||
public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null);
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@ namespace Symfony\Component\Validator\Validator;
|
|||
/**
|
||||
* A validator that supports both the API of Symfony < 2.5 and Symfony 2.5+.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @see \Symfony\Component\Validator\ValidatorInterface
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace Symfony\Component\Validator\Validator;
|
|||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\Constraints\GroupSequence;
|
||||
use Symfony\Component\Validator\ConstraintValidatorFactoryInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContext;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
|
||||
use Symfony\Component\Validator\Exception\NoSuchMetadataException;
|
||||
|
@ -33,8 +34,6 @@ use Symfony\Component\Validator\Util\PropertyPath;
|
|||
/**
|
||||
* Recursive implementation of {@link ContextualValidatorInterface}.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class RecursiveContextualValidator implements ContextualValidatorInterface
|
||||
|
@ -112,6 +111,11 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
|
|||
$previousMetadata = $this->context->getMetadata();
|
||||
$previousPath = $this->context->getPropertyPath();
|
||||
$previousGroup = $this->context->getGroup();
|
||||
$previousConstraint = null;
|
||||
|
||||
if ($this->context instanceof ExecutionContext || method_exists($this->context, 'getConstraint')) {
|
||||
$previousConstraint = $this->context->getConstraint();
|
||||
}
|
||||
|
||||
// If explicit constraints are passed, validate the value against
|
||||
// those constraints
|
||||
|
@ -140,6 +144,10 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
|
|||
$this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath);
|
||||
$this->context->setGroup($previousGroup);
|
||||
|
||||
if (null !== $previousConstraint) {
|
||||
$this->context->setConstraint($previousConstraint);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -316,6 +324,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
|
|||
|
||||
return array($groups);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates an object against the constraints defined for its class.
|
||||
*
|
||||
|
@ -737,9 +746,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
|
|||
// The $cascadedGroups property is set, if the "Default" group is
|
||||
// overridden by a group sequence
|
||||
// See validateClassNode()
|
||||
$cascadedGroups = count($cascadedGroups) > 0
|
||||
? $cascadedGroups
|
||||
: $groups;
|
||||
$cascadedGroups = null !== $cascadedGroups && count($cascadedGroups) > 0 ? $cascadedGroups : $groups;
|
||||
|
||||
if (is_array($value)) {
|
||||
// Arrays are always traversed, independent of the specified
|
||||
|
@ -792,7 +799,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
|
|||
* @param int $traversalStrategy The strategy used for
|
||||
* traversing the value
|
||||
* @param GroupSequence $groupSequence The group sequence
|
||||
* @param string[]|null $cascadedGroup The group that should
|
||||
* @param string|null $cascadedGroup The group that should
|
||||
* be passed to cascaded
|
||||
* objects instead of
|
||||
* the group sequence
|
||||
|
|
|
@ -24,8 +24,6 @@ use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface;
|
|||
/**
|
||||
* Recursive implementation of {@link ValidatorInterface}.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class RecursiveValidator implements ValidatorInterface, LegacyValidatorInterface
|
||||
|
|
|
@ -19,8 +19,6 @@ use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface;
|
|||
/**
|
||||
* Validates PHP values against constraints.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
interface ValidatorInterface extends MetadataFactoryInterface
|
||||
|
@ -38,7 +36,7 @@ interface ValidatorInterface extends MetadataFactoryInterface
|
|||
* validate. If none is given,
|
||||
* "Default" is assumed
|
||||
*
|
||||
* @return ConstraintViolationListInterface A list of constraint violations.
|
||||
* @return ConstraintViolationListInterface A list of constraint violations
|
||||
* If the list is empty, validation
|
||||
* succeeded
|
||||
*/
|
||||
|
@ -53,7 +51,7 @@ interface ValidatorInterface extends MetadataFactoryInterface
|
|||
* @param array|null $groups The validation groups to validate. If
|
||||
* none is given, "Default" is assumed
|
||||
*
|
||||
* @return ConstraintViolationListInterface A list of constraint violations.
|
||||
* @return ConstraintViolationListInterface A list of constraint violations
|
||||
* If the list is empty, validation
|
||||
* succeeded
|
||||
*/
|
||||
|
@ -70,7 +68,7 @@ interface ValidatorInterface extends MetadataFactoryInterface
|
|||
* @param array|null $groups The validation groups to validate. If
|
||||
* none is given, "Default" is assumed
|
||||
*
|
||||
* @return ConstraintViolationListInterface A list of constraint violations.
|
||||
* @return ConstraintViolationListInterface A list of constraint violations
|
||||
* If the list is empty, validation
|
||||
* succeeded
|
||||
*/
|
||||
|
|
|
@ -28,7 +28,7 @@ interface ValidatorBuilderInterface
|
|||
*
|
||||
* @param ObjectInitializerInterface $initializer The initializer
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*/
|
||||
public function addObjectInitializer(ObjectInitializerInterface $initializer);
|
||||
|
||||
|
@ -37,7 +37,7 @@ interface ValidatorBuilderInterface
|
|||
*
|
||||
* @param array $initializers The initializer
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*/
|
||||
public function addObjectInitializers(array $initializers);
|
||||
|
||||
|
@ -46,7 +46,7 @@ interface ValidatorBuilderInterface
|
|||
*
|
||||
* @param string $path The path to the mapping file
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*/
|
||||
public function addXmlMapping($path);
|
||||
|
||||
|
@ -55,7 +55,7 @@ interface ValidatorBuilderInterface
|
|||
*
|
||||
* @param array $paths The paths to the mapping files
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*/
|
||||
public function addXmlMappings(array $paths);
|
||||
|
||||
|
@ -64,7 +64,7 @@ interface ValidatorBuilderInterface
|
|||
*
|
||||
* @param string $path The path to the mapping file
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*/
|
||||
public function addYamlMapping($path);
|
||||
|
||||
|
@ -73,7 +73,7 @@ interface ValidatorBuilderInterface
|
|||
*
|
||||
* @param array $paths The paths to the mapping files
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*/
|
||||
public function addYamlMappings(array $paths);
|
||||
|
||||
|
@ -82,7 +82,7 @@ interface ValidatorBuilderInterface
|
|||
*
|
||||
* @param string $methodName The name of the method
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*/
|
||||
public function addMethodMapping($methodName);
|
||||
|
||||
|
@ -91,7 +91,7 @@ interface ValidatorBuilderInterface
|
|||
*
|
||||
* @param array $methodNames The names of the methods
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*/
|
||||
public function addMethodMappings(array $methodNames);
|
||||
|
||||
|
@ -100,14 +100,14 @@ interface ValidatorBuilderInterface
|
|||
*
|
||||
* @param Reader $annotationReader The annotation reader to be used
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*/
|
||||
public function enableAnnotationMapping(Reader $annotationReader = null);
|
||||
|
||||
/**
|
||||
* Disables annotation based constraint mapping.
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*/
|
||||
public function disableAnnotationMapping();
|
||||
|
||||
|
@ -116,7 +116,7 @@ interface ValidatorBuilderInterface
|
|||
*
|
||||
* @param MetadataFactoryInterface $metadataFactory The metadata factory
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*/
|
||||
public function setMetadataFactory(MetadataFactoryInterface $metadataFactory);
|
||||
|
||||
|
@ -125,7 +125,7 @@ interface ValidatorBuilderInterface
|
|||
*
|
||||
* @param CacheInterface $cache The cache instance
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*/
|
||||
public function setMetadataCache(CacheInterface $cache);
|
||||
|
||||
|
@ -134,7 +134,7 @@ interface ValidatorBuilderInterface
|
|||
*
|
||||
* @param ConstraintValidatorFactoryInterface $validatorFactory The validator factory
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*/
|
||||
public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory);
|
||||
|
||||
|
@ -143,7 +143,7 @@ interface ValidatorBuilderInterface
|
|||
*
|
||||
* @param TranslatorInterface $translator The translator instance
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*/
|
||||
public function setTranslator(TranslatorInterface $translator);
|
||||
|
||||
|
@ -156,7 +156,7 @@ interface ValidatorBuilderInterface
|
|||
*
|
||||
* @param string $translationDomain The translation domain of the violation messages
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*/
|
||||
public function setTranslationDomain($translationDomain);
|
||||
|
||||
|
@ -165,7 +165,7 @@ interface ValidatorBuilderInterface
|
|||
*
|
||||
* @param PropertyAccessorInterface $propertyAccessor The property accessor
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated since version 2.5, to be removed in 3.0.
|
||||
*/
|
||||
|
@ -176,7 +176,7 @@ interface ValidatorBuilderInterface
|
|||
*
|
||||
* @param int $apiVersion The required API version
|
||||
*
|
||||
* @return ValidatorBuilderInterface The builder object
|
||||
* @return $this
|
||||
*
|
||||
* @see Validation::API_VERSION_2_5
|
||||
* @see Validation::API_VERSION_2_5_BC
|
||||
|
@ -187,7 +187,7 @@ interface ValidatorBuilderInterface
|
|||
/**
|
||||
* Builds and returns a new validator object.
|
||||
*
|
||||
* @return ValidatorInterface The built validator.
|
||||
* @return ValidatorInterface The built validator
|
||||
*/
|
||||
public function getValidator();
|
||||
}
|
||||
|
|
24
vendor/symfony/validator/ValidatorInterface.php
vendored
24
vendor/symfony/validator/ValidatorInterface.php
vendored
|
@ -32,9 +32,9 @@ interface ValidatorInterface
|
|||
* disabled in Symfony 3.0.
|
||||
*
|
||||
* @param mixed $value The value to validate
|
||||
* @param array|null $groups The validation groups to validate.
|
||||
* @param bool $traverse Whether to traverse the value if it is traversable.
|
||||
* @param bool $deep Whether to traverse nested traversable values recursively.
|
||||
* @param array|null $groups The validation groups to validate
|
||||
* @param bool $traverse Whether to traverse the value if it is traversable
|
||||
* @param bool $deep Whether to traverse nested traversable values recursively
|
||||
*
|
||||
* @return ConstraintViolationListInterface A list of constraint violations. If the
|
||||
* list is empty, validation succeeded.
|
||||
|
@ -47,9 +47,9 @@ interface ValidatorInterface
|
|||
* The accepted values depend on the {@link MetadataFactoryInterface}
|
||||
* implementation.
|
||||
*
|
||||
* @param mixed $containingValue The value containing the property.
|
||||
* @param string $property The name of the property to validate.
|
||||
* @param array|null $groups The validation groups to validate.
|
||||
* @param mixed $containingValue The value containing the property
|
||||
* @param string $property The name of the property to validate
|
||||
* @param array|null $groups The validation groups to validate
|
||||
*
|
||||
* @return ConstraintViolationListInterface A list of constraint violations. If the
|
||||
* list is empty, validation succeeded.
|
||||
|
@ -62,11 +62,11 @@ interface ValidatorInterface
|
|||
* The accepted values depend on the {@link MetadataFactoryInterface}
|
||||
* implementation.
|
||||
*
|
||||
* @param mixed $containingValue The value containing the property.
|
||||
* @param mixed $containingValue The value containing the property
|
||||
* @param string $property The name of the property to validate
|
||||
* @param string $value The value to validate against the
|
||||
* constraints of the property.
|
||||
* @param array|null $groups The validation groups to validate.
|
||||
* @param array|null $groups The validation groups to validate
|
||||
*
|
||||
* @return ConstraintViolationListInterface A list of constraint violations. If the
|
||||
* list is empty, validation succeeded.
|
||||
|
@ -76,9 +76,9 @@ interface ValidatorInterface
|
|||
/**
|
||||
* Validates a value against a constraint or a list of constraints.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against.
|
||||
* @param array|null $groups The validation groups to validate.
|
||||
* @param mixed $value The value to validate
|
||||
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against
|
||||
* @param array|null $groups The validation groups to validate
|
||||
*
|
||||
* @return ConstraintViolationListInterface A list of constraint violations. If the
|
||||
* list is empty, validation succeeded.
|
||||
|
@ -92,7 +92,7 @@ interface ValidatorInterface
|
|||
/**
|
||||
* Returns the factory for metadata instances.
|
||||
*
|
||||
* @return MetadataFactoryInterface The metadata factory.
|
||||
* @return MetadataFactoryInterface The metadata factory
|
||||
*
|
||||
* @deprecated since version 2.5, to be removed in 3.0.
|
||||
* Use {@link Validator\ValidatorInterface::getMetadataFor()} or
|
||||
|
|
|
@ -20,8 +20,6 @@ use Symfony\Component\Validator\Util\PropertyPath;
|
|||
/**
|
||||
* Default implementation of {@link ConstraintViolationBuilderInterface}.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @internal You should not instantiate or use this class. Code against
|
||||
|
@ -199,7 +197,7 @@ class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface
|
|||
$this->message,
|
||||
$this->plural,
|
||||
$this->parameters,
|
||||
$this->translationDomain#
|
||||
$this->translationDomain
|
||||
);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$translatedMessage = $this->translator->trans(
|
||||
|
|
|
@ -19,8 +19,6 @@ namespace Symfony\Component\Validator\Violation;
|
|||
* Finally, call {@link addViolation()} to add the violation to the current
|
||||
* execution context.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
interface ConstraintViolationBuilderInterface
|
||||
|
@ -33,7 +31,7 @@ interface ConstraintViolationBuilderInterface
|
|||
*
|
||||
* @param string $path The property path
|
||||
*
|
||||
* @return ConstraintViolationBuilderInterface This builder
|
||||
* @return $this
|
||||
*/
|
||||
public function atPath($path);
|
||||
|
||||
|
@ -43,7 +41,7 @@ interface ConstraintViolationBuilderInterface
|
|||
* @param string $key The name of the parameter
|
||||
* @param string $value The value to be inserted in the parameter's place
|
||||
*
|
||||
* @return ConstraintViolationBuilderInterface This builder
|
||||
* @return $this
|
||||
*/
|
||||
public function setParameter($key, $value);
|
||||
|
||||
|
@ -54,7 +52,7 @@ interface ConstraintViolationBuilderInterface
|
|||
* the values to be inserted in their place as
|
||||
* values
|
||||
*
|
||||
* @return ConstraintViolationBuilderInterface This builder
|
||||
* @return $this
|
||||
*/
|
||||
public function setParameters(array $parameters);
|
||||
|
||||
|
@ -64,7 +62,7 @@ interface ConstraintViolationBuilderInterface
|
|||
*
|
||||
* @param string $translationDomain The translation domain
|
||||
*
|
||||
* @return ConstraintViolationBuilderInterface This builder
|
||||
* @return $this
|
||||
*
|
||||
* @see \Symfony\Component\Translation\TranslatorInterface
|
||||
*/
|
||||
|
@ -75,7 +73,7 @@ interface ConstraintViolationBuilderInterface
|
|||
*
|
||||
* @param mixed $invalidValue The invalid value
|
||||
*
|
||||
* @return ConstraintViolationBuilderInterface This builder
|
||||
* @return $this
|
||||
*/
|
||||
public function setInvalidValue($invalidValue);
|
||||
|
||||
|
@ -85,7 +83,7 @@ interface ConstraintViolationBuilderInterface
|
|||
*
|
||||
* @param int $number The number for determining the plural form
|
||||
*
|
||||
* @return ConstraintViolationBuilderInterface This builder
|
||||
* @return $this
|
||||
*
|
||||
* @see \Symfony\Component\Translation\TranslatorInterface::transChoice()
|
||||
*/
|
||||
|
@ -96,7 +94,7 @@ interface ConstraintViolationBuilderInterface
|
|||
*
|
||||
* @param string|null $code The violation code
|
||||
*
|
||||
* @return ConstraintViolationBuilderInterface This builder
|
||||
* @return $this
|
||||
*/
|
||||
public function setCode($code);
|
||||
|
||||
|
@ -105,7 +103,7 @@ interface ConstraintViolationBuilderInterface
|
|||
*
|
||||
* @param mixed $cause The cause of the violation
|
||||
*
|
||||
* @return ConstraintViolationBuilderInterface This builder
|
||||
* @return $this
|
||||
*/
|
||||
public function setCause($cause);
|
||||
|
||||
|
|
3
vendor/symfony/validator/composer.json
vendored
3
vendor/symfony/validator/composer.json
vendored
|
@ -17,10 +17,11 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=5.3.9",
|
||||
"symfony/polyfill-mbstring": "~1.0",
|
||||
"symfony/translation": "~2.4|~3.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/http-foundation": "~2.1|~3.0.0",
|
||||
"symfony/http-foundation": "~2.3|~3.0.0",
|
||||
"symfony/intl": "~2.7.4|~2.8|~3.0.0",
|
||||
"symfony/yaml": "~2.0,>=2.0.5|~3.0.0",
|
||||
"symfony/config": "~2.2|~3.0.0",
|
||||
|
|
Reference in a new issue