Permalink
Browse files

[Validator] removed deprecated methods

  • Loading branch information...
fabpot committed Sep 30, 2015
1 parent 925ecaf commit 2a6b629e39a3069f67af94e991c7a1b672c7b983
Showing with 230 additions and 2,896 deletions.
  1. +0 −30 src/Symfony/Component/Validator/ClassBasedInterface.php
  2. +1 −48 src/Symfony/Component/Validator/ConstraintValidator.php
  3. +2 −0 src/Symfony/Component/Validator/ConstraintValidatorInterface.php
  4. +0 −26 src/Symfony/Component/Validator/ConstraintViolation.php
  5. +3 −7 src/Symfony/Component/Validator/ConstraintViolationInterface.php
  6. +0 −2 src/Symfony/Component/Validator/Constraints/GroupSequence.php
  7. +0 −9 src/Symfony/Component/Validator/Constraints/Valid.php
  8. +4 −119 src/Symfony/Component/Validator/Context/ExecutionContext.php
  9. +120 −2 src/Symfony/Component/Validator/Context/ExecutionContextInterface.php
  10. +0 −55 src/Symfony/Component/Validator/Context/LegacyExecutionContext.php
  11. +0 −77 src/Symfony/Component/Validator/Context/LegacyExecutionContextFactory.php
  12. +0 −171 src/Symfony/Component/Validator/DefaultTranslator.php
  13. +0 −295 src/Symfony/Component/Validator/ExecutionContext.php
  14. +0 −319 src/Symfony/Component/Validator/ExecutionContextInterface.php
  15. +0 −71 src/Symfony/Component/Validator/GlobalExecutionContextInterface.php
  16. +0 −28 src/Symfony/Component/Validator/Mapping/BlackholeMetadataFactory.php
  17. +0 −57 src/Symfony/Component/Validator/Mapping/Cache/ApcCache.php
  18. +1 −89 src/Symfony/Component/Validator/Mapping/ClassMetadata.php
  19. +0 −28 src/Symfony/Component/Validator/Mapping/ClassMetadataFactory.php
  20. +30 −4 src/Symfony/Component/Validator/Mapping/ClassMetadataInterface.php
  21. +0 −30 src/Symfony/Component/Validator/Mapping/ElementMetadata.php
  22. +21 −2 src/Symfony/Component/Validator/Mapping/Factory/MetadataFactoryInterface.php
  23. +2 −26 src/Symfony/Component/Validator/Mapping/GenericMetadata.php
  24. +1 −64 src/Symfony/Component/Validator/Mapping/MemberMetadata.php
  25. +11 −2 src/Symfony/Component/Validator/Mapping/MetadataInterface.php
  26. +16 −4 src/Symfony/Component/Validator/Mapping/PropertyMetadataInterface.php
  27. +0 −43 src/Symfony/Component/Validator/MetadataFactoryInterface.php
  28. +0 −73 src/Symfony/Component/Validator/MetadataInterface.php
  29. +0 −45 src/Symfony/Component/Validator/PropertyMetadataContainerInterface.php
  30. +0 −46 src/Symfony/Component/Validator/PropertyMetadataInterface.php
  31. +3 −97 src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php
  32. +1 −1 src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php
  33. +1 −1 src/Symfony/Component/Validator/Tests/Fixtures/CallbackClass.php
  34. +1 −1 src/Symfony/Component/Validator/Tests/Fixtures/ConstraintAValidator.php
  35. +1 −1 src/Symfony/Component/Validator/Tests/Fixtures/Entity.php
  36. +1 −1 src/Symfony/Component/Validator/Tests/Fixtures/FakeMetadataFactory.php
  37. +0 −20 src/Symfony/Component/Validator/Tests/Fixtures/LegacyClassMetadata.php
  38. +0 −70 src/Symfony/Component/Validator/Tests/Fixtures/StubGlobalExecutionContext.php
  39. +1 −1 src/Symfony/Component/Validator/Tests/Validator/Abstract2Dot5ApiTest.php
  40. +1 −1 src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php
  41. +1 −1 src/Symfony/Component/Validator/Tests/Validator/RecursiveValidator2Dot5ApiTest.php
  42. +0 −212 src/Symfony/Component/Validator/ValidationVisitor.php
  43. +0 −82 src/Symfony/Component/Validator/ValidationVisitorInterface.php
  44. +0 −237 src/Symfony/Component/Validator/Validator.php
  45. +0 −29 src/Symfony/Component/Validator/Validator/LegacyValidator.php
  46. +1 −1 src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php
  47. +3 −37 src/Symfony/Component/Validator/Validator/RecursiveValidator.php
  48. +1 −35 src/Symfony/Component/Validator/ValidatorBuilder.php
  49. +1 −24 src/Symfony/Component/Validator/ValidatorBuilderInterface.php
  50. +0 −103 src/Symfony/Component/Validator/ValidatorInterface.php
  51. +0 −166 src/Symfony/Component/Validator/Violation/LegacyConstraintViolationBuilder.php
  52. +1 −3 src/Symfony/Component/Validator/composer.json

This file was deleted.

Oops, something went wrong.
@@ -11,9 +11,7 @@
namespace Symfony\Component\Validator;
use Symfony\Component\Validator\Context\ExecutionContextInterface as ExecutionContextInterface2Dot5;
use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface;
use Symfony\Component\Validator\Violation\LegacyConstraintViolationBuilder;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* Base class for constraint validators.
@@ -50,51 +48,6 @@ public function initialize(ExecutionContextInterface $context)
$this->context = $context;
}
/**
* Wrapper for {@link ExecutionContextInterface::buildViolation} that
* supports the 2.4 context API.
*
* @param string $message The violation message
* @param array $parameters The message parameters
*
* @return ConstraintViolationBuilderInterface The violation builder
*
* @deprecated since version 2.5, to be removed in 3.0.
*/
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);
if ($this->context instanceof ExecutionContextInterface2Dot5) {
return $this->context->buildViolation($message, $parameters);
}
return new LegacyConstraintViolationBuilder($this->context, $message, $parameters);
}
/**
* Wrapper for {@link ExecutionContextInterface::buildViolation} that
* supports the 2.4 context API.
*
* @param ExecutionContextInterface $context The context to use
* @param string $message The violation message
* @param array $parameters The message parameters
*
* @return ConstraintViolationBuilderInterface The violation builder
*
* @deprecated since version 2.5, to be removed in 3.0.
*/
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);
if ($context instanceof ExecutionContextInterface2Dot5) {
return $context->buildViolation($message, $parameters);
}
return new LegacyConstraintViolationBuilder($context, $message, $parameters);
}
/**
* Returns a string representation of the type of the value.
*
@@ -11,6 +11,8 @@
namespace Symfony\Component\Validator;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
@@ -141,19 +141,6 @@ public function getMessageTemplate()
/**
* {@inheritdoc}
*
* @deprecated since version 2.7, to be removed in 3.0.
* Use getParameters() instead
*/
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);
return $this->parameters;
}
/**
* Alias of {@link getMessageParameters()}.
*/
public function getParameters()
{
@@ -162,19 +149,6 @@ public function getParameters()
/**
* {@inheritdoc}
*
* @deprecated since version 2.7, to be removed in 3.0.
* Use getPlural() instead
*/
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);
return $this->plural;
}
/**
* Alias of {@link getMessagePluralization()}.
*/
public function getPlural()
{
@@ -46,7 +46,7 @@ public function getMessage();
* Returns the raw violation message.
*
* The raw violation message contains placeholders for the parameters
* returned by {@link getMessageParameters}. Typically you'll pass the
* returned by {@link getParameters}. Typically you'll pass the
* message template and parameters to a translation engine.
*
* @return string The raw violation message.
@@ -60,10 +60,8 @@ public function getMessageTemplate();
* that appear in the message template.
*
* @see getMessageTemplate()
*
* @deprecated since version 2.7, to be replaced by getParameters() in 3.0.
*/
public function getMessageParameters();
public function getParameters();
/**
* Returns a number for pluralizing the violation message.
@@ -80,10 +78,8 @@ public function getMessageParameters();
* pluralization form (in this case "choices").
*
* @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.
*/
public function getMessagePluralization();
public function getPlural();
/**
* Returns the root element of the validation.
@@ -11,8 +11,6 @@
namespace Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Exception\OutOfBoundsException;
/**
* A sequence of validation groups.
*
@@ -24,11 +24,6 @@ class Valid extends Constraint
{
public $traverse = true;
/**
* @deprecated since version 2.5, to be removed in Symfony 3.0.
*/
public $deep = true;
public function __construct($options = null)
{
if (is_array($options) && array_key_exists('groups', $options)) {
@@ -38,10 +33,6 @@ public function __construct($options = null)
));
}
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);
}
parent::__construct($options);
}
}
@@ -12,16 +12,15 @@
namespace Symfony\Component\Validator\Context;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\ClassBasedInterface;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;
use Symfony\Component\Validator\Mapping\ClassMetadataInterface;
use Symfony\Component\Validator\Mapping\MetadataInterface;
use Symfony\Component\Validator\Mapping\MemberMetadata;
use Symfony\Component\Validator\Mapping\PropertyMetadataInterface;
use Symfony\Component\Validator\Util\PropertyPath;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface;
use Symfony\Component\Validator\Violation\ConstraintViolationBuilder;
/**
@@ -183,25 +182,8 @@ public function setConstraint(Constraint $constraint)
/**
* {@inheritdoc}
*/
public function addViolation($message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null)
public function addViolation($message, array $parameters = array())
{
// The parameters $invalidValue and following are ignored by the new
// 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);
$this
->buildViolation($message, $parameters)
->setInvalidValue($invalidValue)
->setPlural($plural)
->setCode($code)
->addViolation()
;
return;
}
$this->violations->add(new ConstraintViolation(
$this->translator->trans($message, $parameters, $this->translationDomain),
$message,
@@ -294,7 +276,7 @@ public function getGroup()
*/
public function getClassName()
{
return $this->metadata instanceof ClassBasedInterface ? $this->metadata->getClassName() : null;
return $this->metadata instanceof MemberMetadata || $this->metadata instanceof ClassMetadataInterface ? $this->metadata->getClassName() : null;
}
/**
@@ -313,103 +295,6 @@ public function getPropertyPath($subPath = '')
return PropertyPath::append($this->propertyPath, $subPath);
}
/**
* {@inheritdoc}
*/
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);
if (func_num_args() > 2) {
$this
->buildViolation($message, $parameters)
->atPath($subPath)
->setInvalidValue($invalidValue)
->setPlural($plural)
->setCode($code)
->addViolation()
;
return;
}
$this
->buildViolation($message, $parameters)
->atPath($subPath)
->addViolation()
;
}
/**
* {@inheritdoc}
*/
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);
if (is_array($value)) {
// The $traverse flag is ignored for arrays
$constraint = new Valid(array('traverse' => true, 'deep' => $deep));
return $this
->getValidator()
->inContext($this)
->atPath($subPath)
->validate($value, $constraint, $groups)
;
}
if ($traverse && $value instanceof \Traversable) {
$constraint = new Valid(array('traverse' => true, 'deep' => $deep));
return $this
->getValidator()
->inContext($this)
->atPath($subPath)
->validate($value, $constraint, $groups)
;
}
return $this
->getValidator()
->inContext($this)
->atPath($subPath)
->validate($value, null, $groups)
;
}
/**
* {@inheritdoc}
*/
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);
return $this
->getValidator()
->inContext($this)
->atPath($subPath)
->validate($value, $constraints, $groups)
;
}
/**
* {@inheritdoc}
*/
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);
$validator = $this->getValidator();
if ($validator instanceof LegacyValidatorInterface) {
return $validator->getMetadataFactory();
}
// The ValidatorInterface extends from the deprecated MetadataFactoryInterface, so return it when we don't have the factory instance itself
return $validator;
}
/**
* {@inheritdoc}
*/
Oops, something went wrong.

0 comments on commit 2a6b629

Please sign in to comment.