feature #14016 Remove the API version in the validator component (saro0h, fabpot, stof)

This PR was merged into the 2.7 branch.

Discussion
----------

  Remove the API version in the validator component

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #13458
| License       | MIT
| Doc PR        | n/a

This completes the work of #13517

Commits
-------

9438206 Complete the removal of API versions in the validator component
75088c0 [Validator] deprecated API version
0c69f69 Removed 2.5 bc layer
This commit is contained in:
Fabien Potencier 2015-03-23 09:58:54 +01:00
commit f5a020e275
70 changed files with 170 additions and 1652 deletions

View File

@ -112,6 +112,14 @@ class Configuration implements ConfigurationInterface
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 @@ class Configuration implements ConfigurationInterface
->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 @@ class Configuration implements ConfigurationInterface
->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()
;
}

View File

@ -761,20 +761,11 @@ class FrameworkExtension extends Extension
$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)

View File

@ -153,7 +153,6 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
'static_method' => array('loadValidatorMetadata'),
'translation_domain' => 'validators',
'strict_email' => false,
'api' => '2.5-bc',
),
'annotations' => array(
'cache' => 'file',

View File

@ -1,9 +0,0 @@
<?php
$container->loadFromExtension('framework', array(
'secret' => 's3cr3t',
'validation' => array(
'enabled' => true,
'api' => '2.5',
),
));

View File

@ -1,9 +0,0 @@
<?php
$container->loadFromExtension('framework', array(
'secret' => 's3cr3t',
'validation' => array(
'enabled' => true,
'api' => '2.5-bc',
),
));

View File

@ -1,9 +0,0 @@
<?php
$container->loadFromExtension('framework', array(
'secret' => 's3cr3t',
'validation' => array(
'enabled' => true,
'api' => 'auto',
),
));

View File

@ -1,8 +0,0 @@
<?php
$container->loadFromExtension('framework', array(
'secret' => 's3cr3t',
'validation' => array(
'enabled' => true,
),
));

View File

@ -1,12 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config secret="s3cr3t">
<framework:validation enabled="true" api="2.5" />
</framework:config>
</container>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config secret="s3cr3t">
<framework:validation enabled="true" api="2.5-bc" />
</framework:config>
</container>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config secret="s3cr3t">
<framework:validation enabled="true" api="auto" />
</framework:config>
</container>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config secret="s3cr3t">
<framework:validation enabled="true" />
</framework:config>
</container>

View File

@ -1,5 +0,0 @@
framework:
secret: s3cr3t
validation:
enabled: true
api: 2.5

View File

@ -1,5 +0,0 @@
framework:
secret: s3cr3t
validation:
enabled: true
api: 2.5-bc

View File

@ -1,5 +0,0 @@
framework:
secret: s3cr3t
validation:
enabled: true
api: auto

View File

@ -1,4 +0,0 @@
framework:
secret: s3cr3t
validation:
enabled: true

View File

@ -276,7 +276,7 @@ abstract class FrameworkExtensionTest extends TestCase
$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 @@ abstract class FrameworkExtensionTest extends TestCase
$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 @@ abstract class FrameworkExtensionTest extends TestCase
$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 @@ abstract class FrameworkExtensionTest extends TestCase
$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 @@ abstract class FrameworkExtensionTest extends TestCase
$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 @@ abstract class FrameworkExtensionTest extends TestCase
$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');

View File

@ -14,13 +14,14 @@ namespace Symfony\Component\Validator\Context;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\ClassBasedInterface;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;
use Symfony\Component\Validator\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 @@ 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) {
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 @@ class ExecutionContext implements ExecutionContextInterface
*/
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 @@ class ExecutionContext implements ExecutionContextInterface
*/
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 @@ class ExecutionContext implements ExecutionContextInterface
*/
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 @@ class ExecutionContext implements ExecutionContextInterface
*/
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;
}
/**

View File

@ -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 @@ class LegacyExecutionContext extends ExecutionContext
$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;
}
}

View File

@ -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;

View File

@ -21,7 +21,6 @@ use Symfony\Component\Validator\Context\LegacyExecutionContext;
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 @@ abstract class AbstractConstraintValidatorTest extends \PHPUnit_Framework_TestCa
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();
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyAllValidatorLegacyApiTest extends AllValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyBlankValidatorLegacyApiTest extends BlankValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyCallbackValidatorLegacyApiTest extends CallbackValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyCardSchemeValidatorLegacyApiTest extends CardSchemeValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyChoiceValidatorLegacyApiTest extends ChoiceValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,25 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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;
}
}

View File

@ -1,25 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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;
}
}

View File

@ -1,25 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyCountValidatorArrayLegacyApiTest extends CountValidatorArrayTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyCountValidatorCountableLegacyApiTest extends CountValidatorCountableTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyCurrencyValidatorLegacyApiTest extends CurrencyValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyDateTimeValidatorLegacyApiTest extends DateTimeValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyDateValidatorLegacyApiTest extends DateValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyEmailValidatorLegacyApiTest extends EmailValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyEqualToValidatorLegacyApiTest extends EqualToValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyExpressionValidatorLegacyApiTest extends ExpressionValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyFalseValidatorLegacyApiTest extends FalseValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyFileValidatorObjectLegacyApiTest extends FileValidatorObjectTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyFileValidatorPathLegacyApiTest extends FileValidatorPathTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyGreaterThanOrEqualValidatorLegacyApiTest extends GreaterThanOrEqualValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyGreaterThanValidatorLegacyApiTest extends GreaterThanValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyIbanValidatorLegacyApiTest extends IbanValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyIdenticalToValidatorLegacyApiTest extends IdenticalToValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyImageValidatorLegacyApiTest extends ImageValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyIpValidatorLegacyApiTest extends IpValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyIsbnValidatorLegacyApiTest extends IsbnValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyIssnValidatorLegacyApiTest extends IssnValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyLanguageValidatorLegacyApiTest extends LanguageValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyLengthValidatorLegacyApiTest extends LengthValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyLessThanOrEqualValidatorLegacyApiTest extends LessThanOrEqualValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyLessThanValidatorLegacyApiTest extends LessThanValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyLocaleValidatorLegacyApiTest extends LocaleValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyLuhnValidatorLegacyApiTest extends LuhnValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyNotBlankValidatorLegacyApiTest extends NotBlankValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyNotEqualToValidatorLegacyApiTest extends NotEqualToValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyNotIdenticalToValidatorLegacyApiTest extends NotIdenticalToValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyNotNullValidatorLegacyApiTest extends NotNullValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyNullValidatorLegacyApiTest extends NullValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyRangeValidatorLegacyApiTest extends RangeValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyRegexValidatorLegacyApiTest extends RegexValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyTimeValidatorLegacyApiTest extends TimeValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyTrueValidatorLegacyApiTest extends TrueValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyTypeValidatorLegacyApiTest extends TypeValidatorTest
{
protected static $file;
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyUrlValidatorLegacyApiTest extends UrlValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
* @group legacy
*/
class LegacyUuidValidatorLegacyApiTest extends UuidValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -110,31 +110,8 @@ class ValidatorBuilderTest extends \PHPUnit_Framework_TestCase
$this->assertSame($this->builder, $this->builder->setTranslationDomain('TRANS_DOMAIN'));
}
/**
* @group legacy
*/
public function testLegacyDefaultApiVersion()
public function testGetValidator()
{
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
// Legacy compatible implementation
$this->assertInstanceOf('Symfony\Component\Validator\Validator\LegacyValidator', $this->builder->getValidator());
}
public function testSetApiVersion25()
{
$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());
}
}

View File

@ -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 @@ use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface;
*
* @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));
}
}

View File

@ -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 @@ use Symfony\Component\Validator\ObjectInitializerInterface;
* @since 2.5
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class RecursiveValidator implements ValidatorInterface
class RecursiveValidator implements ValidatorInterface, LegacyValidatorInterface
{
/**
* @var ExecutionContextFactoryInterface
@ -110,8 +114,21 @@ class RecursiveValidator implements ValidatorInterface
/**
* {@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 @@ class RecursiveValidator implements ValidatorInterface
->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));
}
}

View File

@ -19,7 +19,6 @@ use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
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\XmlFileLoader;
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,17 +313,16 @@ class ValidatorBuilder implements ValidatorBuilderInterface
/**
* {@inheritdoc}
*
* @deprecated since version 2.7, to be removed in 3.0.
*/
public function setApiVersion($apiVersion)
{
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
));
}
trigger_error('The '.__METHOD__.' method is deprecated in version 2.7 and will be removed in version 3.0.', E_USER_DEPRECATED);
$this->apiVersion = $apiVersion;
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));
}
return $this;
}
@ -341,11 +333,6 @@ class ValidatorBuilder implements ValidatorBuilderInterface
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 @@ class ValidatorBuilder implements ValidatorBuilderInterface
$translator->setLocale('en');
}
if (Validation::API_VERSION_2_5 === $apiVersion) {
$contextFactory = new ExecutionContextFactory($translator, $this->translationDomain);
$contextFactory = new ExecutionContextFactory($translator, $this->translationDomain);
return new RecursiveValidator($contextFactory, $metadataFactory, $validatorFactory, $this->initializers);
}
$contextFactory = new LegacyExecutionContextFactory($metadataFactory, $translator, $this->translationDomain);
return new LegacyValidator($contextFactory, $metadataFactory, $validatorFactory, $this->initializers);
return new RecursiveValidator($contextFactory, $metadataFactory, $validatorFactory, $this->initializers);
}
}

View File

@ -180,6 +180,8 @@ interface ValidatorBuilderInterface
*
* @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);