diff --git a/src/Symfony/Component/Validator/ConstraintValidator.php b/src/Symfony/Component/Validator/ConstraintValidator.php index acf499c999..7a412737bd 100644 --- a/src/Symfony/Component/Validator/ConstraintValidator.php +++ b/src/Symfony/Component/Validator/ConstraintValidator.php @@ -61,7 +61,7 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface * * @return ConstraintViolationBuilderInterface The violation builder * - * @deprecated This method will be removed in Symfony 3.0. + * @deprecated since version 2.5, to be removed in 3.0. */ protected function buildViolation($message, array $parameters = array()) { @@ -84,7 +84,7 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface * * @return ConstraintViolationBuilderInterface The violation builder * - * @deprecated This method will be removed in Symfony 3.0. + * @deprecated since version 2.5, to be removed in 3.0. */ protected function buildViolationInContext(ExecutionContextInterface $context, $message, array $parameters = array()) { diff --git a/src/Symfony/Component/Validator/Constraints/GroupSequence.php b/src/Symfony/Component/Validator/Constraints/GroupSequence.php index c540c699b2..9a3cad2581 100644 --- a/src/Symfony/Component/Validator/Constraints/GroupSequence.php +++ b/src/Symfony/Component/Validator/Constraints/GroupSequence.php @@ -97,12 +97,13 @@ class GroupSequence implements \ArrayAccess, \IteratorAggregate, \Countable /** * Returns an iterator for this group. * + * Implemented for backwards compatibility with Symfony < 2.5. + * * @return \Traversable The iterator * * @see \IteratorAggregate::getIterator() * - * @deprecated Implemented for backwards compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. + * @deprecated since version 2.5, to be removed in Symfony 3.0. */ public function getIterator() { @@ -114,12 +115,13 @@ class GroupSequence implements \ArrayAccess, \IteratorAggregate, \Countable /** * Returns whether the given offset exists in the sequence. * + * Implemented for backwards compatibility with Symfony < 2.5. + * * @param int $offset The offset * * @return bool Whether the offset exists * - * @deprecated Implemented for backwards compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. + * @deprecated since version 2.5, to be removed in Symfony 3.0. */ public function offsetExists($offset) { @@ -131,14 +133,15 @@ class GroupSequence implements \ArrayAccess, \IteratorAggregate, \Countable /** * Returns the group at the given offset. * + * Implemented for backwards compatibility with Symfony < 2.5. + * * @param int $offset The offset * * @return string The group a the given offset * * @throws OutOfBoundsException If the object does not exist * - * @deprecated Implemented for backwards compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. + * @deprecated since version 2.5, to be removed in Symfony 3.0. */ public function offsetGet($offset) { @@ -157,11 +160,12 @@ class GroupSequence implements \ArrayAccess, \IteratorAggregate, \Countable /** * Sets the group at the given offset. * + * Implemented for backwards compatibility with Symfony < 2.5. + * * @param int $offset The offset * @param string $value The group name * - * @deprecated Implemented for backwards compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. + * @deprecated since version 2.5, to be removed in Symfony 3.0. */ public function offsetSet($offset, $value) { @@ -179,10 +183,11 @@ class GroupSequence implements \ArrayAccess, \IteratorAggregate, \Countable /** * Removes the group at the given offset. * + * Implemented for backwards compatibility with Symfony < 2.5. + * * @param int $offset The offset * - * @deprecated Implemented for backwards compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. + * @deprecated since version 2.5, to be removed in Symfony 3.0. */ public function offsetUnset($offset) { @@ -194,10 +199,11 @@ class GroupSequence implements \ArrayAccess, \IteratorAggregate, \Countable /** * Returns the number of groups in the sequence. * + * Implemented for backwards compatibility with Symfony < 2.5. + * * @return int The number of groups * - * @deprecated Implemented for backwards compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. + * @deprecated since version 2.5, to be removed in Symfony 3.0. */ public function count() { diff --git a/src/Symfony/Component/Validator/Context/ExecutionContext.php b/src/Symfony/Component/Validator/Context/ExecutionContext.php index d7f157da1c..9c5e6d639f 100644 --- a/src/Symfony/Component/Validator/Context/ExecutionContext.php +++ b/src/Symfony/Component/Validator/Context/ExecutionContext.php @@ -187,8 +187,10 @@ 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); + throw new BadMethodCallException( - 'The parameters $invalidValue, $pluralization and $code are '. + 'The parameters $invalidValue, $plural and $code are '. 'not supported anymore as of Symfony 2.5. Please use '. 'buildViolation() instead or enable the legacy mode.' ); @@ -286,7 +288,13 @@ class ExecutionContext implements ExecutionContextInterface */ public function getClassName() { - return $this->metadata instanceof ClassBasedInterface ? $this->metadata->getClassName() : null; + if ($this->metadata instanceof ClassBasedInterface) { + trigger_error('The Symfony\Component\Validator\ClassBasedInterface interface is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + + return $this->metadata->getClassName(); + } + + return null; } /** @@ -310,6 +318,8 @@ class ExecutionContext implements ExecutionContextInterface */ public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null) { + trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED); + throw new BadMethodCallException( 'addViolationAt() is not supported anymore as of Symfony 2.5. '. 'Please use buildViolation() instead or enable the legacy mode.' @@ -321,7 +331,7 @@ class ExecutionContext implements ExecutionContextInterface */ public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false) { - trigger_error('ExecutionContext::validate() is deprecated since version 2.5 and will be removed in 3.0. Use ExecutionContext::getValidator() together with inContext() instead.', E_USER_DEPRECATED); + trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator method together with Symfony\Component\Validator\Validator\ValidatorInterface::inContext method instead.', E_USER_DEPRECATED); throw new BadMethodCallException( 'validate() is not supported anymore as of Symfony 2.5. '. @@ -334,7 +344,7 @@ class ExecutionContext implements ExecutionContextInterface */ public function validateValue($value, $constraints, $subPath = '', $groups = null) { - trigger_error('ExecutionContext::validateValue() is deprecated since version 2.5 and will be removed in 3.0. Use ExecutionContext::getValidator() together with inContext() instead.', E_USER_DEPRECATED); + trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator method together with Symfony\Component\Validator\Validator\ValidatorInterface::inContext method instead.', E_USER_DEPRECATED); throw new BadMethodCallException( 'validateValue() is not supported anymore as of Symfony 2.5. '. @@ -347,6 +357,8 @@ 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 '.__CLASS__.'::getValidator method together with Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED); + throw new BadMethodCallException( 'getMetadataFactory() is not supported anymore as of Symfony 2.5. '. 'Please use getValidator() in combination with getMetadataFor() '. diff --git a/src/Symfony/Component/Validator/Context/LegacyExecutionContext.php b/src/Symfony/Component/Validator/Context/LegacyExecutionContext.php index e922a5cbc8..274be01db1 100644 --- a/src/Symfony/Component/Validator/Context/LegacyExecutionContext.php +++ b/src/Symfony/Component/Validator/Context/LegacyExecutionContext.php @@ -11,8 +11,6 @@ namespace Symfony\Component\Validator\Context; -trigger_error('The '.__NAMESPACE__.'\LegacyExecutionContext class is deprecated since version 2.5 and will be removed in 3.0. Use the new Symfony\Component\Validator\Context\ExecutionContext class instead.', E_USER_DEPRECATED); - use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Validator\Constraints\Valid; use Symfony\Component\Validator\MetadataFactoryInterface; @@ -24,8 +22,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; * @since 2.5 * @author Bernhard Schussek * - * @deprecated Implemented for backward compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. + * @deprecated since version 2.5, to be removed in 3.0. */ class LegacyExecutionContext extends ExecutionContext { @@ -44,6 +41,8 @@ class LegacyExecutionContext extends ExecutionContext */ public function __construct(ValidatorInterface $validator, $root, MetadataFactoryInterface $metadataFactory, TranslatorInterface $translator, $translationDomain = null) { + trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the new Symfony\Component\Validator\Context\ExecutionContext class instead.', E_USER_DEPRECATED); + parent::__construct( $validator, $root, @@ -60,6 +59,8 @@ class LegacyExecutionContext extends ExecutionContext public function addViolation($message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null) { 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) @@ -79,6 +80,8 @@ class LegacyExecutionContext extends ExecutionContext */ 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) @@ -140,6 +143,8 @@ class LegacyExecutionContext extends ExecutionContext */ 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__.'::validate method instead.', E_USER_DEPRECATED); + return $this ->getValidator() ->inContext($this) @@ -153,6 +158,8 @@ class LegacyExecutionContext extends ExecutionContext */ 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); + return $this->metadataFactory; } } diff --git a/src/Symfony/Component/Validator/Context/LegacyExecutionContextFactory.php b/src/Symfony/Component/Validator/Context/LegacyExecutionContextFactory.php index b0fdbb176c..9b225636e2 100644 --- a/src/Symfony/Component/Validator/Context/LegacyExecutionContextFactory.php +++ b/src/Symfony/Component/Validator/Context/LegacyExecutionContextFactory.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Validator\Context; +trigger_error('The '.__NAMESPACE__.'\LegacyExecutionContextFactory is deprecated since version 2.5 and will be removed in 3.0.'); + use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Validator\MetadataFactoryInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; @@ -18,11 +20,12 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; /** * Creates new {@link LegacyExecutionContext} instances. * + * Implemented for backward compatibility with Symfony < 2.5. + * * @since 2.5 * @author Bernhard Schussek * - * @deprecated Implemented for backward compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. + * @deprecated since version 2.5, to be removed in 3.0. */ class LegacyExecutionContextFactory implements ExecutionContextFactoryInterface { diff --git a/src/Symfony/Component/Validator/ExecutionContextInterface.php b/src/Symfony/Component/Validator/ExecutionContextInterface.php index 92d4230b28..1d35580c4d 100644 --- a/src/Symfony/Component/Validator/ExecutionContextInterface.php +++ b/src/Symfony/Component/Validator/ExecutionContextInterface.php @@ -99,9 +99,9 @@ interface ExecutionContextInterface * * @api * - * @deprecated The parameters $invalidValue, $pluralization and $code are - * deprecated since version 2.5 and will be removed in - * Symfony 3.0. + * @deprecated since version 2.5. + * The parameters $invalidValue, $plural and $code will be removed + * in 3.0. */ public function addViolation($message, array $params = array(), $invalidValue = null, $plural = null, $code = null); diff --git a/src/Symfony/Component/Validator/Mapping/Deprecated/TraversalStrategy.php b/src/Symfony/Component/Validator/Mapping/Deprecated/TraversalStrategy.php new file mode 100644 index 0000000000..28921e0b0b --- /dev/null +++ b/src/Symfony/Component/Validator/Mapping/Deprecated/TraversalStrategy.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Deprecated; + +trigger_error('Constants STOP_RECURSION in class Symfony\Component\Validator\Mapping\TraversalStrategy is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED); + +/** + * @deprecated since version 2.7, to be removed in 3.0. + * @internal + */ +final class TraversalStrategy +{ + const STOP_RECURSION = 8; + + private function __construct() + { + } +} diff --git a/src/Symfony/Component/Validator/Mapping/GenericMetadata.php b/src/Symfony/Component/Validator/Mapping/GenericMetadata.php index 044c884a9a..44fed35981 100644 --- a/src/Symfony/Component/Validator/Mapping/GenericMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/GenericMetadata.php @@ -231,10 +231,11 @@ class GenericMetadata implements MetadataInterface * * Should not be used. * + * Implemented for backward compatibility with Symfony < 2.5. + * * @throws BadMethodCallException * - * @deprecated Implemented for backward compatibility with Symfony < 2.5. - * Will be removed in Symfony 3.0. + * @deprecated since version 2.5, to be removed in 3.0. */ public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath) { diff --git a/src/Symfony/Component/Validator/Mapping/TraversalStrategy.php b/src/Symfony/Component/Validator/Mapping/TraversalStrategy.php index 44b760c1df..2c26614f2a 100644 --- a/src/Symfony/Component/Validator/Mapping/TraversalStrategy.php +++ b/src/Symfony/Component/Validator/Mapping/TraversalStrategy.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Validator\Mapping; +use Symfony\Component\Validator\Mapping\Deprecated\TraversalStrategy as Deprecated; + /** * Specifies whether and how a traversable object should be traversed. * @@ -51,10 +53,11 @@ class TraversalStrategy * Specifies that nested instances of {@link \Traversable} should never be * iterated. Can be combined with {@link IMPLICIT} or {@link TRAVERSE}. * - * @deprecated This constant was added for backward compatibility only. - * It will be removed in Symfony 3.0. + * This constant was added for backward compatibility only. + * + * @deprecated since version 2.5, to be removed in 3.0. */ - const STOP_RECURSION = 8; + const STOP_RECURSION = Deprecated::STOP_RECURSION; /** * Not instantiable. diff --git a/src/Symfony/Component/Validator/ValidationVisitor.php b/src/Symfony/Component/Validator/ValidationVisitor.php index 401706cbf2..c7e06554b8 100644 --- a/src/Symfony/Component/Validator/ValidationVisitor.php +++ b/src/Symfony/Component/Validator/ValidationVisitor.php @@ -81,8 +81,6 @@ class ValidationVisitor implements ValidationVisitorInterface, GlobalExecutionCo */ public function __construct($root, MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, TranslatorInterface $translator, $translationDomain = null, array $objectInitializers = array()) { - trigger_error('Symfony\Component\Validator\ValidationVisitor was deprecated in version 2.5 and will be removed in version 3.0.', E_USER_DEPRECATED); - foreach ($objectInitializers as $initializer) { if (!$initializer instanceof ObjectInitializerInterface) { throw new UnexpectedTypeException($initializer, 'Symfony\Component\Validator\ObjectInitializerInterface'); diff --git a/src/Symfony/Component/Validator/ValidationVisitorInterface.php b/src/Symfony/Component/Validator/ValidationVisitorInterface.php index 4cd5ecda91..0ab7b73667 100644 --- a/src/Symfony/Component/Validator/ValidationVisitorInterface.php +++ b/src/Symfony/Component/Validator/ValidationVisitorInterface.php @@ -64,8 +64,6 @@ interface ValidationVisitorInterface * * @throws Exception\NoSuchMetadataException If no metadata can be found for * the given value. - * - * @deprecated since version 2.5, to be removed in 3.0. */ public function validate($value, $group, $propertyPath, $traverse = false, $deep = false); @@ -79,8 +77,6 @@ interface ValidationVisitorInterface * @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. - * - * @deprecated since version 2.5, to be removed in 3.0. */ public function visit(MetadataInterface $metadata, $value, $group, $propertyPath); } diff --git a/src/Symfony/Component/Validator/Validator/LegacyValidator.php b/src/Symfony/Component/Validator/Validator/LegacyValidator.php index cac4fa96a5..1d4153733d 100644 --- a/src/Symfony/Component/Validator/Validator/LegacyValidator.php +++ b/src/Symfony/Component/Validator/Validator/LegacyValidator.php @@ -34,8 +34,7 @@ use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface; * @see \Symfony\Component\Validator\ValidatorInterface * @see \Symfony\Component\Validator\Validator\ValidatorInterface * - * @deprecated Implemented for backward compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. + * @deprecated since version 2.5, to be removed in 3.0. */ class LegacyValidator extends RecursiveValidator implements LegacyValidatorInterface { @@ -52,7 +51,7 @@ class LegacyValidator extends RecursiveValidator implements LegacyValidatorInter return parent::validate($value, $constraints, $groups); } - trigger_error('The Symfony\Component\Validator\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 '.__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); $constraint = new Valid(array('traverse' => $traverse, 'deep' => $deep)); @@ -61,14 +60,14 @@ class LegacyValidator extends RecursiveValidator implements LegacyValidatorInter public function validateValue($value, $constraints, $groups = null) { - trigger_error('The Symfony\Component\Validator\Validator\ValidatorInterface::validateValue 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 parent::validate($value, $constraints, $groups); } public function getMetadataFactory() { - trigger_error('The Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFactory 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::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED); return $this->metadataFactory; } diff --git a/src/Symfony/Component/Validator/ValidatorInterface.php b/src/Symfony/Component/Validator/ValidatorInterface.php index 7ef9e59654..d207a9c940 100644 --- a/src/Symfony/Component/Validator/ValidatorInterface.php +++ b/src/Symfony/Component/Validator/ValidatorInterface.php @@ -93,8 +93,9 @@ interface ValidatorInterface * * @api * - * @deprecated Renamed to {@link Validator\ValidatorInterface::validate()} - * in Symfony 2.5. Will be removed in Symfony 3.0. + * @deprecated since version 2.5, to be removed in 3.0. + * Renamed to {@link Validator\ValidatorInterface::validate()} + * in Symfony 2.5. */ public function validateValue($value, $constraints, $groups = null); diff --git a/src/Symfony/Component/Validator/Violation/LegacyConstraintViolationBuilder.php b/src/Symfony/Component/Validator/Violation/LegacyConstraintViolationBuilder.php index a392a97ed2..01effe46c8 100644 --- a/src/Symfony/Component/Validator/Violation/LegacyConstraintViolationBuilder.php +++ b/src/Symfony/Component/Validator/Violation/LegacyConstraintViolationBuilder.php @@ -23,7 +23,7 @@ use Symfony\Component\Validator\ExecutionContextInterface; * @internal You should not instantiate or use this class. Code against * {@link ConstraintViolationBuilderInterface} instead. * - * @deprecated This class will be removed in Symfony 3.0. + * @deprecated since version 2.5.5, to be removed in 3.0. */ class LegacyConstraintViolationBuilder implements ConstraintViolationBuilderInterface {