Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
3
core/vendor/symfony/validator/.gitignore
vendored
Normal file
3
core/vendor/symfony/validator/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
vendor/
|
||||
composer.lock
|
||||
phpunit.xml
|
|
@ -65,7 +65,7 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface
|
|||
*/
|
||||
protected function buildViolation($message, array $parameters = array())
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
if ($this->context instanceof ExecutionContextInterface2Dot5) {
|
||||
return $this->context->buildViolation($message, $parameters);
|
||||
|
@ -88,7 +88,7 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface
|
|||
*/
|
||||
protected function buildViolationInContext(ExecutionContextInterface $context, $message, array $parameters = array())
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
if ($context instanceof ExecutionContextInterface2Dot5) {
|
||||
return $context->buildViolation($message, $parameters);
|
||||
|
|
|
@ -147,7 +147,7 @@ class ConstraintViolation implements ConstraintViolationInterface
|
|||
*/
|
||||
public function getMessageParameters()
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.7, to be removed in 3.0. Use the ConstraintViolation::getParameters() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.7, to be removed in 3.0. Use the ConstraintViolation::getParameters() method instead.', E_USER_DEPRECATED);
|
||||
|
||||
return $this->parameters;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ class ConstraintViolation implements ConstraintViolationInterface
|
|||
*/
|
||||
public function getMessagePluralization()
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.7, to be removed in 3.0. Use the ConstraintViolation::getPlural() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.7, to be removed in 3.0. Use the ConstraintViolation::getPlural() method instead.', E_USER_DEPRECATED);
|
||||
|
||||
return $this->plural;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ class Callback extends Constraint
|
|||
}
|
||||
|
||||
if (is_array($options) && isset($options['methods'])) {
|
||||
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);
|
||||
@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'])) {
|
||||
|
|
|
@ -60,7 +60,7 @@ class CallbackValidator extends ConstraintValidator
|
|||
call_user_func($method, $object, $this->context);
|
||||
} elseif (null !== $object) {
|
||||
if (!method_exists($object, $method)) {
|
||||
throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist', $method));
|
||||
throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class %s', $method, get_class($object)));
|
||||
}
|
||||
|
||||
$reflMethod = new \ReflectionMethod($object, $method);
|
||||
|
|
|
@ -24,6 +24,7 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
|||
*
|
||||
* @see http://en.wikipedia.org/wiki/Bank_card_number
|
||||
* @see http://www.regular-expressions.info/creditcard.html
|
||||
* @see http://www.barclaycard.co.uk/business/files/Ranges_and_Rules_September_2014.pdf
|
||||
*/
|
||||
class CardSchemeValidator extends ConstraintValidator
|
||||
{
|
||||
|
@ -64,10 +65,13 @@ class CardSchemeValidator extends ConstraintValidator
|
|||
'LASER' => array(
|
||||
'/^(6304|670[69]|6771)[0-9]{12,15}$/',
|
||||
),
|
||||
// Maestro cards begin with either 5018, 5020, 5038, 5893, 6304, 6759, 6761, 6762, 6763 or 0604
|
||||
// They have between 12 and 19 digits.
|
||||
// Maestro international cards begin with 675900..675999 and have between 12 and 19 digits.
|
||||
// Maestro UK cards begin with either 500000..509999 or 560000..699999 and have between 12 and 19 digits.
|
||||
'MAESTRO' => array(
|
||||
'/^(5018|5020|5038|6304|6759|6761|676[23]|0604)[0-9]{8,15}$/',
|
||||
'/^(6759[0-9]{2})[0-9]{6,13}$/',
|
||||
'/^(50[0-9]{4})[0-9]{6,13}$/',
|
||||
'/^5[6-9][0-9]{10,17}$/',
|
||||
'/^6[0-9]{11,18}$/',
|
||||
),
|
||||
// All MasterCard numbers start with the numbers 51 through 55. All have 16 digits.
|
||||
'MASTERCARD' => array(
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator\Constraints\Collection;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\Optional class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Validator\Constraints\Optional class instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\Optional class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Validator\Constraints\Optional class instead.', E_USER_DEPRECATED);
|
||||
|
||||
use Symfony\Component\Validator\Constraints\Optional as BaseOptional;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator\Constraints\Collection;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\Required class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Validator\Constraints\Required class instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\Required class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Validator\Constraints\Required class instead.', E_USER_DEPRECATED);
|
||||
|
||||
use Symfony\Component\Validator\Constraints\Required as BaseRequired;
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
|||
class EmailValidator extends ConstraintValidator
|
||||
{
|
||||
/**
|
||||
* isStrict
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $isStrict;
|
||||
|
@ -81,7 +79,7 @@ class EmailValidator extends ConstraintValidator
|
|||
|
||||
return;
|
||||
}
|
||||
} elseif (!preg_match('/.+\@.+\..+/', $value)) {
|
||||
} elseif (!preg_match('/^.+\@\S+\.\S+$/', $value)) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator\Constraints;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\False class is deprecated since version 2.7 and will be removed in 3.0. Use the IsFalse class in the same namespace instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\False class is deprecated since version 2.7 and will be removed in 3.0. Use the IsFalse class in the same namespace instead.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator\Constraints;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\FalseValidator class is deprecated since version 2.7 and will be removed in 3.0. Use the IsFalseValidator class in the same namespace instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\FalseValidator class is deprecated since version 2.7 and will be removed in 3.0. Use the IsFalseValidator class in the same namespace instead.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
|
|
|
@ -40,7 +40,6 @@ class File extends Constraint
|
|||
self::INVALID_MIME_TYPE_ERROR => 'INVALID_MIME_TYPE_ERROR',
|
||||
);
|
||||
|
||||
public $maxSize;
|
||||
public $binaryFormat;
|
||||
public $mimeTypes = array();
|
||||
public $notFoundMessage = 'The file could not be found.';
|
||||
|
@ -58,29 +57,56 @@ class File extends Constraint
|
|||
public $uploadExtensionErrorMessage = 'A PHP extension caused the upload to fail.';
|
||||
public $uploadErrorMessage = 'The file could not be uploaded.';
|
||||
|
||||
protected $maxSize;
|
||||
|
||||
public function __construct($options = null)
|
||||
{
|
||||
parent::__construct($options);
|
||||
|
||||
if ($this->maxSize) {
|
||||
if (ctype_digit((string) $this->maxSize)) {
|
||||
$this->maxSize = (int) $this->maxSize;
|
||||
$this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat;
|
||||
} elseif (preg_match('/^\d++k$/i', $this->maxSize)) {
|
||||
$this->maxSize = $this->maxSize * 1000;
|
||||
$this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat;
|
||||
} elseif (preg_match('/^\d++M$/i', $this->maxSize)) {
|
||||
$this->maxSize = $this->maxSize * 1000000;
|
||||
$this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat;
|
||||
} elseif (preg_match('/^\d++Ki$/i', $this->maxSize)) {
|
||||
$this->maxSize = $this->maxSize << 10;
|
||||
$this->binaryFormat = null === $this->binaryFormat ? true : $this->binaryFormat;
|
||||
} elseif (preg_match('/^\d++Mi$/i', $this->maxSize)) {
|
||||
$this->maxSize = $this->maxSize << 20;
|
||||
$this->binaryFormat = null === $this->binaryFormat ? true : $this->binaryFormat;
|
||||
} else {
|
||||
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size', $this->maxSize));
|
||||
}
|
||||
if (null !== $this->maxSize) {
|
||||
$this->normalizeBinaryFormat($this->maxSize);
|
||||
}
|
||||
}
|
||||
|
||||
public function __set($option, $value)
|
||||
{
|
||||
if ('maxSize' === $option) {
|
||||
$this->normalizeBinaryFormat($value);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
parent::__set($option, $value);
|
||||
}
|
||||
|
||||
public function __get($option)
|
||||
{
|
||||
if ('maxSize' === $option) {
|
||||
return $this->maxSize;
|
||||
}
|
||||
|
||||
return parent::__get($option);
|
||||
}
|
||||
|
||||
private function normalizeBinaryFormat($maxSize)
|
||||
{
|
||||
if (ctype_digit((string) $maxSize)) {
|
||||
$this->maxSize = (int) $maxSize;
|
||||
$this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat;
|
||||
} elseif (preg_match('/^\d++k$/i', $maxSize)) {
|
||||
$this->maxSize = $maxSize * 1000;
|
||||
$this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat;
|
||||
} elseif (preg_match('/^\d++M$/i', $maxSize)) {
|
||||
$this->maxSize = $maxSize * 1000000;
|
||||
$this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat;
|
||||
} elseif (preg_match('/^\d++Ki$/i', $maxSize)) {
|
||||
$this->maxSize = $maxSize << 10;
|
||||
$this->binaryFormat = null === $this->binaryFormat ? true : $this->binaryFormat;
|
||||
} elseif (preg_match('/^\d++Mi$/i', $maxSize)) {
|
||||
$this->maxSize = $maxSize << 20;
|
||||
$this->binaryFormat = null === $this->binaryFormat ? true : $this->binaryFormat;
|
||||
} else {
|
||||
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size', $this->maxSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ class GroupSequence implements \ArrayAccess, \IteratorAggregate, \Countable
|
|||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
return new \ArrayIterator($this->groups);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ class GroupSequence implements \ArrayAccess, \IteratorAggregate, \Countable
|
|||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
return isset($this->groups[$offset]);
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ class GroupSequence implements \ArrayAccess, \IteratorAggregate, \Countable
|
|||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
if (!isset($this->groups[$offset])) {
|
||||
throw new OutOfBoundsException(sprintf(
|
||||
|
@ -169,7 +169,7 @@ class GroupSequence implements \ArrayAccess, \IteratorAggregate, \Countable
|
|||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
if (null !== $offset) {
|
||||
$this->groups[$offset] = $value;
|
||||
|
@ -191,7 +191,7 @@ class GroupSequence implements \ArrayAccess, \IteratorAggregate, \Countable
|
|||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
unset($this->groups[$offset]);
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ class GroupSequence implements \ArrayAccess, \IteratorAggregate, \Countable
|
|||
*/
|
||||
public function count()
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
return count($this->groups);
|
||||
}
|
||||
|
|
|
@ -49,10 +49,10 @@ class IsbnValidator extends ConstraintValidator
|
|||
|
||||
if (null === $constraint->type) {
|
||||
if ($constraint->isbn10 && !$constraint->isbn13) {
|
||||
trigger_error('The "isbn10" option of the Isbn constraint is deprecated since version 2.5 and will be removed in 3.0. Use the "type" option instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The "isbn10" option of the Isbn constraint is deprecated since version 2.5 and will be removed in 3.0. Use the "type" option instead.', E_USER_DEPRECATED);
|
||||
$constraint->type = 'isbn10';
|
||||
} elseif ($constraint->isbn13 && !$constraint->isbn10) {
|
||||
trigger_error('The "isbn13" option of the Isbn constraint is deprecated since version 2.5 and will be removed in 3.0. Use the "type" option instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The "isbn13" option of the Isbn constraint is deprecated since version 2.5 and will be removed in 3.0. Use the "type" option instead.', E_USER_DEPRECATED);
|
||||
$constraint->type = 'isbn13';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator\Constraints;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\Null class is deprecated since version 2.7 and will be removed in 3.0. Use the IsNull class in the same namespace instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\Null class is deprecated since version 2.7 and will be removed in 3.0. Use the IsNull class in the same namespace instead.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator\Constraints;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\NullValidator class is deprecated since version 2.7 and will be removed in 3.0. Use the IsNullValidator class in the same namespace instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\NullValidator class is deprecated since version 2.7 and will be removed in 3.0. Use the IsNullValidator class in the same namespace instead.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator\Constraints;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\True class is deprecated since version 2.7 and will be removed in 3.0. Use the IsTrue class in the same namespace instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\True class is deprecated since version 2.7 and will be removed in 3.0. Use the IsTrue class in the same namespace instead.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator\Constraints;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\TrueValidator class is deprecated since version 2.7 and will be removed in 3.0. Use the IsTrueValidator class in the same namespace instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\TrueValidator class is deprecated since version 2.7 and will be removed in 3.0. Use the IsTrueValidator class in the same namespace instead.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
|
|
|
@ -41,7 +41,7 @@ class Valid extends Constraint
|
|||
}
|
||||
|
||||
if (is_array($options) && array_key_exists('deep', $options)) {
|
||||
trigger_error('The "deep" option for the Valid constraint is deprecated since version 2.5 and will be removed in 3.0. When traversing arrays, nested arrays are always traversed. When traversing nested objects, their traversal strategy is used.', E_USER_DEPRECATED);
|
||||
@trigger_error('The "deep" option for the Valid constraint is deprecated since version 2.5 and will be removed in 3.0. When traversing arrays, nested arrays are always traversed. When traversing nested objects, their traversal strategy is used.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
parent::__construct($options);
|
||||
|
|
|
@ -188,7 +188,7 @@ class ExecutionContext implements ExecutionContextInterface
|
|||
// API, as they are not present in the new interface anymore.
|
||||
// You should use buildViolation() instead.
|
||||
if (func_num_args() > 2) {
|
||||
trigger_error('The parameters $invalidValue, $plural and $code in method '.__METHOD__.' are deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The parameters $invalidValue, $plural and $code in method '.__METHOD__.' are deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED);
|
||||
|
||||
$this
|
||||
->buildViolation($message, $parameters)
|
||||
|
@ -317,7 +317,7 @@ class ExecutionContext implements ExecutionContextInterface
|
|||
*/
|
||||
public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED);
|
||||
|
||||
if (func_num_args() > 2) {
|
||||
$this
|
||||
|
@ -344,7 +344,7 @@ class ExecutionContext implements ExecutionContextInterface
|
|||
*/
|
||||
public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator() method instead.', E_USER_DEPRECATED);
|
||||
|
||||
if (is_array($value)) {
|
||||
// The $traverse flag is ignored for arrays
|
||||
|
@ -382,7 +382,7 @@ class ExecutionContext implements ExecutionContextInterface
|
|||
*/
|
||||
public function validateValue($value, $constraints, $subPath = '', $groups = null)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator() method instead.', E_USER_DEPRECATED);
|
||||
|
||||
return $this
|
||||
->getValidator()
|
||||
|
@ -397,7 +397,7 @@ class ExecutionContext implements ExecutionContextInterface
|
|||
*/
|
||||
public function getMetadataFactory()
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0. Use the new Symfony\Component\Validator\Context\ExecutionContext::getValidator method in combination with Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0. Use the new Symfony\Component\Validator\Context\ExecutionContext::getValidator method in combination with Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED);
|
||||
|
||||
$validator = $this->getValidator();
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator\Context;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\LegacyExecutionContext class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\LegacyExecutionContext class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Symfony\Component\Validator\MetadataFactoryInterface;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator\Context;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\LegacyExecutionContextFactory class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\LegacyExecutionContextFactory class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Symfony\Component\Validator\MetadataFactoryInterface;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator;
|
||||
|
||||
trigger_error('The class '.__NAMESPACE__.'\DefaultTranslator is deprecated since version 2.7 and will be removed in 3.0. Use Symfony\Component\Translation\IdentityTranslator instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The class '.__NAMESPACE__.'\DefaultTranslator is deprecated since version 2.7 and will be removed in 3.0. Use Symfony\Component\Translation\IdentityTranslator instead.', E_USER_DEPRECATED);
|
||||
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Symfony\Component\Validator\Exception\BadMethodCallException;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\ExecutionContext class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Validator\Context\ExecutionContext class instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\ExecutionContext class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Validator\Context\ExecutionContext class instead.', E_USER_DEPRECATED);
|
||||
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
|
|
|
@ -91,6 +91,8 @@ interface ExecutionContextInterface
|
|||
/**
|
||||
* Adds a violation at the current node of the validation graph.
|
||||
*
|
||||
* Note: the parameters $invalidValue, $plural and $code are deprecated since version 2.5 and will be removed in 3.0.
|
||||
*
|
||||
* @param string $message The error message
|
||||
* @param array $params The parameters substituted in the error message
|
||||
* @param mixed $invalidValue The invalid, validated value
|
||||
|
@ -98,8 +100,6 @@ interface ExecutionContextInterface
|
|||
* @param int|null $code The violation code
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @deprecated the parameters $invalidValue, $plural and $code are deprecated since version 2.5 and will be removed in 3.0.
|
||||
*/
|
||||
public function addViolation($message, array $params = array(), $invalidValue = null, $plural = null, $code = null);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator\Mapping;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\BlackholeMetadataFactory class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Validator\Mapping\Factory\BlackHoleMetadataFactory class instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\BlackholeMetadataFactory class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Validator\Mapping\Factory\BlackHoleMetadataFactory class instead.', E_USER_DEPRECATED);
|
||||
|
||||
use Symfony\Component\Validator\Mapping\Factory\BlackHoleMetadataFactory as MappingBlackHoleMetadataFactory;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator\Mapping\Cache;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\ApcCache class is deprecated since version 2.5 and will be removed in 3.0. Use DoctrineCache with the Doctrine\Common\Cache\ApcCache class instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\ApcCache class is deprecated since version 2.5 and will be removed in 3.0. Use DoctrineCache with the Doctrine\Common\Cache\ApcCache class instead.', E_USER_DEPRECATED);
|
||||
|
||||
use Symfony\Component\Validator\Mapping\ClassMetadata;
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ class ClassMetadata extends ElementMetadata implements ClassMetadataInterface
|
|||
*/
|
||||
public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath, $propagatedGroup = null)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
if (null === $propagatedGroup && Constraint::DEFAULT_GROUP === $group
|
||||
&& ($this->hasGroupSequence() || $this->isGroupSequenceProvider())) {
|
||||
|
@ -377,7 +377,7 @@ class ClassMetadata extends ElementMetadata implements ClassMetadataInterface
|
|||
*/
|
||||
protected function addMemberMetadata(MemberMetadata $metadata)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the addPropertyMetadata() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the addPropertyMetadata() method instead.', E_USER_DEPRECATED);
|
||||
|
||||
$this->addPropertyMetadata($metadata);
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ class ClassMetadata extends ElementMetadata implements ClassMetadataInterface
|
|||
*/
|
||||
public function hasMemberMetadatas($property)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the hasPropertyMetadata() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the hasPropertyMetadata() method instead.', E_USER_DEPRECATED);
|
||||
|
||||
return $this->hasPropertyMetadata($property);
|
||||
}
|
||||
|
@ -409,7 +409,7 @@ class ClassMetadata extends ElementMetadata implements ClassMetadataInterface
|
|||
*/
|
||||
public function getMemberMetadatas($property)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getPropertyMetadata() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getPropertyMetadata() method instead.', E_USER_DEPRECATED);
|
||||
|
||||
return $this->getPropertyMetadata($property);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator\Mapping;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\ClassMetadataFactory class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory class instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\ClassMetadataFactory class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory class instead.', E_USER_DEPRECATED);
|
||||
|
||||
use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ abstract class ElementMetadata extends GenericMetadata
|
|||
public function __construct()
|
||||
{
|
||||
if (!$this instanceof MemberMetadata && !$this instanceof ClassMetadata) {
|
||||
trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Validator\Mapping\GenericMetadata class instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Validator\Mapping\GenericMetadata class instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ abstract class MemberMetadata extends ElementMetadata implements PropertyMetadat
|
|||
*/
|
||||
public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath, $propagatedGroup = null)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
$visitor->visit($this, $value, $group, $propertyPath);
|
||||
|
||||
|
@ -192,7 +192,7 @@ abstract class MemberMetadata extends ElementMetadata implements PropertyMetadat
|
|||
*/
|
||||
public function isCascaded()
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the getCascadingStrategy() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the getCascadingStrategy() method instead.', E_USER_DEPRECATED);
|
||||
|
||||
return (bool) ($this->cascadingStrategy & CascadingStrategy::CASCADE);
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ abstract class MemberMetadata extends ElementMetadata implements PropertyMetadat
|
|||
*/
|
||||
public function isCollectionCascaded()
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the getTraversalStrategy() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the getTraversalStrategy() method instead.', E_USER_DEPRECATED);
|
||||
|
||||
return (bool) ($this->traversalStrategy & (TraversalStrategy::IMPLICIT | TraversalStrategy::TRAVERSE));
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ abstract class MemberMetadata extends ElementMetadata implements PropertyMetadat
|
|||
*/
|
||||
public function isCollectionCascadedDeeply()
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the getTraversalStrategy() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the getTraversalStrategy() method instead.', E_USER_DEPRECATED);
|
||||
|
||||
return !($this->traversalStrategy & TraversalStrategy::STOP_RECURSION);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
</trans-unit>
|
||||
<trans-unit id="10">
|
||||
<source>This field is missing.</source>
|
||||
<target>Questo campo è manca.</target>
|
||||
<target>Questo campo è mancante.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="11">
|
||||
<source>This value is not a valid date.</source>
|
||||
|
|
|
@ -51,10 +51,6 @@ abstract class AbstractConstraintValidatorTest extends \PHPUnit_Framework_TestCa
|
|||
|
||||
protected function setUp()
|
||||
{
|
||||
if (Validation::API_VERSION_2_5 !== $this->getApiVersion()) {
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$this->group = 'MyGroup';
|
||||
$this->metadata = null;
|
||||
$this->object = null;
|
||||
|
@ -260,7 +256,7 @@ abstract class AbstractConstraintValidatorTest extends \PHPUnit_Framework_TestCa
|
|||
*/
|
||||
protected function assertViolation($message, array $parameters = array(), $propertyPath = 'property.path', $invalidValue = 'InvalidValue', $plural = null, $code = null)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Use the buildViolation() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Use the buildViolation() method instead.', E_USER_DEPRECATED);
|
||||
|
||||
$this->buildViolation($message)
|
||||
->setParameters($parameters)
|
||||
|
@ -279,7 +275,7 @@ abstract class AbstractConstraintValidatorTest extends \PHPUnit_Framework_TestCa
|
|||
*/
|
||||
protected function assertViolations(array $expected)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Use the buildViolation() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Use the buildViolation() method instead.', E_USER_DEPRECATED);
|
||||
|
||||
$violations = $this->context->getViolations();
|
||||
|
||||
|
|
|
@ -191,8 +191,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
|||
*/
|
||||
public function testLegacySingleMethodBc()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$object = new CallbackValidatorTest_Object();
|
||||
$constraint = new Callback(array('validate'));
|
||||
|
||||
|
@ -209,8 +207,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
|||
*/
|
||||
public function testLegacySingleMethodBcExplicitName()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$object = new CallbackValidatorTest_Object();
|
||||
$constraint = new Callback(array('methods' => array('validate')));
|
||||
|
||||
|
@ -227,8 +223,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
|||
*/
|
||||
public function testLegacyMultipleMethodsBc()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$object = new CallbackValidatorTest_Object();
|
||||
$constraint = new Callback(array('validate', 'validateStatic'));
|
||||
|
||||
|
@ -247,8 +241,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
|||
*/
|
||||
public function testLegacyMultipleMethodsBcExplicitName()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$object = new CallbackValidatorTest_Object();
|
||||
$constraint = new Callback(array(
|
||||
'methods' => array('validate', 'validateStatic'),
|
||||
|
@ -269,8 +261,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
|||
*/
|
||||
public function testLegacySingleStaticMethodBc()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$object = new CallbackValidatorTest_Object();
|
||||
$constraint = new Callback(array(
|
||||
array(__CLASS__.'_Class', 'validateCallback'),
|
||||
|
@ -289,8 +279,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
|||
*/
|
||||
public function testLegacySingleStaticMethodBcExplicitName()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$object = new CallbackValidatorTest_Object();
|
||||
$constraint = new Callback(array(
|
||||
'methods' => array(array(__CLASS__.'_Class', 'validateCallback')),
|
||||
|
@ -329,8 +317,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
|||
*/
|
||||
public function testLegacyExpectEitherCallbackOrMethods()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$object = new CallbackValidatorTest_Object();
|
||||
|
||||
$this->validator->validate($object, new Callback(array(
|
||||
|
|
|
@ -97,8 +97,10 @@ class CardSchemeValidatorTest extends AbstractConstraintValidatorTest
|
|||
array('LASER', '6771656738314582216'),
|
||||
array('MAESTRO', '6759744069209'),
|
||||
array('MAESTRO', '5020507657408074712'),
|
||||
array('MAESTRO', '5612559223580173965'),
|
||||
array('MAESTRO', '6759744069209'),
|
||||
array('MAESTRO', '6759744069209'),
|
||||
array('MAESTRO', '6594371785970435599'),
|
||||
array('MASTERCARD', '5555555555554444'),
|
||||
array('MASTERCARD', '5105105105105100'),
|
||||
array('VISA', '4111111111111111'),
|
||||
|
|
|
@ -91,6 +91,7 @@ class EmailValidatorTest extends AbstractConstraintValidatorTest
|
|||
array('example'),
|
||||
array('example@'),
|
||||
array('example@localhost'),
|
||||
array('foo@example.com bar'),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,13 +12,14 @@
|
|||
namespace Symfony\Component\Validator\Tests\Constraints;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\File;
|
||||
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
|
||||
|
||||
class FileTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @param mixed $maxSize
|
||||
* @param int bytes
|
||||
* @param bool $bytes
|
||||
* @param int $bytes
|
||||
* @param bool $binaryFormat
|
||||
* @dataProvider provideValidSizes
|
||||
*/
|
||||
public function testMaxSize($maxSize, $bytes, $binaryFormat)
|
||||
|
@ -29,11 +30,55 @@ class FileTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertSame($binaryFormat, $file->binaryFormat);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidSizes
|
||||
*
|
||||
* @param int|string $maxSize
|
||||
* @param int $bytes
|
||||
* @param string $binaryFormat
|
||||
*/
|
||||
public function testMaxSizeCanBeSetAfterInitialization($maxSize, $bytes, $binaryFormat)
|
||||
{
|
||||
$file = new File();
|
||||
$file->maxSize = $maxSize;
|
||||
|
||||
$this->assertSame($bytes, $file->maxSize);
|
||||
$this->assertSame($binaryFormat, $file->binaryFormat);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidSizes
|
||||
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
|
||||
*
|
||||
* @param int|string $maxSize
|
||||
*/
|
||||
public function testInvalidValueForMaxSizeThrowsExceptionAfterInitialization($maxSize)
|
||||
{
|
||||
$file = new File(array('maxSize' => 1000));
|
||||
$file->maxSize = $maxSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidSizes
|
||||
*
|
||||
* @param int|string $maxSize
|
||||
*/
|
||||
public function testMaxSizeCannotBeSetToInvalidValueAfterInitialization($maxSize)
|
||||
{
|
||||
$file = new File(array('maxSize' => 1000));
|
||||
|
||||
try {
|
||||
$file->maxSize = $maxSize;
|
||||
} catch (ConstraintDefinitionException $e) {
|
||||
}
|
||||
|
||||
$this->assertSame(1000, $file->maxSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $maxSize
|
||||
* @param int $bytes
|
||||
* @dataProvider provideInValidSizes
|
||||
* @expectedException Symfony\Component\Validator\Exception\ConstraintDefinitionException
|
||||
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
|
||||
*/
|
||||
public function testInvalideMaxSize($maxSize)
|
||||
{
|
||||
|
|
|
@ -37,8 +37,6 @@ class GroupSequenceTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyIterate()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$sequence = new GroupSequence(array('Group 1', 'Group 2'));
|
||||
|
||||
$this->assertSame(array('Group 1', 'Group 2'), iterator_to_array($sequence));
|
||||
|
@ -49,8 +47,6 @@ class GroupSequenceTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyCount()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$sequence = new GroupSequence(array('Group 1', 'Group 2'));
|
||||
|
||||
$this->assertCount(2, $sequence);
|
||||
|
@ -61,8 +57,6 @@ class GroupSequenceTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyArrayAccess()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$sequence = new GroupSequence(array('Group 1', 'Group 2'));
|
||||
|
||||
$this->assertSame('Group 1', $sequence[0]);
|
||||
|
@ -85,8 +79,6 @@ class GroupSequenceTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyGetExpectsExistingKey()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$sequence = new GroupSequence(array('Group 1', 'Group 2'));
|
||||
|
||||
$sequence[2];
|
||||
|
@ -97,8 +89,6 @@ class GroupSequenceTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyUnsetIgnoresNonExistingKeys()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$sequence = new GroupSequence(array('Group 1', 'Group 2'));
|
||||
|
||||
// should not fail
|
||||
|
|
|
@ -41,8 +41,6 @@ class LegacyExecutionContextTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$this->visitor = $this->getMockBuilder('Symfony\Component\Validator\ValidationVisitor')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
|
|
@ -20,8 +20,6 @@ class LegacyApcCacheTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
protected function setUp()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
if (!extension_loaded('apc') || !ini_get('apc.enable_cli')) {
|
||||
$this->markTestSkipped('APC is not loaded.');
|
||||
}
|
||||
|
|
|
@ -24,8 +24,6 @@ class LegacyElementMetadataTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$this->metadata = new TestElementMetadata();
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,6 @@ class MemberMetadataTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyAddValidSetsMemberToCascaded()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$result = $this->metadata->addConstraint(new Valid());
|
||||
|
||||
$this->assertEquals(array(), $this->metadata->getConstraints());
|
||||
|
@ -54,8 +52,6 @@ class MemberMetadataTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyAddOtherConstraintDoesNotSetMemberToCascaded()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$result = $this->metadata->addConstraint($constraint = new ConstraintA());
|
||||
|
||||
$this->assertEquals(array($constraint), $this->metadata->getConstraints());
|
||||
|
|
|
@ -75,6 +75,12 @@ abstract class Abstract2Dot5ApiTest extends AbstractValidatorTest
|
|||
$this->assertCount(1, $violations);
|
||||
}
|
||||
|
||||
public function testValidateWithEmptyArrayAsConstraint()
|
||||
{
|
||||
$violations = $this->validator->validate('value', array());
|
||||
$this->assertCount(0, $violations);
|
||||
}
|
||||
|
||||
public function testGroupSequenceAbortsAfterFailedGroup()
|
||||
{
|
||||
$entity = new Entity();
|
||||
|
@ -578,8 +584,6 @@ abstract class Abstract2Dot5ApiTest extends AbstractValidatorTest
|
|||
*/
|
||||
public function testLegacyPropertyMetadataMustImplementPropertyMetadataInterface()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$entity = new Entity();
|
||||
|
||||
// Legacy interface
|
||||
|
|
|
@ -42,8 +42,6 @@ abstract class AbstractLegacyApiTest extends AbstractValidatorTest
|
|||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$this->validator = $this->createValidator($this->metadataFactory);
|
||||
|
|
|
@ -844,8 +844,6 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyValidatePropertyFailsIfPropertiesNotSupported()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
// $metadata does not implement PropertyMetadataContainerInterface
|
||||
$metadata = $this->getMock('Symfony\Component\Validator\MetadataInterface');
|
||||
|
||||
|
@ -977,8 +975,6 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyValidatePropertyValueFailsIfPropertiesNotSupported()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
// $metadata does not implement PropertyMetadataContainerInterface
|
||||
$metadata = $this->getMock('Symfony\Component\Validator\MetadataInterface');
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ use Symfony\Component\Translation\IdentityTranslator;
|
|||
use Symfony\Component\Validator\ConstraintValidatorFactory;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextFactory;
|
||||
use Symfony\Component\Validator\MetadataFactoryInterface;
|
||||
use Symfony\Component\Validator\Tests\Fixtures\Entity;
|
||||
use Symfony\Component\Validator\Validator\RecursiveValidator;
|
||||
|
||||
class RecursiveValidator2Dot5ApiTest extends Abstract2Dot5ApiTest
|
||||
|
@ -29,4 +30,28 @@ class RecursiveValidator2Dot5ApiTest extends Abstract2Dot5ApiTest
|
|||
|
||||
return new RecursiveValidator($contextFactory, $metadataFactory, $validatorFactory, $objectInitializers);
|
||||
}
|
||||
|
||||
public function testEmptyGroupsArrayDoesNotTriggerDeprecation()
|
||||
{
|
||||
$entity = new Entity();
|
||||
|
||||
$validatorContext = $this->getMock('Symfony\Component\Validator\Validator\ContextualValidatorInterface');
|
||||
$validatorContext
|
||||
->expects($this->once())
|
||||
->method('validate')
|
||||
->with($entity, null, array())
|
||||
->willReturnSelf();
|
||||
|
||||
$validator = $this
|
||||
->getMockBuilder('Symfony\Component\Validator\Validator\RecursiveValidator')
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('startContext'))
|
||||
->getMock();
|
||||
$validator
|
||||
->expects($this->once())
|
||||
->method('startContext')
|
||||
->willReturn($validatorContext);
|
||||
|
||||
$validator->validate($entity, null, array());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\ValidationVisitor class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\ValidationVisitor class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Symfony\Component\Validator\Exception\NoSuchMetadataException;
|
||||
|
|
2
core/vendor/symfony/validator/Validator.php
vendored
2
core/vendor/symfony/validator/Validator.php
vendored
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\Validator class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Validator\Validator\RecursiveValidator class instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\Validator class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Validator\Validator\RecursiveValidator class instead.', E_USER_DEPRECATED);
|
||||
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Symfony\Component\Validator\Constraints\Valid;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator\Validator;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\LegacyValidator class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\LegacyValidator class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* A validator that supports both the API of Symfony < 2.5 and Symfony 2.5+.
|
||||
|
|
|
@ -25,6 +25,7 @@ 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
|
||||
|
@ -124,7 +125,7 @@ class RecursiveValidator implements ValidatorInterface, LegacyValidatorInterface
|
|||
$constraints = $groups;
|
||||
$groups = $traverse;
|
||||
} else {
|
||||
trigger_error('The Symfony\Component\Validator\ValidatorInterface::validate method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::validate method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The Symfony\Component\Validator\ValidatorInterface::validate method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::validate method instead.', E_USER_DEPRECATED);
|
||||
|
||||
$constraints = new Valid(array('traverse' => $traverse, 'deep' => $deep));
|
||||
}
|
||||
|
@ -160,7 +161,7 @@ class RecursiveValidator implements ValidatorInterface, LegacyValidatorInterface
|
|||
*/
|
||||
public function validateValue($value, $constraints, $groups = null)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::validate method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::validate method instead.', E_USER_DEPRECATED);
|
||||
|
||||
return $this->validate($value, $constraints, $groups);
|
||||
}
|
||||
|
@ -170,18 +171,18 @@ class RecursiveValidator implements ValidatorInterface, LegacyValidatorInterface
|
|||
*/
|
||||
public function getMetadataFactory()
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED);
|
||||
|
||||
return $this->metadataFactory;
|
||||
}
|
||||
|
||||
private static function testConstraints($constraints)
|
||||
{
|
||||
return null === $constraints || $constraints instanceof Constraint || (is_array($constraints) && current($constraints) instanceof Constraint);
|
||||
return null === $constraints || $constraints instanceof Constraint || (is_array($constraints) && (0 === count($constraints) || current($constraints) instanceof Constraint));
|
||||
}
|
||||
|
||||
private static function testGroups($groups)
|
||||
{
|
||||
return null === $groups || is_string($groups) || $groups instanceof GroupSequence || (is_array($groups) && (is_string(current($groups)) || current($groups) instanceof GroupSequence));
|
||||
return null === $groups || is_string($groups) || $groups instanceof GroupSequence || (is_array($groups) && (0 === count($groups) || is_string(current($groups)) || current($groups) instanceof GroupSequence));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -300,7 +300,7 @@ class ValidatorBuilder implements ValidatorBuilderInterface
|
|||
*/
|
||||
public function setPropertyAccessor(PropertyAccessorInterface $propertyAccessor)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. The validator will function without a property accessor.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. The validator will function without a property accessor.', E_USER_DEPRECATED);
|
||||
|
||||
if (null !== $this->validatorFactory) {
|
||||
throw new ValidatorException('You cannot set a property accessor after setting a custom validator factory. Configure your validator factory instead.');
|
||||
|
@ -318,7 +318,7 @@ class ValidatorBuilder implements ValidatorBuilderInterface
|
|||
*/
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated in version 2.7 and will be removed in version 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated in version 2.7 and will be removed in version 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
if (!in_array($apiVersion, array(Validation::API_VERSION_2_4, Validation::API_VERSION_2_5, Validation::API_VERSION_2_5_BC))) {
|
||||
throw new InvalidArgumentException(sprintf('The requested API version is invalid: "%s"', $apiVersion));
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Component\Validator\Violation;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\LegacyConstraintViolationBuilder class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__NAMESPACE__.'\LegacyConstraintViolationBuilder class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
|
||||
|
|
Reference in a new issue