diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
index 5e6c9a4176aad..82cde1c319720 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -112,6 +112,14 @@ public function getConfigTreeBuilder()
return $v;
})
->end()
+ ->beforeNormalization()
+ ->ifTrue(function ($v) { return isset($v['validation']['api']); })
+ ->then(function ($v) {
+ trigger_error('The validation.api configuration key is deprecated since version 2.7 and will be removed in 3.0', E_USER_DEPRECATED);
+
+ return $v;
+ })
+ ->end()
->children()
->scalarNode('secret')->end()
->scalarNode('http_method_override')
@@ -610,6 +618,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode)
->scalarNode('translation_domain')->defaultValue('validators')->end()
->booleanNode('strict_email')->defaultFalse()->end()
->enumNode('api')
+ ->info('Deprecated since version 2.7, to be removed in 3.0')
->values(array('2.4', '2.5', '2.5-bc', 'auto'))
->beforeNormalization()
// XML/YAML parse as numbers, not as strings
@@ -620,19 +629,6 @@ private function addValidationSection(ArrayNodeDefinition $rootNode)
->end()
->end()
->end()
- ->validate()
- ->ifTrue(function ($v) { return !isset($v['validation']['api']) || 'auto' === $v['validation']['api']; })
- ->then(function ($v) {
- // This condition is duplicated in ValidatorBuilder. This
- // duplication is necessary in order to know the desired
- // API version already during container configuration
- // (to adjust service classes etc.)
- // See https://github.com/symfony/symfony/issues/11580
- $v['validation']['api'] = '2.5-bc';
-
- return $v;
- })
- ->end()
;
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index 51ff11ed4a369..8236d581c2e5d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -761,20 +761,11 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
$validatorBuilder->addMethodCall('setMetadataCache', array(new Reference($config['cache'])));
}
- if ('2.5' === $config['api']) {
- $api = Validation::API_VERSION_2_5;
- } else {
- // 2.4 is now the same as 2.5 BC
- $api = Validation::API_VERSION_2_5_BC;
- // the validation class needs to be changed for BC
- $container->setParameter('validator.class', 'Symfony\Component\Validator\ValidatorInterface');
- }
-
- $validatorBuilder->addMethodCall('setApiVersion', array($api));
-
// You can use this parameter to check the API version in your own
// bundle extension classes
- $container->setParameter('validator.api', $api);
+ // This is set to 2.5-bc for compatibility with Symfony 2.5 and 2.6.
+ // @deprecated since version 2.7, to be removed in 3.0
+ $container->setParameter('validator.api', '2.5-bc');
}
private function getValidatorMappingFiles(ContainerBuilder $container)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
index 557c9be37d011..617be624fdb9f 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
@@ -153,7 +153,6 @@ protected static function getBundleDefaultConfig()
'static_method' => array('loadValidatorMetadata'),
'translation_domain' => 'validators',
'strict_email' => false,
- 'api' => '2.5-bc',
),
'annotations' => array(
'cache' => 'file',
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_2_5_api.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_2_5_api.php
deleted file mode 100644
index 9fa01821b8dbc..0000000000000
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_2_5_api.php
+++ /dev/null
@@ -1,9 +0,0 @@
-loadFromExtension('framework', array(
- 'secret' => 's3cr3t',
- 'validation' => array(
- 'enabled' => true,
- 'api' => '2.5',
- ),
-));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_2_5_bc_api.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_2_5_bc_api.php
deleted file mode 100644
index e975ee3cdd0fd..0000000000000
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_2_5_bc_api.php
+++ /dev/null
@@ -1,9 +0,0 @@
-loadFromExtension('framework', array(
- 'secret' => 's3cr3t',
- 'validation' => array(
- 'enabled' => true,
- 'api' => '2.5-bc',
- ),
-));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_auto_api.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_auto_api.php
deleted file mode 100644
index 4133928ff44c5..0000000000000
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_auto_api.php
+++ /dev/null
@@ -1,9 +0,0 @@
-loadFromExtension('framework', array(
- 'secret' => 's3cr3t',
- 'validation' => array(
- 'enabled' => true,
- 'api' => 'auto',
- ),
-));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_implicit_api.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_implicit_api.php
deleted file mode 100644
index 9eae9998cc93b..0000000000000
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_implicit_api.php
+++ /dev/null
@@ -1,8 +0,0 @@
-loadFromExtension('framework', array(
- 'secret' => 's3cr3t',
- 'validation' => array(
- 'enabled' => true,
- ),
-));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_2_5_api.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_2_5_api.xml
deleted file mode 100644
index 213d281f4b1ab..0000000000000
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_2_5_api.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_2_5_bc_api.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_2_5_bc_api.xml
deleted file mode 100644
index 38eff2fddd063..0000000000000
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_2_5_bc_api.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_auto_api.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_auto_api.xml
deleted file mode 100644
index 2be409bfb6660..0000000000000
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_auto_api.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_implicit_api.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_implicit_api.xml
deleted file mode 100644
index a41c8f23c9c60..0000000000000
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_implicit_api.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_2_5_api.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_2_5_api.yml
deleted file mode 100644
index d1af6c4e27c6d..0000000000000
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_2_5_api.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-framework:
- secret: s3cr3t
- validation:
- enabled: true
- api: 2.5
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_2_5_bc_api.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_2_5_bc_api.yml
deleted file mode 100644
index ebf12e06f8439..0000000000000
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_2_5_bc_api.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-framework:
- secret: s3cr3t
- validation:
- enabled: true
- api: 2.5-bc
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_auto_api.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_auto_api.yml
deleted file mode 100644
index 27619e63ed7a9..0000000000000
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_auto_api.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-framework:
- secret: s3cr3t
- validation:
- enabled: true
- api: auto
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_implicit_api.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_implicit_api.yml
deleted file mode 100644
index 9b3aa63010535..0000000000000
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_implicit_api.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-framework:
- secret: s3cr3t
- validation:
- enabled: true
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
index e2d8e2a23eb45..f23c1b6bd4473 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
@@ -276,7 +276,7 @@ public function testValidation()
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
- $this->assertCount(7, $calls);
+ $this->assertCount(6, $calls);
$this->assertSame('setConstraintValidatorFactory', $calls[0][0]);
$this->assertEquals(array(new Reference('validator.validator_factory')), $calls[0][1]);
$this->assertSame('setTranslator', $calls[1][0]);
@@ -289,8 +289,6 @@ public function testValidation()
$this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
$this->assertSame('setMetadataCache', $calls[5][0]);
$this->assertEquals(array(new Reference('validator.mapping.cache.apc')), $calls[5][1]);
- $this->assertSame('setApiVersion', $calls[6][0]);
- $this->assertEquals(array(Validation::API_VERSION_2_5_BC), $calls[6][1]);
}
/**
@@ -306,14 +304,14 @@ public function testLegacyFullyConfiguredValidationService()
$container = $this->createContainerFromFile('full');
- $this->assertInstanceOf('Symfony\Component\Validator\ValidatorInterface', $container->get('validator'));
+ $this->assertInstanceOf('Symfony\Component\Validator\Validator\ValidatorInterface', $container->get('validator'));
}
public function testValidationService()
{
$container = $this->createContainerFromFile('validation_annotations');
- $this->assertInstanceOf('Symfony\Component\Validator\ValidatorInterface', $container->get('validator'));
+ $this->assertInstanceOf('Symfony\Component\Validator\Validator\ValidatorInterface', $container->get('validator'));
}
public function testAnnotations()
@@ -337,7 +335,7 @@ public function testValidationAnnotations()
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
- $this->assertCount(7, $calls);
+ $this->assertCount(6, $calls);
$this->assertSame('enableAnnotationMapping', $calls[4][0]);
$this->assertEquals(array(new Reference('annotation_reader')), $calls[4][1]);
$this->assertSame('addMethodMapping', $calls[5][0]);
@@ -355,7 +353,7 @@ public function testValidationPaths()
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
- $this->assertCount(8, $calls);
+ $this->assertCount(7, $calls);
$this->assertSame('addXmlMappings', $calls[3][0]);
$this->assertSame('addYamlMappings', $calls[4][0]);
$this->assertSame('enableAnnotationMapping', $calls[5][0]);
@@ -378,79 +376,11 @@ public function testValidationNoStaticMethod()
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
- $this->assertCount(5, $calls);
+ $this->assertCount(4, $calls);
$this->assertSame('addXmlMappings', $calls[3][0]);
// no cache, no annotations, no static methods
}
- public function testValidation2Dot5Api()
- {
- $container = $this->createContainerFromFile('validation_2_5_api');
-
- $calls = $container->getDefinition('validator.builder')->getMethodCalls();
-
- $this->assertCount(6, $calls);
- $this->assertSame('addXmlMappings', $calls[3][0]);
- $this->assertSame('addMethodMapping', $calls[4][0]);
- $this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
- $this->assertSame('setApiVersion', $calls[5][0]);
- $this->assertSame(array(Validation::API_VERSION_2_5), $calls[5][1]);
- $this->assertSame('Symfony\Component\Validator\Validator\ValidatorInterface', $container->getParameter('validator.class'));
- // no cache, no annotations
- }
-
- public function testValidation2Dot5BcApi()
- {
- $container = $this->createContainerFromFile('validation_2_5_bc_api');
-
- $calls = $container->getDefinition('validator.builder')->getMethodCalls();
-
- $this->assertCount(6, $calls);
- $this->assertSame('addXmlMappings', $calls[3][0]);
- $this->assertSame('addMethodMapping', $calls[4][0]);
- $this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
- $this->assertSame('setApiVersion', $calls[5][0]);
- $this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
- $this->assertSame('Symfony\Component\Validator\ValidatorInterface', $container->getParameter('validator.class'));
- // no cache, no annotations
- }
-
- public function testValidationImplicitApi()
- {
- $container = $this->createContainerFromFile('validation_implicit_api');
-
- $calls = $container->getDefinition('validator.builder')->getMethodCalls();
-
- $this->assertCount(6, $calls);
- $this->assertSame('addXmlMappings', $calls[3][0]);
- $this->assertSame('addMethodMapping', $calls[4][0]);
- $this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
- $this->assertSame('setApiVersion', $calls[5][0]);
- // no cache, no annotations
-
- $this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
- }
-
- /**
- * This feature is equivalent to the implicit api, only that the "api"
- * key is explicitly set to "auto".
- */
- public function testValidationAutoApi()
- {
- $container = $this->createContainerFromFile('validation_auto_api');
-
- $calls = $container->getDefinition('validator.builder')->getMethodCalls();
-
- $this->assertCount(6, $calls);
- $this->assertSame('addXmlMappings', $calls[3][0]);
- $this->assertSame('addMethodMapping', $calls[4][0]);
- $this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
- $this->assertSame('setApiVersion', $calls[5][0]);
- // no cache, no annotations
-
- $this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
- }
-
public function testFormsCanBeEnabledWithoutCsrfProtection()
{
$container = $this->createContainerFromFile('form_no_csrf');
diff --git a/src/Symfony/Component/Validator/Context/ExecutionContext.php b/src/Symfony/Component/Validator/Context/ExecutionContext.php
index 0079d23272bb3..39f7d1506d646 100644
--- a/src/Symfony/Component/Validator/Context/ExecutionContext.php
+++ b/src/Symfony/Component/Validator/Context/ExecutionContext.php
@@ -14,13 +14,14 @@
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\Exception\BadMethodCallException;
use Symfony\Component\Validator\Mapping\MetadataInterface;
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;
/**
@@ -187,11 +188,17 @@ public function addViolation($message, array $parameters = array(), $invalidValu
// API, as they are not present in the new interface anymore.
// You should use buildViolation() instead.
if (func_num_args() > 2) {
- throw new BadMethodCallException(
- 'The parameters $invalidValue, $plural and $code are '.
- 'not supported anymore as of Symfony 2.5. Please use '.
- 'buildViolation() instead or enable the legacy mode.'
- );
+ 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(
@@ -310,10 +317,26 @@ public function getPropertyPath($subPath = '')
*/
public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null)
{
- throw new BadMethodCallException(
- 'addViolationAt() is not supported anymore as of Symfony 2.5. '.
- 'Please use buildViolation() instead or enable the legacy mode.'
- );
+ 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()
+ ;
}
/**
@@ -321,10 +344,37 @@ public function addViolationAt($subPath, $message, array $parameters = array(),
*/
public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false)
{
- throw new BadMethodCallException(
- 'validate() is not supported anymore as of Symfony 2.5. '.
- 'Please use getValidator() instead or enable the legacy mode.'
- );
+ 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)
+ ;
}
/**
@@ -332,10 +382,14 @@ public function validate($value, $subPath = '', $groups = null, $traverse = fals
*/
public function validateValue($value, $constraints, $subPath = '', $groups = null)
{
- throw new BadMethodCallException(
- 'validateValue() is not supported anymore as of Symfony 2.5. '.
- 'Please use getValidator() instead or enable the legacy mode.'
- );
+ 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)
+ ;
}
/**
@@ -343,11 +397,16 @@ public function validateValue($value, $constraints, $subPath = '', $groups = nul
*/
public function getMetadataFactory()
{
- throw new BadMethodCallException(
- 'getMetadataFactory() is not supported anymore as of Symfony 2.5. '.
- 'Please use getValidator() in combination with getMetadataFor() '.
- 'or hasMetadataFor() instead or enable the legacy mode.'
- );
+ 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;
}
/**
diff --git a/src/Symfony/Component/Validator/Context/LegacyExecutionContext.php b/src/Symfony/Component/Validator/Context/LegacyExecutionContext.php
index 8ce6bdb304b4f..5ee7a228c47d1 100644
--- a/src/Symfony/Component/Validator/Context/LegacyExecutionContext.php
+++ b/src/Symfony/Component/Validator/Context/LegacyExecutionContext.php
@@ -11,8 +11,9 @@
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);
+
use Symfony\Component\Translation\TranslatorInterface;
-use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\MetadataFactoryInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
@@ -50,114 +51,4 @@ public function __construct(ValidatorInterface $validator, $root, MetadataFactor
$this->metadataFactory = $metadataFactory;
}
-
- /**
- * {@inheritdoc}
- */
- 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)
- ->setPlural($plural)
- ->setCode($code)
- ->addViolation()
- ;
-
- return;
- }
-
- parent::addViolation($message, $parameters);
- }
-
- /**
- * {@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)
- {
- 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__.'::validate 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);
-
- return $this->metadataFactory;
- }
}
diff --git a/src/Symfony/Component/Validator/Context/LegacyExecutionContextFactory.php b/src/Symfony/Component/Validator/Context/LegacyExecutionContextFactory.php
index c24c1fad3d6eb..31fb4cbdde0ec 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 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;
use Symfony\Component\Validator\Validator\ValidatorInterface;
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php
index bc081289139ba..140f8e49b4e3c 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php
@@ -21,7 +21,6 @@
use Symfony\Component\Validator\ExecutionContextInterface as LegacyExecutionContextInterface;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Mapping\PropertyMetadata;
-use Symfony\Component\Validator\Tests\Fixtures\StubGlobalExecutionContext;
use Symfony\Component\Validator\Validation;
/**
@@ -303,7 +302,10 @@ protected function buildViolation($message)
return new ConstraintViolationAssertion($this->context, $message, $this->constraint);
}
- abstract protected function getApiVersion();
+ protected function getApiVersion()
+ {
+ return Validation::API_VERSION_2_5;
+ }
abstract protected function createValidator();
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyAllValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyAllValidatorLegacyApiTest.php
deleted file mode 100644
index 649bfe1c72e7e..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyAllValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyAllValidatorLegacyApiTest extends AllValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyBlankValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyBlankValidatorLegacyApiTest.php
deleted file mode 100644
index 00b8a7ae6d1ad..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyBlankValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyBlankValidatorLegacyApiTest extends BlankValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyCallbackValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyCallbackValidatorLegacyApiTest.php
deleted file mode 100644
index 8f3ea2b87cc64..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyCallbackValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyCallbackValidatorLegacyApiTest extends CallbackValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyCardSchemeValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyCardSchemeValidatorLegacyApiTest.php
deleted file mode 100644
index e4b41846dda49..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyCardSchemeValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyCardSchemeValidatorLegacyApiTest extends CardSchemeValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyChoiceValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyChoiceValidatorLegacyApiTest.php
deleted file mode 100644
index 9237df55138ff..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyChoiceValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyChoiceValidatorLegacyApiTest extends ChoiceValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArrayLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArrayLegacyApiTest.php
deleted file mode 100644
index 45ca1df385552..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArrayLegacyApiTest.php
+++ /dev/null
@@ -1,25 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @group legacy
- */
-class LegacyCollectionValidatorArrayLegacyApiTest extends CollectionValidatorArrayTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArrayObjectLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArrayObjectLegacyApiTest.php
deleted file mode 100644
index f28aed3b1247d..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArrayObjectLegacyApiTest.php
+++ /dev/null
@@ -1,25 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @group legacy
- */
-class LegacyCollectionValidatorArrayObjectLegacyApiTest extends CollectionValidatorArrayObjectTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorCustomArrayObjectLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorCustomArrayObjectLegacyApiTest.php
deleted file mode 100644
index b04053f24682d..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorCustomArrayObjectLegacyApiTest.php
+++ /dev/null
@@ -1,25 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @group legacy
- */
-class LegacyCollectionValidatorCustomArrayObjectLegacyApiTest extends CollectionValidatorCustomArrayObjectTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorArrayLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorArrayLegacyApiTest.php
deleted file mode 100644
index d36298811c85a..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorArrayLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyCountValidatorArrayLegacyApiTest extends CountValidatorArrayTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorCountableLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorCountableLegacyApiTest.php
deleted file mode 100644
index 33b87957bff26..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorCountableLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyCountValidatorCountableLegacyApiTest extends CountValidatorCountableTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyCurrencyValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyCurrencyValidatorLegacyApiTest.php
deleted file mode 100644
index 85cd5d0a6aaae..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyCurrencyValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyCurrencyValidatorLegacyApiTest extends CurrencyValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyDateTimeValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyDateTimeValidatorLegacyApiTest.php
deleted file mode 100644
index be19302fcf358..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyDateTimeValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyDateTimeValidatorLegacyApiTest extends DateTimeValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyDateValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyDateValidatorLegacyApiTest.php
deleted file mode 100644
index 3235f42312e44..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyDateValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyDateValidatorLegacyApiTest extends DateValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyEmailValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyEmailValidatorLegacyApiTest.php
deleted file mode 100644
index e5f101961ee9a..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyEmailValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyEmailValidatorLegacyApiTest extends EmailValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyEqualToValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyEqualToValidatorLegacyApiTest.php
deleted file mode 100644
index 3a72cfbf5030f..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyEqualToValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyEqualToValidatorLegacyApiTest extends EqualToValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyExpressionValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyExpressionValidatorLegacyApiTest.php
deleted file mode 100644
index 374bba085071c..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyExpressionValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyExpressionValidatorLegacyApiTest extends ExpressionValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyFalseValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyFalseValidatorLegacyApiTest.php
deleted file mode 100644
index 5f7cb12bdb15d..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyFalseValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyFalseValidatorLegacyApiTest extends FalseValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorObjectLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorObjectLegacyApiTest.php
deleted file mode 100644
index 97d5f5969003b..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorObjectLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyFileValidatorObjectLegacyApiTest extends FileValidatorObjectTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorPathLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorPathLegacyApiTest.php
deleted file mode 100644
index 2c298dffcfe08..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorPathLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyFileValidatorPathLegacyApiTest extends FileValidatorPathTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanOrEqualValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanOrEqualValidatorLegacyApiTest.php
deleted file mode 100644
index 08822a53bdead..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanOrEqualValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyGreaterThanOrEqualValidatorLegacyApiTest extends GreaterThanOrEqualValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanValidatorLegacyApiTest.php
deleted file mode 100644
index 0808e9bd15a62..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyGreaterThanValidatorLegacyApiTest extends GreaterThanValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyIbanValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyIbanValidatorLegacyApiTest.php
deleted file mode 100644
index 0ffc4b150658b..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyIbanValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyIbanValidatorLegacyApiTest extends IbanValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyIdenticalToValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyIdenticalToValidatorLegacyApiTest.php
deleted file mode 100644
index aade84f65c229..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyIdenticalToValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyIdenticalToValidatorLegacyApiTest extends IdenticalToValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyImageValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyImageValidatorLegacyApiTest.php
deleted file mode 100644
index d36c1752f3e86..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyImageValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyImageValidatorLegacyApiTest extends ImageValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyIpValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyIpValidatorLegacyApiTest.php
deleted file mode 100644
index 315f2f9ccf819..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyIpValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyIpValidatorLegacyApiTest extends IpValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyIsbnValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyIsbnValidatorLegacyApiTest.php
deleted file mode 100644
index 156827090bc0b..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyIsbnValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyIsbnValidatorLegacyApiTest extends IsbnValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyIssnValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyIssnValidatorLegacyApiTest.php
deleted file mode 100644
index 2ff310416d2a7..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyIssnValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyIssnValidatorLegacyApiTest extends IssnValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyLanguageValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyLanguageValidatorLegacyApiTest.php
deleted file mode 100644
index a6471b3d3bdc3..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyLanguageValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyLanguageValidatorLegacyApiTest extends LanguageValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyLengthValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyLengthValidatorLegacyApiTest.php
deleted file mode 100644
index 655f3d6adb303..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyLengthValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyLengthValidatorLegacyApiTest extends LengthValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanOrEqualValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanOrEqualValidatorLegacyApiTest.php
deleted file mode 100644
index 2e07ab02cac0b..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanOrEqualValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyLessThanOrEqualValidatorLegacyApiTest extends LessThanOrEqualValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanValidatorLegacyApiTest.php
deleted file mode 100644
index 27592b0afc0b8..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyLessThanValidatorLegacyApiTest extends LessThanValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyLocaleValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyLocaleValidatorLegacyApiTest.php
deleted file mode 100644
index f55d42205fc28..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyLocaleValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyLocaleValidatorLegacyApiTest extends LocaleValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyLuhnValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyLuhnValidatorLegacyApiTest.php
deleted file mode 100644
index 58555266e9eb9..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyLuhnValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyLuhnValidatorLegacyApiTest extends LuhnValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyNotBlankValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyNotBlankValidatorLegacyApiTest.php
deleted file mode 100644
index 0aaaa77c442eb..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyNotBlankValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyNotBlankValidatorLegacyApiTest extends NotBlankValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyNotEqualToValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyNotEqualToValidatorLegacyApiTest.php
deleted file mode 100644
index df88f96b54055..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyNotEqualToValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyNotEqualToValidatorLegacyApiTest extends NotEqualToValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyNotIdenticalToValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyNotIdenticalToValidatorLegacyApiTest.php
deleted file mode 100644
index 25819a622fcb0..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyNotIdenticalToValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyNotIdenticalToValidatorLegacyApiTest extends NotIdenticalToValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyNotNullValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyNotNullValidatorLegacyApiTest.php
deleted file mode 100644
index 41a9e5407c00c..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyNotNullValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyNotNullValidatorLegacyApiTest extends NotNullValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyNullValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyNullValidatorLegacyApiTest.php
deleted file mode 100644
index 79536ced6ba12..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyNullValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyNullValidatorLegacyApiTest extends NullValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyRangeValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyRangeValidatorLegacyApiTest.php
deleted file mode 100644
index 866a59adfeb05..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyRangeValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyRangeValidatorLegacyApiTest extends RangeValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyRegexValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyRegexValidatorLegacyApiTest.php
deleted file mode 100644
index ed1a4648c21d9..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyRegexValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyRegexValidatorLegacyApiTest extends RegexValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyTimeValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyTimeValidatorLegacyApiTest.php
deleted file mode 100644
index 2458d873ac800..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyTimeValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyTimeValidatorLegacyApiTest extends TimeValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyTrueValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyTrueValidatorLegacyApiTest.php
deleted file mode 100644
index 706c08373ce19..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyTrueValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyTrueValidatorLegacyApiTest extends TrueValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyTypeValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyTypeValidatorLegacyApiTest.php
deleted file mode 100644
index 26eb39ffb1262..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyTypeValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,29 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyTypeValidatorLegacyApiTest extends TypeValidatorTest
-{
- protected static $file;
-
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyUrlValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyUrlValidatorLegacyApiTest.php
deleted file mode 100644
index 0830ddb40fa6f..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyUrlValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyUrlValidatorLegacyApiTest extends UrlValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LegacyUuidValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LegacyUuidValidatorLegacyApiTest.php
deleted file mode 100644
index 4a4e36298b7b1..0000000000000
--- a/src/Symfony/Component/Validator/Tests/Constraints/LegacyUuidValidatorLegacyApiTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Validator\Tests\Constraints;
-
-use Symfony\Component\Validator\Validation;
-
-/**
- * @since 2.5.3
- * @author Bernhard Schussek
- * @group legacy
- */
-class LegacyUuidValidatorLegacyApiTest extends UuidValidatorTest
-{
- protected function getApiVersion()
- {
- return Validation::API_VERSION_2_5_BC;
- }
-}
diff --git a/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php b/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php
index af20f9cd7affc..88e8b3b82689d 100644
--- a/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php
+++ b/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php
@@ -110,31 +110,8 @@ public function testSetTranslationDomain()
$this->assertSame($this->builder, $this->builder->setTranslationDomain('TRANS_DOMAIN'));
}
- /**
- * @group legacy
- */
- public function testLegacyDefaultApiVersion()
- {
- $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
-
- // Legacy compatible implementation
- $this->assertInstanceOf('Symfony\Component\Validator\Validator\LegacyValidator', $this->builder->getValidator());
- }
-
- public function testSetApiVersion25()
+ public function testGetValidator()
{
- $this->assertSame($this->builder, $this->builder->setApiVersion(Validation::API_VERSION_2_5));
$this->assertInstanceOf('Symfony\Component\Validator\Validator\RecursiveValidator', $this->builder->getValidator());
}
-
- /**
- * @group legacy
- */
- public function testLegacySetApiVersion24And25()
- {
- $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
-
- $this->assertSame($this->builder, $this->builder->setApiVersion(Validation::API_VERSION_2_5_BC));
- $this->assertInstanceOf('Symfony\Component\Validator\Validator\LegacyValidator', $this->builder->getValidator());
- }
}
diff --git a/src/Symfony/Component/Validator/Validator/LegacyValidator.php b/src/Symfony/Component/Validator/Validator/LegacyValidator.php
index 8995f2cfdd593..6c5a10c355591 100644
--- a/src/Symfony/Component/Validator/Validator/LegacyValidator.php
+++ b/src/Symfony/Component/Validator/Validator/LegacyValidator.php
@@ -11,10 +11,7 @@
namespace Symfony\Component\Validator\Validator;
-use Symfony\Component\Validator\Constraint;
-use Symfony\Component\Validator\Constraints\GroupSequence;
-use Symfony\Component\Validator\Constraints\Valid;
-use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface;
+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+.
@@ -27,49 +24,6 @@
*
* @deprecated since version 2.5, to be removed in 3.0.
*/
-class LegacyValidator extends RecursiveValidator implements LegacyValidatorInterface
+class LegacyValidator extends RecursiveValidator
{
- public function validate($value, $groups = null, $traverse = false, $deep = false)
- {
- $numArgs = func_num_args();
-
- // Use new signature if constraints are given in the second argument
- if (self::testConstraints($groups) && ($numArgs < 3 || 3 === $numArgs && self::testGroups($traverse))) {
- // Rename to avoid total confusion ;)
- $constraints = $groups;
- $groups = $traverse;
-
- return parent::validate($value, $constraints, $groups);
- }
-
- 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));
-
- return parent::validate($value, $constraint, $groups);
- }
-
- 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);
-
- return parent::validate($value, $constraints, $groups);
- }
-
- 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);
-
- return $this->metadataFactory;
- }
-
- private static function testConstraints($constraints)
- {
- return null === $constraints || $constraints instanceof Constraint || (is_array($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));
- }
}
diff --git a/src/Symfony/Component/Validator/Validator/RecursiveValidator.php b/src/Symfony/Component/Validator/Validator/RecursiveValidator.php
index ddf0850c1cf2a..c825bfa6f48b8 100644
--- a/src/Symfony/Component/Validator/Validator/RecursiveValidator.php
+++ b/src/Symfony/Component/Validator/Validator/RecursiveValidator.php
@@ -11,11 +11,15 @@
namespace Symfony\Component\Validator\Validator;
+use Symfony\Component\Validator\Constraint;
+use Symfony\Component\Validator\Constraints\GroupSequence;
+use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\ConstraintValidatorFactoryInterface;
use Symfony\Component\Validator\Context\ExecutionContextFactoryInterface;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Component\Validator\MetadataFactoryInterface;
use Symfony\Component\Validator\ObjectInitializerInterface;
+use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface;
/**
* Recursive implementation of {@link ValidatorInterface}.
@@ -23,7 +27,7 @@
* @since 2.5
* @author Bernhard Schussek
*/
-class RecursiveValidator implements ValidatorInterface
+class RecursiveValidator implements ValidatorInterface, LegacyValidatorInterface
{
/**
* @var ExecutionContextFactoryInterface
@@ -110,8 +114,21 @@ public function hasMetadataFor($object)
/**
* {@inheritdoc}
*/
- public function validate($value, $constraints = null, $groups = null)
+ public function validate($value, $groups = null, $traverse = false, $deep = false)
{
+ $numArgs = func_num_args();
+
+ // Use new signature if constraints are given in the second argument
+ if (self::testConstraints($groups) && ($numArgs < 3 || 3 === $numArgs && self::testGroups($traverse))) {
+ // Rename to avoid total confusion ;)
+ $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);
+
+ $constraints = new Valid(array('traverse' => $traverse, 'deep' => $deep));
+ }
+
return $this->startContext($value)
->validate($value, $constraints, $groups)
->getViolations();
@@ -137,4 +154,34 @@ public function validatePropertyValue($objectOrClass, $propertyName, $value, $gr
->validatePropertyValue($objectOrClass, $propertyName, $value, $groups)
->getViolations();
}
+
+ /**
+ * {@inheritdoc}
+ */
+ 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);
+
+ return $this->validate($value, $constraints, $groups);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ 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);
+
+ return $this->metadataFactory;
+ }
+
+ private static function testConstraints($constraints)
+ {
+ return null === $constraints || $constraints instanceof Constraint || (is_array($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));
+ }
}
diff --git a/src/Symfony/Component/Validator/ValidatorBuilder.php b/src/Symfony/Component/Validator/ValidatorBuilder.php
index e47d1f42a6822..dd772cf383254 100644
--- a/src/Symfony/Component/Validator/ValidatorBuilder.php
+++ b/src/Symfony/Component/Validator/ValidatorBuilder.php
@@ -19,7 +19,6 @@
use Symfony\Component\Translation\IdentityTranslator;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\Context\ExecutionContextFactory;
-use Symfony\Component\Validator\Context\LegacyExecutionContextFactory;
use Symfony\Component\Validator\Exception\InvalidArgumentException;
use Symfony\Component\Validator\Exception\ValidatorException;
use Symfony\Component\Validator\Mapping\Cache\CacheInterface;
@@ -31,7 +30,6 @@
use Symfony\Component\Validator\Mapping\Loader\XmlFilesLoader;
use Symfony\Component\Validator\Mapping\Loader\YamlFileLoader;
use Symfony\Component\Validator\Mapping\Loader\YamlFilesLoader;
-use Symfony\Component\Validator\Validator\LegacyValidator;
use Symfony\Component\Validator\Validator\RecursiveValidator;
/**
@@ -96,11 +94,6 @@ class ValidatorBuilder implements ValidatorBuilderInterface
*/
private $propertyAccessor;
- /**
- * @var int|null
- */
- private $apiVersion;
-
/**
* {@inheritdoc}
*/
@@ -320,18 +313,17 @@ public function setPropertyAccessor(PropertyAccessorInterface $propertyAccessor)
/**
* {@inheritdoc}
+ *
+ * @deprecated since version 2.7, to be removed in 3.0.
*/
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);
+
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
- ));
+ throw new InvalidArgumentException(sprintf('The requested API version is invalid: "%s"', $apiVersion));
}
- $this->apiVersion = $apiVersion;
-
return $this;
}
@@ -341,11 +333,6 @@ public function setApiVersion($apiVersion)
public function getValidator()
{
$metadataFactory = $this->metadataFactory;
- $apiVersion = $this->apiVersion;
-
- if (null === $apiVersion) {
- $apiVersion = Validation::API_VERSION_2_5_BC;
- }
if (!$metadataFactory) {
$loaders = array();
@@ -393,14 +380,8 @@ public function getValidator()
$translator->setLocale('en');
}
- if (Validation::API_VERSION_2_5 === $apiVersion) {
- $contextFactory = new ExecutionContextFactory($translator, $this->translationDomain);
-
- return new RecursiveValidator($contextFactory, $metadataFactory, $validatorFactory, $this->initializers);
- }
-
- $contextFactory = new LegacyExecutionContextFactory($metadataFactory, $translator, $this->translationDomain);
+ $contextFactory = new ExecutionContextFactory($translator, $this->translationDomain);
- return new LegacyValidator($contextFactory, $metadataFactory, $validatorFactory, $this->initializers);
+ return new RecursiveValidator($contextFactory, $metadataFactory, $validatorFactory, $this->initializers);
}
}
diff --git a/src/Symfony/Component/Validator/ValidatorBuilderInterface.php b/src/Symfony/Component/Validator/ValidatorBuilderInterface.php
index 6e2dd96a2dfce..cc0007770578b 100644
--- a/src/Symfony/Component/Validator/ValidatorBuilderInterface.php
+++ b/src/Symfony/Component/Validator/ValidatorBuilderInterface.php
@@ -180,6 +180,8 @@ public function setPropertyAccessor(PropertyAccessorInterface $propertyAccessor)
*
* @see Validation::API_VERSION_2_5
* @see Validation::API_VERSION_2_5_BC
+ *
+ * @deprecated since version 2.7, to be removed in 3.0.
*/
public function setApiVersion($apiVersion);